Latest update, add TLS 1.3 session time configuration.
This commit is contained in:
@@ -9,6 +9,24 @@
|
||||
|
||||
Changes between 1.1.1 and 3.0.0 [xx XXX xxxx]
|
||||
|
||||
*) The functions AES_ige_encrypt() and AES_bi_ige_encrypt() have been
|
||||
deprecated. These undocumented functions were never integrated into the EVP
|
||||
layer and implement the AES Infinite Garble Extension (IGE) mode and AES
|
||||
Bi-directional IGE mode. These modes were never formally standardised and
|
||||
usage of these functions is believed to be very small. In particular
|
||||
AES_bi_ige_encrypt() has a known bug. It accepts 2 AES keys, but only one
|
||||
is ever used. The security implications are believed to be minimal, but
|
||||
this issue was never fixed for backwards compatibility reasons. New code
|
||||
should not use these modes.
|
||||
[Matt Caswell]
|
||||
|
||||
*) Add prediction resistance to the DRBG reseeding process.
|
||||
[Paul Dale]
|
||||
|
||||
*) Limit the number of blocks in a data unit for AES-XTS to 2^20 as
|
||||
mandated by IEEE Std 1619-2018.
|
||||
[Paul Dale]
|
||||
|
||||
*) Added newline escaping functionality to a filename when using openssl dgst.
|
||||
This output format is to replicate the output format found in the '*sum'
|
||||
checksum programs. This aims to preserve backward compatibility.
|
||||
@@ -16,6 +34,7 @@
|
||||
|
||||
*) Removed the heartbeat message in DTLS feature, as it has very
|
||||
little usage and doesn't seem to fulfill a valuable purpose.
|
||||
The configuration option is now deprecated.
|
||||
[Richard Levitte]
|
||||
|
||||
*) Changed the output of 'openssl {digestname} < file' to display the
|
||||
|
||||
@@ -1431,7 +1431,7 @@ my %targets = (
|
||||
|
||||
#### Cygwin
|
||||
"Cygwin-common" => {
|
||||
inherit_from => [ "BASE_unix", asm("x86_asm") ],
|
||||
inherit_from => [ "BASE_unix" ],
|
||||
template => 1,
|
||||
|
||||
CC => "gcc",
|
||||
|
||||
@@ -151,9 +151,9 @@
|
||||
return "" if $cache{$lib};
|
||||
$OUT .= obj2dso(lib => $lib,
|
||||
attrs => $unified_info{attributes}->{$lib},
|
||||
objs => $unified_info{shared_sources}->{$lib},
|
||||
objs => $unified_info{sources}->{$lib},
|
||||
deps => [ resolvedepends($lib) ]);
|
||||
foreach (@{$unified_info{shared_sources}->{$lib}}) {
|
||||
foreach (@{$unified_info{sources}->{$lib}}) {
|
||||
# If this is somehow a compiled object, take care of it that way
|
||||
# Otherwise, it might simply be generated
|
||||
if (defined $unified_info{sources}->{$_}) {
|
||||
|
||||
@@ -32,6 +32,7 @@ my %shared_info;
|
||||
return {
|
||||
%{$shared_info{'gnu-shared'}},
|
||||
shared_defflag => '-Wl,--version-script=',
|
||||
dso_ldflags => '-z defs',
|
||||
};
|
||||
},
|
||||
'bsd-gcc-shared' => sub { return $shared_info{'linux-shared'}; },
|
||||
|
||||
@@ -24,7 +24,7 @@ use OpenSSL::Glob;
|
||||
my $orig_death_handler = $SIG{__DIE__};
|
||||
$SIG{__DIE__} = \&death_handler;
|
||||
|
||||
my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-dso] [no-egd] [sctp] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--config=FILE] os/compiler[:flags]\n";
|
||||
my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-egd] [sctp] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--config=FILE] os/compiler[:flags]\n";
|
||||
|
||||
# Options:
|
||||
#
|
||||
@@ -59,8 +59,6 @@ my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [-Dxxx] [-lx
|
||||
# [no-]pic [don't] try to build position independent code when supported.
|
||||
# If disabled, it also disables shared and dynamic-engine.
|
||||
# no-asm do not use assembler
|
||||
# no-dso do not compile in any native shared-library methods. This
|
||||
# will ensure that all methods just return NULL.
|
||||
# no-egd do not compile support for the entropy-gathering daemon APIs
|
||||
# [no-]zlib [don't] compile support for zlib compression.
|
||||
# zlib-dynamic Like "zlib", but the zlib library is expected to be a shared
|
||||
@@ -76,7 +74,7 @@ my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [-Dxxx] [-lx
|
||||
# -static while -static is also a pass-through compiler option (and
|
||||
# as such is limited to environments where it's actually
|
||||
# meaningful), it triggers a number configuration options,
|
||||
# namely no-dso, no-pic, no-shared and no-threads. It is
|
||||
# namely no-pic, no-shared and no-threads. It is
|
||||
# argued that the only reason to produce statically linked
|
||||
# binaries (and in context it means executables linked with
|
||||
# -static flag, and not just executables linked with static
|
||||
@@ -359,7 +357,6 @@ my @disablables = (
|
||||
"dgram",
|
||||
"dh",
|
||||
"dsa",
|
||||
"dso",
|
||||
"dtls",
|
||||
"dynamic-engine",
|
||||
"ec",
|
||||
@@ -372,14 +369,17 @@ my @disablables = (
|
||||
"err",
|
||||
"external-tests",
|
||||
"filenames",
|
||||
"fips",
|
||||
"fuzz-libfuzzer",
|
||||
"fuzz-afl",
|
||||
"gost",
|
||||
"idea",
|
||||
"legacy",
|
||||
"makedepend",
|
||||
"md2",
|
||||
"md4",
|
||||
"mdc2",
|
||||
"module",
|
||||
"msan",
|
||||
"multiblock",
|
||||
"nextprotoneg",
|
||||
@@ -440,6 +440,8 @@ my %deprecated_disablables = (
|
||||
"hw-padlock" => "padlockeng",
|
||||
"ripemd" => "rmd160",
|
||||
"ui" => "ui-console",
|
||||
"dso" => undef,
|
||||
"heartbeats" => undef,
|
||||
);
|
||||
|
||||
# All of the following are disabled by default:
|
||||
@@ -494,12 +496,25 @@ my @disable_cascades = (
|
||||
|
||||
"crypto-mdebug" => [ "crypto-mdebug-backtrace" ],
|
||||
|
||||
# Without DSO, we can't load dynamic engines, so don't build them dynamic
|
||||
"dso" => [ "dynamic-engine" ],
|
||||
# If no modules, then no dynamic engines either
|
||||
"module" => [ "dynamic-engine" ],
|
||||
|
||||
# Without position independent code, there can be no shared libraries or DSOs
|
||||
"pic" => [ "shared" ],
|
||||
# Without shared libraries, dynamic engines aren't possible.
|
||||
# This is due to them having to link with libcrypto and register features
|
||||
# using the ENGINE functionality, and since that relies on global tables,
|
||||
# those *have* to be exacty the same as the ones accessed from the app,
|
||||
# which cannot be guaranteed if shared libraries aren't present.
|
||||
# (note that even with shared libraries, both the app and dynamic engines
|
||||
# must be linked with the same library)
|
||||
"shared" => [ "dynamic-engine" ],
|
||||
# Other modules don't necessarily have to link with libcrypto, so shared
|
||||
# libraries do not have to be a condition to produce those.
|
||||
|
||||
# Without position independent code, there can be no shared libraries
|
||||
# or modules.
|
||||
"pic" => [ "shared", "module" ],
|
||||
|
||||
"module" => [ "fips", "legacy" ],
|
||||
|
||||
"engine" => [ grep /eng$/, @disablables ],
|
||||
"hw" => [ "padlockeng" ],
|
||||
@@ -518,6 +533,7 @@ my @disable_cascades = (
|
||||
sub { !$disabled{"msan"} } => [ "asm" ],
|
||||
|
||||
sub { $disabled{cmac}; } => [ "siv" ],
|
||||
"legacy" => [ "md2" ],
|
||||
);
|
||||
|
||||
# Avoid protocol support holes. Also disable all versions below N, if version
|
||||
@@ -876,7 +892,6 @@ while (@argvcopy)
|
||||
elsif (/^-static$/)
|
||||
{
|
||||
push @{$useradd{LDFLAGS}}, $_;
|
||||
$disabled{"dso"} = "forced";
|
||||
$disabled{"pic"} = "forced";
|
||||
$disabled{"shared"} = "forced";
|
||||
$disabled{"threads"} = "forced";
|
||||
@@ -1211,9 +1226,9 @@ foreach my $what (sort keys %disabled) {
|
||||
|
||||
$config{options} .= " no-$what";
|
||||
|
||||
if (!grep { $what eq $_ } ( 'buildtest-c++', 'dso', 'threads', 'shared',
|
||||
'pic', 'dynamic-engine', 'makedepend',
|
||||
'zlib-dynamic', 'zlib', 'sse2' )) {
|
||||
if (!grep { $what eq $_ } ( 'buildtest-c++', 'fips', 'threads', 'shared',
|
||||
'module', 'pic', 'dynamic-engine', 'makedepend',
|
||||
'zlib-dynamic', 'zlib', 'sse2', 'legacy' )) {
|
||||
(my $WHAT = uc $what) =~ s|-|_|g;
|
||||
my $skipdir = $what;
|
||||
|
||||
@@ -1317,9 +1332,8 @@ if ($target{shared_target} eq "")
|
||||
{
|
||||
$no_shared_warn = 1
|
||||
if (!$disabled{shared} || !$disabled{"dynamic-engine"});
|
||||
$disabled{shared} = "no-shared-target";
|
||||
$disabled{pic} = $disabled{shared} = $disabled{"dynamic-engine"} =
|
||||
"no-shared-target";
|
||||
$disabled{module} = "no-shared-target";
|
||||
}
|
||||
|
||||
if ($disabled{"dynamic-engine"}) {
|
||||
@@ -2196,9 +2210,8 @@ EOF
|
||||
src => [ 'sources',
|
||||
'shared_sources' ],
|
||||
dst => 'shared_sources' } },
|
||||
modules => { dso => { src => [ 'sources',
|
||||
'shared_sources' ],
|
||||
dst => 'shared_sources' } },
|
||||
modules => { dso => { src => [ 'sources' ],
|
||||
dst => 'sources' } },
|
||||
scripts => { script => { src => [ 'sources' ],
|
||||
dst => 'sources' } }
|
||||
} -> {$prodtype};
|
||||
|
||||
@@ -353,9 +353,6 @@
|
||||
on BSD implementations, in which case it can be disabled with
|
||||
no-devcryptoeng.
|
||||
|
||||
no-dso
|
||||
Don't build support for loading Dynamic Shared Objects.
|
||||
|
||||
no-dynamic-engine
|
||||
Don't build the dynamically loaded engines. This only has an
|
||||
effect in a "shared" build
|
||||
@@ -397,6 +394,9 @@
|
||||
Don't compile in filename and line number information (e.g.
|
||||
for errors and memory allocation).
|
||||
|
||||
no-fips
|
||||
Don't compile the FIPS module
|
||||
|
||||
enable-fuzz-libfuzzer, enable-fuzz-afl
|
||||
Build with support for fuzzing using either libfuzzer or AFL.
|
||||
These are developer options only. They may not work on all
|
||||
@@ -409,9 +409,17 @@
|
||||
available if the GOST algorithms are also available through
|
||||
loading an externally supplied engine.
|
||||
|
||||
no-legacy
|
||||
Don't build the legacy provider. Disabling this also disables
|
||||
the legacy algorithms: MD2 (already disabled by default).
|
||||
|
||||
no-makedepend
|
||||
Don't generate dependencies.
|
||||
|
||||
no-module
|
||||
Don't build any dynamically loadable engines. This also
|
||||
implies 'no-dynamic-engine'.
|
||||
|
||||
no-multiblock
|
||||
Don't build support for writing multiple records in one
|
||||
go in libssl (Note: this is a different capability to the
|
||||
|
||||
+17
-2
@@ -30,7 +30,7 @@ typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
OPT_INFORM, OPT_OUTFORM, OPT_IN, OPT_OUT, OPT_TEXT, OPT_C,
|
||||
OPT_CHECK, OPT_LIST_CURVES, OPT_NO_SEED, OPT_NOOUT, OPT_NAME,
|
||||
OPT_CONV_FORM, OPT_PARAM_ENC, OPT_GENKEY, OPT_ENGINE,
|
||||
OPT_CONV_FORM, OPT_PARAM_ENC, OPT_GENKEY, OPT_ENGINE, OPT_CHECK_NAMED,
|
||||
OPT_R_ENUM
|
||||
} OPTION_CHOICE;
|
||||
|
||||
@@ -43,6 +43,8 @@ const OPTIONS ecparam_options[] = {
|
||||
{"text", OPT_TEXT, '-', "Print the ec parameters in text form"},
|
||||
{"C", OPT_C, '-', "Print a 'C' function creating the parameters"},
|
||||
{"check", OPT_CHECK, '-', "Validate the ec parameters"},
|
||||
{"check_named", OPT_CHECK_NAMED, '-',
|
||||
"Check that named EC curve parameters have not been modified"},
|
||||
{"list_curves", OPT_LIST_CURVES, '-',
|
||||
"Prints a list of all curve 'short names'"},
|
||||
{"no_seed", OPT_NO_SEED, '-',
|
||||
@@ -90,7 +92,7 @@ int ecparam_main(int argc, char **argv)
|
||||
int informat = FORMAT_PEM, outformat = FORMAT_PEM, noout = 0, C = 0;
|
||||
int ret = 1, private = 0;
|
||||
int list_curves = 0, no_seed = 0, check = 0, new_form = 0;
|
||||
int text = 0, i, genkey = 0;
|
||||
int text = 0, i, genkey = 0, check_named = 0;
|
||||
|
||||
prog = opt_init(argc, argv, ecparam_options);
|
||||
while ((o = opt_next()) != OPT_EOF) {
|
||||
@@ -127,6 +129,9 @@ int ecparam_main(int argc, char **argv)
|
||||
case OPT_CHECK:
|
||||
check = 1;
|
||||
break;
|
||||
case OPT_CHECK_NAMED:
|
||||
check_named = 1;
|
||||
break;
|
||||
case OPT_LIST_CURVES:
|
||||
list_curves = 1;
|
||||
break;
|
||||
@@ -266,6 +271,16 @@ int ecparam_main(int argc, char **argv)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (check_named) {
|
||||
BIO_printf(bio_err, "validating named elliptic curve parameters: ");
|
||||
if (EC_GROUP_check_named_curve(group, 0) <= 0) {
|
||||
BIO_printf(bio_err, "failed\n");
|
||||
ERR_print_errors(bio_err);
|
||||
goto end;
|
||||
}
|
||||
BIO_printf(bio_err, "ok\n");
|
||||
}
|
||||
|
||||
if (check) {
|
||||
BIO_printf(bio_err, "checking elliptic curve parameters: ");
|
||||
if (!EC_GROUP_check(group, NULL)) {
|
||||
|
||||
+1
-1
@@ -500,7 +500,7 @@ int enc_main(int argc, char **argv)
|
||||
if (hiv != NULL) {
|
||||
int siz = EVP_CIPHER_iv_length(cipher);
|
||||
if (siz == 0) {
|
||||
BIO_printf(bio_err, "warning: iv not use by this cipher\n");
|
||||
BIO_printf(bio_err, "warning: iv not used by this cipher\n");
|
||||
} else if (!set_hex(hiv, iv, siz)) {
|
||||
BIO_printf(bio_err, "invalid hex iv value\n");
|
||||
goto end;
|
||||
|
||||
+2
-2
@@ -32,8 +32,8 @@
|
||||
# define FORMAT_PKCS12 6
|
||||
# define FORMAT_SMIME (7 | B_FORMAT_TEXT)
|
||||
# define FORMAT_ENGINE 8 /* Not really a file format */
|
||||
# define FORMAT_PEMRSA (9 | B_FORMAT_TEXT) /* PEM RSAPubicKey format */
|
||||
# define FORMAT_ASN1RSA 10 /* DER RSAPubicKey format */
|
||||
# define FORMAT_PEMRSA (9 | B_FORMAT_TEXT) /* PEM RSAPublicKey format */
|
||||
# define FORMAT_ASN1RSA 10 /* DER RSAPublicKey format */
|
||||
# define FORMAT_MSBLOB 11 /* MS Key blob format */
|
||||
# define FORMAT_PVK 12 /* MS PVK file format */
|
||||
# define FORMAT_HTTP 13 /* Download using HTTP */
|
||||
|
||||
+27
-7
@@ -99,7 +99,8 @@ static void make_ocsp_response(BIO *err, OCSP_RESPONSE **resp, OCSP_REQUEST *req
|
||||
EVP_PKEY *rkey, const EVP_MD *md,
|
||||
STACK_OF(OPENSSL_STRING) *sigopts,
|
||||
STACK_OF(X509) *rother, unsigned long flags,
|
||||
int nmin, int ndays, int badsig);
|
||||
int nmin, int ndays, int badsig,
|
||||
const EVP_MD *resp_md);
|
||||
|
||||
static char **lookup_serial(CA_DB *db, ASN1_INTEGER *ser);
|
||||
static BIO *init_responder(const char *port);
|
||||
@@ -138,6 +139,7 @@ typedef enum OPTION_choice {
|
||||
OPT_RESPOUT, OPT_PATH, OPT_ISSUER, OPT_CERT, OPT_SERIAL,
|
||||
OPT_INDEX, OPT_CA, OPT_NMIN, OPT_REQUEST, OPT_NDAYS, OPT_RSIGNER,
|
||||
OPT_RKEY, OPT_ROTHER, OPT_RMD, OPT_RSIGOPT, OPT_HEADER,
|
||||
OPT_RCID,
|
||||
OPT_V_ENUM,
|
||||
OPT_MD,
|
||||
OPT_MULTI
|
||||
@@ -220,6 +222,7 @@ const OPTIONS ocsp_options[] = {
|
||||
{"rmd", OPT_RMD, 's', "Digest Algorithm to use in signature of OCSP response"},
|
||||
{"rsigopt", OPT_RSIGOPT, 's', "OCSP response signature parameter in n:v form"},
|
||||
{"header", OPT_HEADER, 's', "key=value header to add"},
|
||||
{"rcid", OPT_RCID, 's', "Use specified algorithm for cert id in response"},
|
||||
{"", OPT_MD, '-', "Any supported digest algorithm (sha1,sha256, ... )"},
|
||||
OPT_V_OPTIONS,
|
||||
{NULL}
|
||||
@@ -243,6 +246,7 @@ int ocsp_main(int argc, char **argv)
|
||||
STACK_OF(X509) *issuers = NULL;
|
||||
X509 *issuer = NULL, *cert = NULL;
|
||||
STACK_OF(X509) *rca_cert = NULL;
|
||||
const EVP_MD *resp_certid_md = NULL;
|
||||
X509 *signer = NULL, *rsigner = NULL;
|
||||
X509_STORE *store = NULL;
|
||||
X509_VERIFY_PARAM *vpm = NULL;
|
||||
@@ -499,6 +503,11 @@ int ocsp_main(int argc, char **argv)
|
||||
if (!X509V3_add_value(header, value, &headers))
|
||||
goto end;
|
||||
break;
|
||||
case OPT_RCID:
|
||||
resp_certid_md = EVP_get_digestbyname(opt_arg());
|
||||
if (resp_certid_md == NULL)
|
||||
goto opthelp;
|
||||
break;
|
||||
case OPT_MD:
|
||||
if (trailing_md) {
|
||||
BIO_printf(bio_err,
|
||||
@@ -684,7 +693,8 @@ redo_accept:
|
||||
|
||||
if (rdb != NULL) {
|
||||
make_ocsp_response(bio_err, &resp, req, rdb, rca_cert, rsigner, rkey,
|
||||
rsign_md, rsign_sigopts, rother, rflags, nmin, ndays, badsig);
|
||||
rsign_md, rsign_sigopts, rother, rflags, nmin, ndays, badsig,
|
||||
resp_certid_md);
|
||||
if (cbio != NULL)
|
||||
send_ocsp_response(cbio, resp);
|
||||
} else if (host != NULL) {
|
||||
@@ -1138,7 +1148,8 @@ static void make_ocsp_response(BIO *err, OCSP_RESPONSE **resp, OCSP_REQUEST *req
|
||||
EVP_PKEY *rkey, const EVP_MD *rmd,
|
||||
STACK_OF(OPENSSL_STRING) *sigopts,
|
||||
STACK_OF(X509) *rother, unsigned long flags,
|
||||
int nmin, int ndays, int badsig)
|
||||
int nmin, int ndays, int badsig,
|
||||
const EVP_MD *resp_md)
|
||||
{
|
||||
ASN1_TIME *thisupd = NULL, *nextupd = NULL;
|
||||
OCSP_CERTID *cid;
|
||||
@@ -1169,6 +1180,8 @@ static void make_ocsp_response(BIO *err, OCSP_RESPONSE **resp, OCSP_REQUEST *req
|
||||
int found = 0;
|
||||
ASN1_OBJECT *cert_id_md_oid;
|
||||
const EVP_MD *cert_id_md;
|
||||
OCSP_CERTID *cid_resp_md = NULL;
|
||||
|
||||
one = OCSP_request_onereq_get0(req, i);
|
||||
cid = OCSP_onereq_get0_id(one);
|
||||
|
||||
@@ -1184,11 +1197,18 @@ static void make_ocsp_response(BIO *err, OCSP_RESPONSE **resp, OCSP_REQUEST *req
|
||||
X509 *ca_cert = sk_X509_value(ca, jj);
|
||||
OCSP_CERTID *ca_id = OCSP_cert_to_id(cert_id_md, NULL, ca_cert);
|
||||
|
||||
if (OCSP_id_issuer_cmp(ca_id, cid) == 0)
|
||||
if (OCSP_id_issuer_cmp(ca_id, cid) == 0) {
|
||||
found = 1;
|
||||
|
||||
if (resp_md != NULL)
|
||||
cid_resp_md = OCSP_cert_to_id(resp_md, NULL, ca_cert);
|
||||
}
|
||||
OCSP_CERTID_free(ca_id);
|
||||
}
|
||||
OCSP_id_get0_info(NULL, NULL, NULL, &serial, cid);
|
||||
inf = lookup_serial(db, serial);
|
||||
|
||||
/* at this point, we can have cid be an alias of cid_resp_md */
|
||||
cid = (cid_resp_md != NULL) ? cid_resp_md : cid;
|
||||
|
||||
if (!found) {
|
||||
OCSP_basic_add1_status(bs, cid,
|
||||
@@ -1196,8 +1216,6 @@ static void make_ocsp_response(BIO *err, OCSP_RESPONSE **resp, OCSP_REQUEST *req
|
||||
0, NULL, thisupd, nextupd);
|
||||
continue;
|
||||
}
|
||||
OCSP_id_get0_info(NULL, NULL, NULL, &serial, cid);
|
||||
inf = lookup_serial(db, serial);
|
||||
if (inf == NULL) {
|
||||
OCSP_basic_add1_status(bs, cid,
|
||||
V_OCSP_CERTSTATUS_UNKNOWN,
|
||||
@@ -1212,6 +1230,7 @@ static void make_ocsp_response(BIO *err, OCSP_RESPONSE **resp, OCSP_REQUEST *req
|
||||
ASN1_GENERALIZEDTIME *invtm = NULL;
|
||||
OCSP_SINGLERESP *single;
|
||||
int reason = -1;
|
||||
|
||||
unpack_revinfo(&revtm, &reason, &inst, &invtm, inf[DB_rev_date]);
|
||||
single = OCSP_basic_add1_status(bs, cid,
|
||||
V_OCSP_CERTSTATUS_REVOKED,
|
||||
@@ -1227,6 +1246,7 @@ static void make_ocsp_response(BIO *err, OCSP_RESPONSE **resp, OCSP_REQUEST *req
|
||||
ASN1_TIME_free(revtm);
|
||||
ASN1_GENERALIZEDTIME_free(invtm);
|
||||
}
|
||||
OCSP_CERTID_free(cid_resp_md);
|
||||
}
|
||||
|
||||
OCSP_copy_nonce(bs, req);
|
||||
|
||||
+2
-2
@@ -688,7 +688,7 @@ static int do_raw_keyop(int pkey_op, EVP_PKEY_CTX *ctx,
|
||||
if (filesize < 0) {
|
||||
BIO_printf(bio_err,
|
||||
"Error: unable to determine file size for oneshot operation\n");
|
||||
return rv;
|
||||
goto end;
|
||||
}
|
||||
mbuf = app_malloc(filesize, "oneshot sign/verify buffer");
|
||||
switch(pkey_op) {
|
||||
@@ -717,7 +717,6 @@ static int do_raw_keyop(int pkey_op, EVP_PKEY_CTX *ctx,
|
||||
}
|
||||
break;
|
||||
}
|
||||
OPENSSL_free(mbuf);
|
||||
goto end;
|
||||
}
|
||||
|
||||
@@ -767,6 +766,7 @@ static int do_raw_keyop(int pkey_op, EVP_PKEY_CTX *ctx,
|
||||
}
|
||||
|
||||
end:
|
||||
OPENSSL_free(mbuf);
|
||||
EVP_MD_CTX_free(mctx);
|
||||
return rv;
|
||||
}
|
||||
+3
-1
@@ -2277,7 +2277,7 @@ int s_client_main(int argc, char **argv)
|
||||
do {
|
||||
mbuf_len = BIO_gets(fbio, mbuf, BUFSIZZ);
|
||||
}
|
||||
while (mbuf_len > 3 && mbuf[3] == '-');
|
||||
while (mbuf_len > 3 && (!isdigit(mbuf[0]) || !isdigit(mbuf[1]) || !isdigit(mbuf[2]) || mbuf[3] != ' '));
|
||||
(void)BIO_flush(fbio);
|
||||
BIO_pop(fbio);
|
||||
BIO_free(fbio);
|
||||
@@ -3313,6 +3313,8 @@ static void print_stuff(BIO *bio, SSL *s, int full)
|
||||
#ifndef OPENSSL_NO_KTLS
|
||||
if (BIO_get_ktls_send(SSL_get_wbio(s)))
|
||||
BIO_printf(bio_err, "Using Kernel TLS for sending\n");
|
||||
if (BIO_get_ktls_recv(SSL_get_rbio(s)))
|
||||
BIO_printf(bio_err, "Using Kernel TLS for receiving\n");
|
||||
#endif
|
||||
|
||||
if (OSSL_TRACE_ENABLED(TLS)) {
|
||||
|
||||
@@ -2921,6 +2921,8 @@ static void print_connection_info(SSL *con)
|
||||
#ifndef OPENSSL_NO_KTLS
|
||||
if (BIO_get_ktls_send(SSL_get_wbio(con)))
|
||||
BIO_printf(bio_err, "Using Kernel TLS for sending\n");
|
||||
if (BIO_get_ktls_recv(SSL_get_rbio(con)))
|
||||
BIO_printf(bio_err, "Using Kernel TLS for receiving\n");
|
||||
#endif
|
||||
|
||||
(void)BIO_flush(bio_s_out);
|
||||
|
||||
+94
-5
@@ -57,6 +57,9 @@
|
||||
# include <openssl/md5.h>
|
||||
#endif
|
||||
#include <openssl/hmac.h>
|
||||
#ifndef OPENSSL_NO_CMAC
|
||||
#include <openssl/cmac.h>
|
||||
#endif
|
||||
#include <openssl/sha.h>
|
||||
#ifndef OPENSSL_NO_RMD160
|
||||
# include <openssl/ripemd.h>
|
||||
@@ -163,10 +166,12 @@ static int DES_ede3_cbc_encrypt_loop(void *args);
|
||||
#endif
|
||||
static int AES_cbc_128_encrypt_loop(void *args);
|
||||
static int AES_cbc_192_encrypt_loop(void *args);
|
||||
static int AES_ige_128_encrypt_loop(void *args);
|
||||
static int AES_cbc_256_encrypt_loop(void *args);
|
||||
#if !OPENSSL_API_3
|
||||
static int AES_ige_128_encrypt_loop(void *args);
|
||||
static int AES_ige_192_encrypt_loop(void *args);
|
||||
static int AES_ige_256_encrypt_loop(void *args);
|
||||
#endif
|
||||
static int CRYPTO_gcm128_aad_loop(void *args);
|
||||
static int RAND_bytes_loop(void *args);
|
||||
static int EVP_Update_loop(void *args);
|
||||
@@ -300,7 +305,7 @@ typedef enum OPTION_choice {
|
||||
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
|
||||
OPT_ELAPSED, OPT_EVP, OPT_HMAC, OPT_DECRYPT, OPT_ENGINE, OPT_MULTI,
|
||||
OPT_MR, OPT_MB, OPT_MISALIGN, OPT_ASYNCJOBS, OPT_R_ENUM,
|
||||
OPT_PRIMES, OPT_SECONDS, OPT_BYTES, OPT_AEAD
|
||||
OPT_PRIMES, OPT_SECONDS, OPT_BYTES, OPT_AEAD, OPT_CMAC
|
||||
} OPTION_CHOICE;
|
||||
|
||||
const OPTIONS speed_options[] = {
|
||||
@@ -309,6 +314,9 @@ const OPTIONS speed_options[] = {
|
||||
{"help", OPT_HELP, '-', "Display this summary"},
|
||||
{"evp", OPT_EVP, 's', "Use EVP-named cipher or digest"},
|
||||
{"hmac", OPT_HMAC, 's', "HMAC using EVP-named digest"},
|
||||
#ifndef OPENSSL_NO_CMAC
|
||||
{"cmac", OPT_CMAC, 's', "CMAC using EVP-named cipher"},
|
||||
#endif
|
||||
{"decrypt", OPT_DECRYPT, '-',
|
||||
"Time decryption instead of encryption (only EVP)"},
|
||||
{"aead", OPT_AEAD, '-',
|
||||
@@ -371,6 +379,7 @@ const OPTIONS speed_options[] = {
|
||||
#define D_GHASH 29
|
||||
#define D_RAND 30
|
||||
#define D_EVP_HMAC 31
|
||||
#define D_EVP_CMAC 32
|
||||
|
||||
/* name of algorithms to test */
|
||||
static const char *names[] = {
|
||||
@@ -381,7 +390,7 @@ static const char *names[] = {
|
||||
"camellia-128 cbc", "camellia-192 cbc", "camellia-256 cbc",
|
||||
"evp", "sha256", "sha512", "whirlpool",
|
||||
"aes-128 ige", "aes-192 ige", "aes-256 ige", "ghash",
|
||||
"rand", "hmac"
|
||||
"rand", "hmac", "cmac"
|
||||
};
|
||||
#define ALGOR_NUM OSSL_NELEM(names)
|
||||
|
||||
@@ -421,9 +430,11 @@ static const OPT_PAIR doit_choices[] = {
|
||||
{"aes-128-cbc", D_CBC_128_AES},
|
||||
{"aes-192-cbc", D_CBC_192_AES},
|
||||
{"aes-256-cbc", D_CBC_256_AES},
|
||||
#if !OPENSSL_API_3
|
||||
{"aes-128-ige", D_IGE_128_AES},
|
||||
{"aes-192-ige", D_IGE_192_AES},
|
||||
{"aes-256-ige", D_IGE_256_AES},
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC2
|
||||
{"rc2-cbc", D_CBC_RC2},
|
||||
{"rc2", D_CBC_RC2},
|
||||
@@ -629,6 +640,9 @@ typedef struct loopargs_st {
|
||||
#endif
|
||||
EVP_CIPHER_CTX *ctx;
|
||||
HMAC_CTX *hctx;
|
||||
#ifndef OPENSSL_NO_CMAC
|
||||
CMAC_CTX *cmac_ctx;
|
||||
#endif
|
||||
GCM128_CONTEXT *gcm_ctx;
|
||||
} loopargs_t;
|
||||
static int run_benchmark(int async_jobs, int (*loop_function) (void *),
|
||||
@@ -859,6 +873,7 @@ static int AES_cbc_256_encrypt_loop(void *args)
|
||||
return count;
|
||||
}
|
||||
|
||||
#if !OPENSSL_API_3
|
||||
static int AES_ige_128_encrypt_loop(void *args)
|
||||
{
|
||||
loopargs_t *tempargs = *(loopargs_t **) args;
|
||||
@@ -894,6 +909,7 @@ static int AES_ige_256_encrypt_loop(void *args)
|
||||
(size_t)lengths[testnum], &aes_ks3, iv, AES_ENCRYPT);
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int CRYPTO_gcm128_aad_loop(void *args)
|
||||
{
|
||||
@@ -1064,6 +1080,33 @@ static int EVP_HMAC_loop(void *args)
|
||||
return count;
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_CMAC
|
||||
static const EVP_CIPHER *evp_cmac_cipher = NULL;
|
||||
static char *evp_cmac_name = NULL;
|
||||
|
||||
static int EVP_CMAC_loop(void *args)
|
||||
{
|
||||
loopargs_t *tempargs = *(loopargs_t **) args;
|
||||
unsigned char *buf = tempargs->buf;
|
||||
CMAC_CTX *cmac_ctx = tempargs->cmac_ctx;
|
||||
static const char key[16] = "This is a key...";
|
||||
unsigned char mac[16];
|
||||
size_t len = sizeof(mac);
|
||||
int count;
|
||||
#ifndef SIGALRM
|
||||
int nb_iter = save_count * 4 * lengths[0] / lengths[testnum];
|
||||
#endif
|
||||
|
||||
for (count = 0; COND(nb_iter); count++) {
|
||||
if (!CMAC_Init(cmac_ctx, key, sizeof(key), evp_cmac_cipher, NULL)
|
||||
|| !CMAC_Update(cmac_ctx, buf, lengths[testnum])
|
||||
|| !CMAC_Final(cmac_ctx, mac, &len))
|
||||
return -1;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
static long rsa_c[RSA_NUM][2]; /* # RSA iteration test */
|
||||
|
||||
@@ -1610,6 +1653,17 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
doit[D_EVP_HMAC] = 1;
|
||||
break;
|
||||
case OPT_CMAC:
|
||||
#ifndef OPENSSL_NO_CMAC
|
||||
evp_cmac_cipher = EVP_get_cipherbyname(opt_arg());
|
||||
if (evp_cmac_cipher == NULL) {
|
||||
BIO_printf(bio_err, "%s: %s is an unknown cipher\n",
|
||||
prog, opt_arg());
|
||||
goto end;
|
||||
}
|
||||
doit[D_EVP_CMAC] = 1;
|
||||
#endif
|
||||
break;
|
||||
case OPT_DECRYPT:
|
||||
decrypt = 1;
|
||||
break;
|
||||
@@ -1848,9 +1902,9 @@ int speed_main(int argc, char **argv)
|
||||
e = setup_engine(engine_id, 0);
|
||||
|
||||
/* No parameters; turn on everything. */
|
||||
if (argc == 0 && !doit[D_EVP] && !doit[D_EVP_HMAC]) {
|
||||
if (argc == 0 && !doit[D_EVP] && !doit[D_EVP_HMAC] && !doit[D_EVP_CMAC]) {
|
||||
for (i = 0; i < ALGOR_NUM; i++)
|
||||
if (i != D_EVP && i != D_EVP_HMAC)
|
||||
if (i != D_EVP && i != D_EVP_HMAC && i != D_EVP_CMAC)
|
||||
doit[i] = 1;
|
||||
#ifndef OPENSSL_NO_RSA
|
||||
for (i = 0; i < RSA_NUM; i++)
|
||||
@@ -2381,6 +2435,7 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
#if !OPENSSL_API_3
|
||||
if (doit[D_IGE_128_AES]) {
|
||||
for (testnum = 0; testnum < size_num; testnum++) {
|
||||
print_message(names[D_IGE_128_AES], c[D_IGE_128_AES][testnum],
|
||||
@@ -2414,6 +2469,7 @@ int speed_main(int argc, char **argv)
|
||||
print_result(D_IGE_256_AES, testnum, count, d);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (doit[D_GHASH]) {
|
||||
for (i = 0; i < loopargs_len; i++) {
|
||||
loopargs[i].gcm_ctx =
|
||||
@@ -2719,6 +2775,36 @@ int speed_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_CMAC
|
||||
if (doit[D_EVP_CMAC]) {
|
||||
if (evp_cmac_cipher != NULL) {
|
||||
const char *cipher_name = OBJ_nid2ln(EVP_CIPHER_type(evp_cmac_cipher));
|
||||
evp_cmac_name = app_malloc(sizeof("CMAC()") + strlen(cipher_name),
|
||||
"CMAC name");
|
||||
sprintf(evp_cmac_name, "CMAC(%s)", cipher_name);
|
||||
names[D_EVP_CMAC] = evp_cmac_name;
|
||||
|
||||
for (i = 0; i < loopargs_len; i++) {
|
||||
loopargs[i].cmac_ctx = CMAC_CTX_new();
|
||||
if (loopargs[i].cmac_ctx == NULL) {
|
||||
BIO_printf(bio_err, "CMAC malloc failure, exiting...");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
for (testnum = 0; testnum < size_num; testnum++) {
|
||||
print_message(names[D_EVP_CMAC], save_count, lengths[testnum],
|
||||
seconds.sym);
|
||||
Time_F(START);
|
||||
count = run_benchmark(async_jobs, EVP_CMAC_loop, loopargs);
|
||||
d = Time_F(STOP);
|
||||
print_result(D_EVP_CMAC, testnum, count, d);
|
||||
}
|
||||
for (i = 0; i < loopargs_len; i++)
|
||||
CMAC_CTX_free(loopargs[i].cmac_ctx);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; i < loopargs_len; i++)
|
||||
if (RAND_bytes(loopargs[i].buf, 36) <= 0)
|
||||
goto end;
|
||||
@@ -3418,6 +3504,9 @@ int speed_main(int argc, char **argv)
|
||||
#endif
|
||||
}
|
||||
OPENSSL_free(evp_hmac_name);
|
||||
#ifndef OPENSSL_NO_CMAC
|
||||
OPENSSL_free(evp_cmac_name);
|
||||
#endif
|
||||
|
||||
if (async_jobs > 0) {
|
||||
for (i = 0; i < loopargs_len; i++)
|
||||
|
||||
+24
-12
@@ -246,18 +246,27 @@ static int check(X509_STORE *ctx, const char *file,
|
||||
|
||||
if (sm2id != NULL) {
|
||||
#ifndef OPENSSL_NO_SM2
|
||||
ASN1_OCTET_STRING v;
|
||||
ASN1_OCTET_STRING *v;
|
||||
|
||||
v.data = sm2id;
|
||||
v.length = sm2idlen;
|
||||
v = ASN1_OCTET_STRING_new();
|
||||
if (v == NULL) {
|
||||
BIO_printf(bio_err, "error: SM2 ID allocation failed\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
X509_set_sm2_id(x, &v);
|
||||
if (!ASN1_OCTET_STRING_set(v, sm2id, sm2idlen)) {
|
||||
BIO_printf(bio_err, "error: setting SM2 ID failed\n");
|
||||
ASN1_OCTET_STRING_free(v);
|
||||
goto end;
|
||||
}
|
||||
|
||||
X509_set0_sm2_id(x, v);
|
||||
#endif
|
||||
}
|
||||
|
||||
csc = X509_STORE_CTX_new();
|
||||
if (csc == NULL) {
|
||||
printf("error %s: X.509 store context allocation failed\n",
|
||||
BIO_printf(bio_err, "error %s: X.509 store context allocation failed\n",
|
||||
(file == NULL) ? "stdin" : file);
|
||||
goto end;
|
||||
}
|
||||
@@ -265,7 +274,8 @@ static int check(X509_STORE *ctx, const char *file,
|
||||
X509_STORE_set_flags(ctx, vflags);
|
||||
if (!X509_STORE_CTX_init(csc, ctx, x, uchain)) {
|
||||
X509_STORE_CTX_free(csc);
|
||||
printf("error %s: X.509 store context initialization failed\n",
|
||||
BIO_printf(bio_err,
|
||||
"error %s: X.509 store context initialization failed\n",
|
||||
(file == NULL) ? "stdin" : file);
|
||||
goto end;
|
||||
}
|
||||
@@ -275,28 +285,30 @@ static int check(X509_STORE *ctx, const char *file,
|
||||
X509_STORE_CTX_set0_crls(csc, crls);
|
||||
i = X509_verify_cert(csc);
|
||||
if (i > 0 && X509_STORE_CTX_get_error(csc) == X509_V_OK) {
|
||||
printf("%s: OK\n", (file == NULL) ? "stdin" : file);
|
||||
BIO_printf(bio_out, "%s: OK\n", (file == NULL) ? "stdin" : file);
|
||||
ret = 1;
|
||||
if (show_chain) {
|
||||
int j;
|
||||
|
||||
chain = X509_STORE_CTX_get1_chain(csc);
|
||||
num_untrusted = X509_STORE_CTX_get_num_untrusted(csc);
|
||||
printf("Chain:\n");
|
||||
BIO_printf(bio_out, "Chain:\n");
|
||||
for (j = 0; j < sk_X509_num(chain); j++) {
|
||||
X509 *cert = sk_X509_value(chain, j);
|
||||
printf("depth=%d: ", j);
|
||||
BIO_printf(bio_out, "depth=%d: ", j);
|
||||
X509_NAME_print_ex_fp(stdout,
|
||||
X509_get_subject_name(cert),
|
||||
0, get_nameopt());
|
||||
if (j < num_untrusted)
|
||||
printf(" (untrusted)");
|
||||
printf("\n");
|
||||
BIO_printf(bio_out, " (untrusted)");
|
||||
BIO_printf(bio_out, "\n");
|
||||
}
|
||||
sk_X509_pop_free(chain, X509_free);
|
||||
}
|
||||
} else {
|
||||
printf("error %s: verification failed\n", (file == NULL) ? "stdin" : file);
|
||||
BIO_printf(bio_err,
|
||||
"error %s: verification failed\n",
|
||||
(file == NULL) ? "stdin" : file);
|
||||
}
|
||||
X509_STORE_CTX_free(csc);
|
||||
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
|
||||
#include "internal/cryptlib.h"
|
||||
|
||||
#if OPENSSL_API_3
|
||||
NON_EMPTY_TRANSLATION_UNIT
|
||||
#else
|
||||
|
||||
#include <openssl/aes.h>
|
||||
#include "aes_locl.h"
|
||||
|
||||
@@ -34,6 +38,7 @@ typedef struct {
|
||||
|
||||
/* N.B. The IV for this mode is _twice_ the block size */
|
||||
|
||||
/* Use of this function is deprecated. */
|
||||
void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, const int enc)
|
||||
@@ -162,6 +167,14 @@ void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
|
||||
/*
|
||||
* Note that its effectively impossible to do biIGE in anything other
|
||||
* than a single pass, so no provision is made for chaining.
|
||||
*
|
||||
* NB: The implementation of AES_bi_ige_encrypt has a bug. It is supposed to use
|
||||
* 2 AES keys, but in fact only one is ever used. This bug has been present
|
||||
* since this code was first implemented. It is believed to have minimal
|
||||
* security impact in practice and has therefore not been fixed for backwards
|
||||
* compatibility reasons.
|
||||
*
|
||||
* Use of this function is deprecated.
|
||||
*/
|
||||
|
||||
/* N.B. The IV for this mode is _four times_ the block size */
|
||||
@@ -282,3 +295,4 @@ void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -683,6 +683,12 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type,
|
||||
hints.ai_family = family;
|
||||
hints.ai_socktype = socktype;
|
||||
hints.ai_protocol = protocol;
|
||||
#ifdef AI_ADDRCONFIG
|
||||
#ifdef AF_UNSPEC
|
||||
if (family == AF_UNSPEC)
|
||||
#endif
|
||||
hints.ai_flags |= AI_ADDRCONFIG;
|
||||
#endif
|
||||
|
||||
if (lookup_type == BIO_LOOKUP_SERVER)
|
||||
hints.ai_flags |= AI_PASSIVE;
|
||||
|
||||
+12
-5
@@ -108,6 +108,11 @@ static int sock_read(BIO *b, char *out, int outl)
|
||||
|
||||
if (out != NULL) {
|
||||
clear_socket_error();
|
||||
# ifndef OPENSSL_NO_KTLS
|
||||
if (BIO_get_ktls_recv(b))
|
||||
ret = ktls_read_record(b->num, out, outl);
|
||||
else
|
||||
# endif
|
||||
ret = readsocket(b->num, out, outl);
|
||||
BIO_clear_retry_flags(b);
|
||||
if (ret <= 0) {
|
||||
@@ -177,20 +182,22 @@ static long sock_ctrl(BIO *b, int cmd, long num, void *ptr)
|
||||
ret = 1;
|
||||
break;
|
||||
# ifndef OPENSSL_NO_KTLS
|
||||
case BIO_CTRL_SET_KTLS_SEND:
|
||||
case BIO_CTRL_SET_KTLS:
|
||||
crypto_info = (struct tls12_crypto_info_aes_gcm_128 *)ptr;
|
||||
ret = ktls_start(b->num, crypto_info, sizeof(*crypto_info), num);
|
||||
if (ret)
|
||||
BIO_set_ktls_flag(b);
|
||||
BIO_set_ktls_flag(b, num);
|
||||
break;
|
||||
case BIO_CTRL_GET_KTLS_SEND:
|
||||
return BIO_should_ktls_flag(b);
|
||||
case BIO_CTRL_SET_KTLS_SEND_CTRL_MSG:
|
||||
return BIO_should_ktls_flag(b, 1);
|
||||
case BIO_CTRL_GET_KTLS_RECV:
|
||||
return BIO_should_ktls_flag(b, 0);
|
||||
case BIO_CTRL_SET_KTLS_TX_SEND_CTRL_MSG:
|
||||
BIO_set_ktls_ctrl_msg_flag(b);
|
||||
b->ptr = (void *)num;
|
||||
ret = 0;
|
||||
break;
|
||||
case BIO_CTRL_CLEAR_KTLS_CTRL_MSG:
|
||||
case BIO_CTRL_CLEAR_KTLS_TX_CTRL_MSG:
|
||||
BIO_clear_ktls_ctrl_msg_flag(b);
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
+7
-1
@@ -9,7 +9,8 @@ SUBDIRS=objects buffer bio stack lhash rand evp asn1 pem x509 x509v3 conf \
|
||||
|
||||
LIBS=../libcrypto
|
||||
# The Core
|
||||
SOURCE[../libcrypto]=provider_core.c provider_predefined.c core_fetch.c
|
||||
SOURCE[../libcrypto]=provider_core.c provider_predefined.c provider_conf.c \
|
||||
core_fetch.c
|
||||
|
||||
# Central utilities
|
||||
SOURCE[../libcrypto]=\
|
||||
@@ -20,6 +21,11 @@ SOURCE[../libcrypto]=\
|
||||
trace.c provider.c params.c \
|
||||
{- $target{cpuid_asm_src} -} {- $target{uplink_aux_src} -}
|
||||
|
||||
# FIPS module
|
||||
SOURCE[../providers/fips]=\
|
||||
cryptlib.c mem.c mem_clr.c params.c
|
||||
|
||||
|
||||
DEPEND[cversion.o]=buildinf.h
|
||||
GENERATE[buildinf.h]=../util/mkbuildinf.pl "$(CC) $(LIB_CFLAGS) $(CPPFLAGS_Q)" "$(PLATFORM)"
|
||||
DEPEND[buildinf.h]=../configdata.pm
|
||||
|
||||
@@ -356,7 +356,9 @@ OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void)
|
||||
{
|
||||
OPENSSL_INIT_SETTINGS *ret = malloc(sizeof(*ret));
|
||||
|
||||
if (ret != NULL)
|
||||
if (ret == NULL)
|
||||
return NULL;
|
||||
|
||||
memset(ret, 0, sizeof(*ret));
|
||||
ret->flags = DEFAULT_CONF_MFLAGS;
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/engine.h>
|
||||
#include "internal/provider.h"
|
||||
#include "conf_lcl.h"
|
||||
|
||||
/* Load all OpenSSL builtin modules */
|
||||
@@ -28,4 +29,5 @@ void OPENSSL_load_builtin_modules(void)
|
||||
#endif
|
||||
EVP_add_alg_module();
|
||||
conf_add_ssl_module();
|
||||
ossl_provider_add_conf_module();
|
||||
}
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "internal/conf.h"
|
||||
#include "internal/dso.h"
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/trace.h>
|
||||
|
||||
#define DSO_mod_init_name "OPENSSL_init"
|
||||
#define DSO_mod_finish_name "OPENSSL_finish"
|
||||
@@ -92,6 +93,7 @@ int CONF_modules_load(const CONF *cnf, const char *appname,
|
||||
return 1;
|
||||
}
|
||||
|
||||
OSSL_TRACE1(CONF, "Configuration in section %s\n", vsection);
|
||||
values = NCONF_get_section(cnf, vsection);
|
||||
|
||||
if (!values)
|
||||
@@ -100,6 +102,8 @@ int CONF_modules_load(const CONF *cnf, const char *appname,
|
||||
for (i = 0; i < sk_CONF_VALUE_num(values); i++) {
|
||||
vl = sk_CONF_VALUE_value(values, i);
|
||||
ret = module_run(cnf, vl->name, vl->value, flags);
|
||||
OSSL_TRACE3(CONF, "Running module %s (%s) returned %d\n",
|
||||
vl->name, vl->value, ret);
|
||||
if (ret <= 0)
|
||||
if (!(flags & CONF_MFLAGS_IGNORE_ERRORS))
|
||||
return ret;
|
||||
|
||||
+2
-1
@@ -35,7 +35,8 @@ static int ossl_method_construct_this(OSSL_PROVIDER *provider, void *cbdata)
|
||||
const OSSL_ALGORITHM *thismap = map++;
|
||||
void *method = NULL;
|
||||
|
||||
if ((method = data->mcm->construct(thismap->implementation, provider,
|
||||
if ((method = data->mcm->construct(thismap->algorithm_name,
|
||||
thismap->implementation, provider,
|
||||
data->mcm_data)) == NULL)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -50,8 +50,12 @@ static const ERR_STRING_DATA CRYPTO_str_functs[] = {
|
||||
"OSSL_PROVIDER_add_builtin"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_OSSL_PROVIDER_ACTIVATE, 0),
|
||||
"ossl_provider_activate"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_OSSL_PROVIDER_ADD_PARAMETER, 0),
|
||||
"ossl_provider_add_parameter"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_OSSL_PROVIDER_NEW, 0),
|
||||
"ossl_provider_new"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_OSSL_PROVIDER_SET_MODULE_PATH, 0),
|
||||
"ossl_provider_set_module_path"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_PKEY_HMAC_INIT, 0), "pkey_hmac_init"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_PKEY_POLY1305_INIT, 0),
|
||||
"pkey_poly1305_init"},
|
||||
@@ -59,6 +63,10 @@ static const ERR_STRING_DATA CRYPTO_str_functs[] = {
|
||||
"pkey_siphash_init"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_PROVIDER_ACTIVATE, 0),
|
||||
"provider_activate"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_PROVIDER_CONF_INIT, 0),
|
||||
"provider_conf_init"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_PROVIDER_CONF_LOAD, 0),
|
||||
"provider_conf_load"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_PROVIDER_NEW, 0), "provider_new"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, CRYPTO_F_PROVIDER_STORE_NEW, 0),
|
||||
"provider_store_new"},
|
||||
@@ -75,6 +83,8 @@ static const ERR_STRING_DATA CRYPTO_str_reasons[] = {
|
||||
"odd number of digits"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_PROVIDER_ALREADY_EXISTS),
|
||||
"provider already exists"},
|
||||
{ERR_PACK(ERR_LIB_CRYPTO, 0, CRYPTO_R_PROVIDER_SECTION_ERROR),
|
||||
"provider section error"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "dso_locl.h"
|
||||
|
||||
#if !defined(DSO_VMS) && !defined(DSO_DLCFN) && !defined(DSO_DL) && !defined(DSO_WIN32) && !defined(DSO_DLFCN)
|
||||
#ifdef DSO_NONE
|
||||
|
||||
static DSO_METHOD dso_meth_null = {
|
||||
"NULL shared library method"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -254,6 +254,7 @@ static void x25519_scalar_mulx(uint8_t out[32], const uint8_t scalar[32],
|
||||
#if defined(X25519_ASM) \
|
||||
|| ( (defined(__SIZEOF_INT128__) && __SIZEOF_INT128__ == 16) \
|
||||
&& !defined(__sparc__) \
|
||||
&& (!defined(__SIZEOF_LONG__) || (__SIZEOF_LONG__ == 8)) \
|
||||
&& !(defined(__ANDROID__) && !defined(__clang__)) )
|
||||
/*
|
||||
* Base 2^51 implementation. It's virtually no different from reference
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2015 Cryptography Research, Inc.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
@@ -24,7 +24,9 @@
|
||||
*/
|
||||
# ifndef C448_WORD_BITS
|
||||
# if (defined(__SIZEOF_INT128__) && (__SIZEOF_INT128__ == 16)) \
|
||||
&& !defined(__sparc__)
|
||||
&& !defined(__sparc__) \
|
||||
&& (!defined(__SIZEOF_LONG__) || (__SIZEOF_LONG__ == 8))
|
||||
|
||||
# define C448_WORD_BITS 64 /* The number of bits in a word */
|
||||
# else
|
||||
# define C448_WORD_BITS 32 /* The number of bits in a word */
|
||||
|
||||
+16
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2002-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -10,6 +10,16 @@
|
||||
#include "ec_lcl.h"
|
||||
#include <openssl/err.h>
|
||||
|
||||
int EC_GROUP_check_named_curve(const EC_GROUP *group, int nist_only)
|
||||
{
|
||||
int nid;
|
||||
|
||||
nid = ec_curve_nid_from_params(group);
|
||||
if (nid > 0 && nist_only && EC_curve_nid2nist(nid) == NULL)
|
||||
nid = NID_undef;
|
||||
return nid;
|
||||
}
|
||||
|
||||
int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx)
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -17,6 +27,11 @@ int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx)
|
||||
BN_CTX *new_ctx = NULL;
|
||||
EC_POINT *point = NULL;
|
||||
|
||||
if (group == NULL || group->meth == NULL) {
|
||||
ECerr(EC_F_EC_GROUP_CHECK, ERR_R_PASSED_NULL_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Custom curves assumed to be correct */
|
||||
if ((group->meth->flags & EC_FLAGS_CUSTOM_CURVE) != 0)
|
||||
return 1;
|
||||
|
||||
+122
-1
@@ -14,6 +14,7 @@
|
||||
#include <openssl/obj_mac.h>
|
||||
#include <openssl/opensslconf.h>
|
||||
#include "internal/nelem.h"
|
||||
#include "internal/o_str.h"
|
||||
|
||||
typedef struct {
|
||||
int field_type, /* either NID_X9_62_prime_field or
|
||||
@@ -1136,6 +1137,7 @@ static const struct {
|
||||
},
|
||||
{
|
||||
/* no seed */
|
||||
/* p */
|
||||
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||
@@ -1209,6 +1211,7 @@ static const struct {
|
||||
},
|
||||
{
|
||||
/* no seed */
|
||||
/* p */
|
||||
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||
@@ -1244,6 +1247,7 @@ static const struct {
|
||||
},
|
||||
{
|
||||
/* no seed */
|
||||
/* p */
|
||||
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xA1,
|
||||
@@ -1278,7 +1282,7 @@ static const struct {
|
||||
NID_X9_62_characteristic_two_field, 20, 36, 2
|
||||
},
|
||||
{
|
||||
/* no seed */
|
||||
/* seed */
|
||||
0x77, 0xE2, 0xB0, 0x73, 0x70, 0xEB, 0x0F, 0x83, 0x2A, 0x6D, 0xD5, 0xB6,
|
||||
0x2D, 0xFC, 0x88, 0xCD, 0x06, 0xBB, 0x84, 0xBE,
|
||||
/* p */
|
||||
@@ -3197,3 +3201,120 @@ int EC_curve_nist2nid(const char *name)
|
||||
}
|
||||
return NID_undef;
|
||||
}
|
||||
|
||||
#define NUM_BN_FIELDS 6
|
||||
/*
|
||||
* Validates EC domain parameter data for known named curves.
|
||||
* This can be used when a curve is loaded explicitly (without a curve
|
||||
* name) or to validate that domain parameters have not been modified.
|
||||
*
|
||||
* Returns: The nid associated with the found named curve, or NID_undef
|
||||
* if not found. If there was an error it returns -1.
|
||||
*/
|
||||
int ec_curve_nid_from_params(const EC_GROUP *group)
|
||||
{
|
||||
int ret = -1, nid, len, field_type, param_len;
|
||||
size_t i, seed_len;
|
||||
const unsigned char *seed, *params_seed, *params;
|
||||
unsigned char *param_bytes = NULL;
|
||||
const EC_CURVE_DATA *data;
|
||||
const EC_POINT *generator = NULL;
|
||||
const EC_METHOD *meth;
|
||||
const BIGNUM *cofactor = NULL;
|
||||
/* An array of BIGNUMs for (p, a, b, x, y, order) */
|
||||
BIGNUM *bn[NUM_BN_FIELDS] = {NULL, NULL, NULL, NULL, NULL, NULL};
|
||||
BN_CTX *ctx = NULL;
|
||||
|
||||
meth = EC_GROUP_method_of(group);
|
||||
if (meth == NULL)
|
||||
return -1;
|
||||
/* Use the optional named curve nid as a search field */
|
||||
nid = EC_GROUP_get_curve_name(group);
|
||||
field_type = EC_METHOD_get_field_type(meth);
|
||||
seed_len = EC_GROUP_get_seed_len(group);
|
||||
seed = EC_GROUP_get0_seed(group);
|
||||
cofactor = EC_GROUP_get0_cofactor(group);
|
||||
|
||||
ctx = BN_CTX_new();
|
||||
if (ctx == NULL)
|
||||
return -1;
|
||||
BN_CTX_start(ctx);
|
||||
|
||||
/*
|
||||
* The built-in curves contains data fields (p, a, b, x, y, order) that are
|
||||
* all zero-padded to be the same size. The size of the padding is
|
||||
* determined by either the number of bytes in the field modulus (p) or the
|
||||
* EC group order, whichever is larger.
|
||||
*/
|
||||
param_len = BN_num_bytes(group->order);
|
||||
len = BN_num_bytes(group->field);
|
||||
if (len > param_len)
|
||||
param_len = len;
|
||||
|
||||
/* Allocate space to store the padded data for (p, a, b, x, y, order) */
|
||||
param_bytes = OPENSSL_malloc(param_len * NUM_BN_FIELDS);
|
||||
if (param_bytes == NULL)
|
||||
goto end;
|
||||
|
||||
/* Create the bignums */
|
||||
for (i = 0; i < NUM_BN_FIELDS; ++i) {
|
||||
if ((bn[i] = BN_CTX_get(ctx)) == NULL)
|
||||
goto end;
|
||||
}
|
||||
/*
|
||||
* Fill in the bn array with the same values as the internal curves
|
||||
* i.e. the values are p, a, b, x, y, order.
|
||||
*/
|
||||
/* Get p, a & b */
|
||||
if (!(EC_GROUP_get_curve(group, bn[0], bn[1], bn[2], ctx)
|
||||
&& ((generator = EC_GROUP_get0_generator(group)) != NULL)
|
||||
/* Get x & y */
|
||||
&& EC_POINT_get_affine_coordinates(group, generator, bn[3], bn[4], ctx)
|
||||
/* Get order */
|
||||
&& EC_GROUP_get_order(group, bn[5], ctx)))
|
||||
goto end;
|
||||
|
||||
/*
|
||||
* Convert the bignum array to bytes that are joined together to form
|
||||
* a single buffer that contains data for all fields.
|
||||
* (p, a, b, x, y, order) are all zero padded to be the same size.
|
||||
*/
|
||||
for (i = 0; i < NUM_BN_FIELDS; ++i) {
|
||||
if (BN_bn2binpad(bn[i], ¶m_bytes[i*param_len], param_len) <= 0)
|
||||
goto end;
|
||||
}
|
||||
|
||||
for (i = 0; i < curve_list_length; i++) {
|
||||
const ec_list_element curve = curve_list[i];
|
||||
|
||||
data = curve.data;
|
||||
/* Get the raw order byte data */
|
||||
params_seed = (const unsigned char *)(data + 1); /* skip header */
|
||||
params = params_seed + data->seed_len;
|
||||
|
||||
/* Look for unique fields in the fixed curve data */
|
||||
if (data->field_type == field_type
|
||||
&& param_len == data->param_len
|
||||
&& (nid <= 0 || nid == curve.nid)
|
||||
/* check the optional cofactor (ignore if its zero) */
|
||||
&& (BN_is_zero(cofactor)
|
||||
|| BN_is_word(cofactor, (const BN_ULONG)curve.data->cofactor))
|
||||
/* Check the optional seed (ignore if its not set) */
|
||||
&& (data->seed_len == 0 || seed_len == 0
|
||||
|| ((size_t)data->seed_len == seed_len
|
||||
&& OPENSSL_memcmp(params_seed, seed, seed_len) == 0))
|
||||
/* Check that the groups params match the built-in curve params */
|
||||
&& OPENSSL_memcmp(param_bytes, params, param_len * NUM_BN_FIELDS)
|
||||
== 0) {
|
||||
ret = curve.nid;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
/* Gets here if the group was not found */
|
||||
ret = NID_undef;
|
||||
end:
|
||||
OPENSSL_free(param_bytes);
|
||||
BN_CTX_end(ctx);
|
||||
BN_CTX_free(ctx);
|
||||
return ret;
|
||||
}
|
||||
+122
-26
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2002-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
@@ -195,59 +195,90 @@ int ossl_ec_key_gen(EC_KEY *eckey)
|
||||
return eckey->group->meth->keygen(eckey);
|
||||
}
|
||||
|
||||
/*
|
||||
* ECC Key generation.
|
||||
* See SP800-56AR3 5.6.1.2.2 "Key Pair Generation by Testing Candidates"
|
||||
*
|
||||
* Params:
|
||||
* eckey An EC key object that contains domain params. The generated keypair
|
||||
* is stored in this object.
|
||||
* Returns 1 if the keypair was generated or 0 otherwise.
|
||||
*/
|
||||
int ec_key_simple_generate_key(EC_KEY *eckey)
|
||||
{
|
||||
int ok = 0;
|
||||
BN_CTX *ctx = NULL;
|
||||
BIGNUM *priv_key = NULL;
|
||||
const BIGNUM *order = NULL;
|
||||
EC_POINT *pub_key = NULL;
|
||||
|
||||
if ((ctx = BN_CTX_new()) == NULL)
|
||||
goto err;
|
||||
const EC_GROUP *group = eckey->group;
|
||||
|
||||
if (eckey->priv_key == NULL) {
|
||||
priv_key = BN_new();
|
||||
priv_key = BN_secure_new();
|
||||
if (priv_key == NULL)
|
||||
goto err;
|
||||
} else
|
||||
priv_key = eckey->priv_key;
|
||||
|
||||
order = EC_GROUP_get0_order(eckey->group);
|
||||
/*
|
||||
* Steps (1-2): Check domain parameters and security strength.
|
||||
* These steps must be done by the user. This would need to be
|
||||
* stated in the security policy.
|
||||
*/
|
||||
|
||||
order = EC_GROUP_get0_order(group);
|
||||
if (order == NULL)
|
||||
goto err;
|
||||
|
||||
/*
|
||||
* Steps (3-7): priv_key = DRBG_RAND(order_n_bits) (range [1, n-1]).
|
||||
* Although this is slightly different from the standard, it is effectively
|
||||
* equivalent as it gives an unbiased result ranging from 1..n-1. It is also
|
||||
* faster as the standard needs to retry more often. Also doing
|
||||
* 1 + rand[0..n-2] would effect the way that tests feed dummy entropy into
|
||||
* rand so the simpler backward compatible method has been used here.
|
||||
*/
|
||||
do
|
||||
if (!BN_priv_rand_range(priv_key, order))
|
||||
goto err;
|
||||
while (BN_is_zero(priv_key)) ;
|
||||
|
||||
if (eckey->pub_key == NULL) {
|
||||
pub_key = EC_POINT_new(eckey->group);
|
||||
pub_key = EC_POINT_new(group);
|
||||
if (pub_key == NULL)
|
||||
goto err;
|
||||
} else
|
||||
pub_key = eckey->pub_key;
|
||||
|
||||
if (!EC_POINT_mul(eckey->group, pub_key, priv_key, NULL, NULL, ctx))
|
||||
/* Step (8) : pub_key = priv_key * G (where G is a point on the curve) */
|
||||
if (!EC_POINT_mul(group, pub_key, priv_key, NULL, NULL, NULL))
|
||||
goto err;
|
||||
|
||||
eckey->priv_key = priv_key;
|
||||
eckey->pub_key = pub_key;
|
||||
priv_key = NULL;
|
||||
pub_key = NULL;
|
||||
|
||||
ok = 1;
|
||||
|
||||
err:
|
||||
if (eckey->pub_key == NULL)
|
||||
err:
|
||||
/* Step (9): If there is an error return an invalid keypair. */
|
||||
if (!ok) {
|
||||
BN_clear(eckey->priv_key);
|
||||
if (eckey->pub_key != NULL)
|
||||
EC_POINT_set_to_infinity(group, eckey->pub_key);
|
||||
}
|
||||
|
||||
EC_POINT_free(pub_key);
|
||||
if (eckey->priv_key != priv_key)
|
||||
BN_free(priv_key);
|
||||
BN_CTX_free(ctx);
|
||||
BN_clear_free(priv_key);
|
||||
return ok;
|
||||
}
|
||||
|
||||
int ec_key_simple_generate_public_key(EC_KEY *eckey)
|
||||
{
|
||||
/*
|
||||
* See SP800-56AR3 5.6.1.2.2: Step (8)
|
||||
* pub_key = priv_key * G (where G is a point on the curve)
|
||||
*/
|
||||
return EC_POINT_mul(eckey->group, eckey->pub_key, eckey->priv_key, NULL,
|
||||
NULL, NULL);
|
||||
}
|
||||
@@ -267,6 +298,58 @@ int EC_KEY_check_key(const EC_KEY *eckey)
|
||||
return eckey->group->meth->keycheck(eckey);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the range of the EC public key.
|
||||
* See SP800-56A R3 Section 5.6.2.3.3 (Part 2)
|
||||
* i.e.
|
||||
* - If q = odd prime p: Verify that xQ and yQ are integers in the
|
||||
* interval[0, p − 1], OR
|
||||
* - If q = 2m: Verify that xQ and yQ are bit strings of length m bits.
|
||||
* Returns 1 if the public key has a valid range, otherwise it returns 0.
|
||||
*/
|
||||
static int ec_key_public_range_check(BN_CTX *ctx, const EC_KEY *key)
|
||||
{
|
||||
int ret = 0;
|
||||
BIGNUM *x, *y;
|
||||
|
||||
BN_CTX_start(ctx);
|
||||
x = BN_CTX_get(ctx);
|
||||
y = BN_CTX_get(ctx);
|
||||
if (y == NULL)
|
||||
goto err;
|
||||
|
||||
if (!EC_POINT_get_affine_coordinates(key->group, key->pub_key, x, y, ctx))
|
||||
goto err;
|
||||
|
||||
if (EC_METHOD_get_field_type(key->group->meth) == NID_X9_62_prime_field) {
|
||||
if (BN_is_negative(x)
|
||||
|| BN_cmp(x, key->group->field) >= 0
|
||||
|| BN_is_negative(y)
|
||||
|| BN_cmp(y, key->group->field) >= 0) {
|
||||
goto err;
|
||||
}
|
||||
} else {
|
||||
int m = EC_GROUP_get_degree(key->group);
|
||||
if (BN_num_bits(x) > m || BN_num_bits(y) > m) {
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
ret = 1;
|
||||
err:
|
||||
BN_CTX_end(ctx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* ECC Key validation as specified in SP800-56A R3.
|
||||
* Section 5.6.2.3.3 ECC Full Public-Key Validation
|
||||
* Section 5.6.2.1.2 Owner Assurance of Private-Key Validity
|
||||
* Section 5.6.2.1.4 Owner Assurance of Pair-wise Consistency
|
||||
* NOTES:
|
||||
* Before calling this method in fips mode, there should be an assurance that
|
||||
* an approved elliptic-curve group is used.
|
||||
* Returns 1 if the key is valid, otherwise it returns 0.
|
||||
*/
|
||||
int ec_key_simple_check_key(const EC_KEY *eckey)
|
||||
{
|
||||
int ok = 0;
|
||||
@@ -279,6 +362,7 @@ int ec_key_simple_check_key(const EC_KEY *eckey)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 5.6.2.3.3 (Step 1): Q != infinity */
|
||||
if (EC_POINT_is_at_infinity(eckey->group, eckey->pub_key)) {
|
||||
ECerr(EC_F_EC_KEY_SIMPLE_CHECK_KEY, EC_R_POINT_AT_INFINITY);
|
||||
goto err;
|
||||
@@ -286,20 +370,28 @@ int ec_key_simple_check_key(const EC_KEY *eckey)
|
||||
|
||||
if ((ctx = BN_CTX_new()) == NULL)
|
||||
goto err;
|
||||
|
||||
if ((point = EC_POINT_new(eckey->group)) == NULL)
|
||||
goto err;
|
||||
|
||||
/* testing whether the pub_key is on the elliptic curve */
|
||||
/* 5.6.2.3.3 (Step 2) Test if the public key is in range */
|
||||
if (!ec_key_public_range_check(ctx, eckey)) {
|
||||
ECerr(EC_F_EC_KEY_SIMPLE_CHECK_KEY, EC_R_COORDINATES_OUT_OF_RANGE);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* 5.6.2.3.3 (Step 3) is the pub_key on the elliptic curve */
|
||||
if (EC_POINT_is_on_curve(eckey->group, eckey->pub_key, ctx) <= 0) {
|
||||
ECerr(EC_F_EC_KEY_SIMPLE_CHECK_KEY, EC_R_POINT_IS_NOT_ON_CURVE);
|
||||
goto err;
|
||||
}
|
||||
/* testing whether pub_key * order is the point at infinity */
|
||||
|
||||
order = eckey->group->order;
|
||||
if (BN_is_zero(order)) {
|
||||
ECerr(EC_F_EC_KEY_SIMPLE_CHECK_KEY, EC_R_INVALID_GROUP_ORDER);
|
||||
goto err;
|
||||
}
|
||||
/* 5.6.2.3.3 (Step 4) : pub_key * order is the point at infinity. */
|
||||
if (!EC_POINT_mul(eckey->group, point, NULL, eckey->pub_key, order, ctx)) {
|
||||
ECerr(EC_F_EC_KEY_SIMPLE_CHECK_KEY, ERR_R_EC_LIB);
|
||||
goto err;
|
||||
@@ -308,15 +400,21 @@ int ec_key_simple_check_key(const EC_KEY *eckey)
|
||||
ECerr(EC_F_EC_KEY_SIMPLE_CHECK_KEY, EC_R_WRONG_ORDER);
|
||||
goto err;
|
||||
}
|
||||
/*
|
||||
* in case the priv_key is present : check if generator * priv_key ==
|
||||
* pub_key
|
||||
*/
|
||||
|
||||
if (eckey->priv_key != NULL) {
|
||||
if (BN_cmp(eckey->priv_key, order) >= 0) {
|
||||
/*
|
||||
* 5.6.2.1.2 Owner Assurance of Private-Key Validity
|
||||
* The private key is in the range [1, order-1]
|
||||
*/
|
||||
if (BN_cmp(eckey->priv_key, BN_value_one()) < 0
|
||||
|| BN_cmp(eckey->priv_key, order) >= 0) {
|
||||
ECerr(EC_F_EC_KEY_SIMPLE_CHECK_KEY, EC_R_WRONG_ORDER);
|
||||
goto err;
|
||||
}
|
||||
/*
|
||||
* Section 5.6.2.1.4 Owner Assurance of Pair-wise Consistency (b)
|
||||
* Check if generator * priv_key = pub_key
|
||||
*/
|
||||
if (!EC_POINT_mul(eckey->group, point, eckey->priv_key,
|
||||
NULL, NULL, ctx)) {
|
||||
ECerr(EC_F_EC_KEY_SIMPLE_CHECK_KEY, ERR_R_EC_LIB);
|
||||
@@ -368,12 +466,10 @@ int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x,
|
||||
goto err;
|
||||
|
||||
/*
|
||||
* Check if retrieved coordinates match originals and are less than field
|
||||
* order: if not values are out of range.
|
||||
* Check if retrieved coordinates match originals. The range check is done
|
||||
* inside EC_KEY_check_key().
|
||||
*/
|
||||
if (BN_cmp(x, tx) || BN_cmp(y, ty)
|
||||
|| (BN_cmp(x, key->group->field) >= 0)
|
||||
|| (BN_cmp(y, key->group->field) >= 0)) {
|
||||
if (BN_cmp(x, tx) || BN_cmp(y, ty)) {
|
||||
ECerr(EC_F_EC_KEY_SET_PUBLIC_KEY_AFFINE_COORDINATES,
|
||||
EC_R_COORDINATES_OUT_OF_RANGE);
|
||||
goto err;
|
||||
|
||||
+6
-7
@@ -309,13 +309,10 @@ struct ec_point_st {
|
||||
static ossl_inline int ec_point_is_compat(const EC_POINT *point,
|
||||
const EC_GROUP *group)
|
||||
{
|
||||
if (group->meth != point->meth
|
||||
|| (group->curve_name != 0
|
||||
&& point->curve_name != 0
|
||||
&& group->curve_name != point->curve_name))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
return group->meth == point->meth
|
||||
&& (group->curve_name == 0
|
||||
|| point->curve_name == 0
|
||||
|| group->curve_name == point->curve_name);
|
||||
}
|
||||
|
||||
NISTP224_PRE_COMP *EC_nistp224_pre_comp_dup(NISTP224_PRE_COMP *);
|
||||
@@ -595,6 +592,8 @@ int ec_key_simple_generate_key(EC_KEY *eckey);
|
||||
int ec_key_simple_generate_public_key(EC_KEY *eckey);
|
||||
int ec_key_simple_check_key(const EC_KEY *eckey);
|
||||
|
||||
int ec_curve_nid_from_params(const EC_GROUP *group);
|
||||
|
||||
/* EC_METHOD definitions */
|
||||
|
||||
struct ec_key_method_st {
|
||||
|
||||
+28
-13
@@ -284,15 +284,17 @@ int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator,
|
||||
if (order != NULL) {
|
||||
if (!BN_copy(group->order, order))
|
||||
return 0;
|
||||
} else
|
||||
} else {
|
||||
BN_zero(group->order);
|
||||
}
|
||||
|
||||
/* The cofactor is an optional field, so it should be able to be NULL. */
|
||||
if (cofactor != NULL) {
|
||||
if (!BN_copy(group->cofactor, cofactor))
|
||||
return 0;
|
||||
} else
|
||||
} else {
|
||||
BN_zero(group->cofactor);
|
||||
|
||||
}
|
||||
/*
|
||||
* Some groups have an order with
|
||||
* factors of two, which makes the Montgomery setup fail.
|
||||
@@ -530,30 +532,43 @@ int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx)
|
||||
!b->meth->group_get_curve(b, b1, b2, b3, ctx))
|
||||
r = 1;
|
||||
|
||||
if (r || BN_cmp(a1, b1) || BN_cmp(a2, b2) || BN_cmp(a3, b3))
|
||||
/* return 1 if the curve parameters are different */
|
||||
if (r || BN_cmp(a1, b1) != 0 || BN_cmp(a2, b2) != 0 || BN_cmp(a3, b3) != 0)
|
||||
r = 1;
|
||||
|
||||
/* XXX EC_POINT_cmp() assumes that the methods are equal */
|
||||
/* return 1 if the generators are different */
|
||||
if (r || EC_POINT_cmp(a, EC_GROUP_get0_generator(a),
|
||||
EC_GROUP_get0_generator(b), ctx))
|
||||
EC_GROUP_get0_generator(b), ctx) != 0)
|
||||
r = 1;
|
||||
|
||||
if (!r) {
|
||||
const BIGNUM *ao, *bo, *ac, *bc;
|
||||
/* compare the order and cofactor */
|
||||
/* compare the orders */
|
||||
ao = EC_GROUP_get0_order(a);
|
||||
bo = EC_GROUP_get0_order(b);
|
||||
if (ao == NULL || bo == NULL) {
|
||||
/* return an error if either order is NULL */
|
||||
r = -1;
|
||||
goto end;
|
||||
}
|
||||
if (BN_cmp(ao, bo) != 0) {
|
||||
/* return 1 if orders are different */
|
||||
r = 1;
|
||||
goto end;
|
||||
}
|
||||
/*
|
||||
* It gets here if the curve parameters and generator matched.
|
||||
* Now check the optional cofactors (if both are present).
|
||||
*/
|
||||
ac = EC_GROUP_get0_cofactor(a);
|
||||
bc = EC_GROUP_get0_cofactor(b);
|
||||
if (ao == NULL || bo == NULL) {
|
||||
BN_CTX_end(ctx);
|
||||
BN_CTX_free(ctx_new);
|
||||
return -1;
|
||||
}
|
||||
if (BN_cmp(ao, bo) || BN_cmp(ac, bc))
|
||||
/* Returns 1 (mismatch) if both cofactors are specified and different */
|
||||
if (!BN_is_zero(ac) && !BN_is_zero(bc) && BN_cmp(ac, bc) != 0)
|
||||
r = 1;
|
||||
/* Returns 0 if the parameters matched */
|
||||
}
|
||||
|
||||
end:
|
||||
BN_CTX_end(ctx);
|
||||
BN_CTX_free(ctx_new);
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ static int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in,
|
||||
}
|
||||
}
|
||||
|
||||
k = BN_new(); /* this value is later returned in *kinvp */
|
||||
k = BN_secure_new(); /* this value is later returned in *kinvp */
|
||||
r = BN_new(); /* this value is later returned in *rp */
|
||||
X = BN_new();
|
||||
if (k == NULL || r == NULL || X == NULL) {
|
||||
|
||||
@@ -49,7 +49,7 @@ static int int_engine_configure(const char *name, const char *value, const CONF
|
||||
int soft = 0;
|
||||
|
||||
name = skip_dot(name);
|
||||
OSSL_TRACE1(ENGINE_CONF, "Configuring engine %s\n", name);
|
||||
OSSL_TRACE1(CONF, "Configuring engine %s\n", name);
|
||||
/* Value is a section containing ENGINE commands */
|
||||
ecmds = NCONF_get_section(cnf, value);
|
||||
|
||||
@@ -63,7 +63,7 @@ static int int_engine_configure(const char *name, const char *value, const CONF
|
||||
ecmd = sk_CONF_VALUE_value(ecmds, i);
|
||||
ctrlname = skip_dot(ecmd->name);
|
||||
ctrlvalue = ecmd->value;
|
||||
OSSL_TRACE2(ENGINE_CONF, "ENGINE conf: doing ctrl(%s,%s)\n",
|
||||
OSSL_TRACE2(CONF, "ENGINE: doing ctrl(%s,%s)\n",
|
||||
ctrlname, ctrlvalue);
|
||||
|
||||
/* First handle some special pseudo ctrls */
|
||||
@@ -148,7 +148,7 @@ static int int_engine_module_init(CONF_IMODULE *md, const CONF *cnf)
|
||||
STACK_OF(CONF_VALUE) *elist;
|
||||
CONF_VALUE *cval;
|
||||
int i;
|
||||
OSSL_TRACE2(ENGINE_CONF, "Called engine module: name %s, value %s\n",
|
||||
OSSL_TRACE2(CONF, "Called engine module: name %s, value %s\n",
|
||||
CONF_imodule_get_name(md), CONF_imodule_get_value(md));
|
||||
/* Value is a section containing ENGINEs to configure */
|
||||
elist = NCONF_get_section(cnf, CONF_imodule_get_value(md));
|
||||
|
||||
@@ -392,11 +392,15 @@ CRYPTO_F_OPENSSL_SK_DEEP_COPY:127:OPENSSL_sk_deep_copy
|
||||
CRYPTO_F_OPENSSL_SK_DUP:128:OPENSSL_sk_dup
|
||||
CRYPTO_F_OSSL_PROVIDER_ACTIVATE:130:ossl_provider_activate
|
||||
CRYPTO_F_OSSL_PROVIDER_ADD_BUILTIN:132:OSSL_PROVIDER_add_builtin
|
||||
CRYPTO_F_OSSL_PROVIDER_ADD_PARAMETER:139:ossl_provider_add_parameter
|
||||
CRYPTO_F_OSSL_PROVIDER_NEW:131:ossl_provider_new
|
||||
CRYPTO_F_OSSL_PROVIDER_SET_MODULE_PATH:140:ossl_provider_set_module_path
|
||||
CRYPTO_F_PKEY_HMAC_INIT:123:pkey_hmac_init
|
||||
CRYPTO_F_PKEY_POLY1305_INIT:124:pkey_poly1305_init
|
||||
CRYPTO_F_PKEY_SIPHASH_INIT:125:pkey_siphash_init
|
||||
CRYPTO_F_PROVIDER_ACTIVATE:134:provider_activate
|
||||
CRYPTO_F_PROVIDER_CONF_INIT:137:provider_conf_init
|
||||
CRYPTO_F_PROVIDER_CONF_LOAD:138:provider_conf_load
|
||||
CRYPTO_F_PROVIDER_NEW:135:provider_new
|
||||
CRYPTO_F_PROVIDER_STORE_NEW:136:provider_store_new
|
||||
CRYPTO_F_SK_RESERVE:129:sk_reserve
|
||||
@@ -750,12 +754,16 @@ ESS_F_ESS_SIGNING_CERT_NEW_INIT:102:ESS_SIGNING_CERT_new_init
|
||||
ESS_F_ESS_SIGNING_CERT_V2_ADD:105:ESS_SIGNING_CERT_V2_add
|
||||
ESS_F_ESS_SIGNING_CERT_V2_NEW_INIT:103:ESS_SIGNING_CERT_V2_new_init
|
||||
EVP_F_AESNI_INIT_KEY:165:aesni_init_key
|
||||
EVP_F_AESNI_XTS_INIT_KEY:233:aesni_xts_init_key
|
||||
EVP_F_AES_GCM_CTRL:196:aes_gcm_ctrl
|
||||
EVP_F_AES_GCM_TLS_CIPHER:207:aes_gcm_tls_cipher
|
||||
EVP_F_AES_INIT_KEY:133:aes_init_key
|
||||
EVP_F_AES_OCB_CIPHER:169:aes_ocb_cipher
|
||||
EVP_F_AES_T4_INIT_KEY:178:aes_t4_init_key
|
||||
EVP_F_AES_T4_XTS_INIT_KEY:234:aes_t4_xts_init_key
|
||||
EVP_F_AES_WRAP_CIPHER:170:aes_wrap_cipher
|
||||
EVP_F_AES_XTS_CIPHER:229:aes_xts_cipher
|
||||
EVP_F_AES_XTS_INIT_KEY:235:aes_xts_init_key
|
||||
EVP_F_ALG_MODULE_INIT:177:alg_module_init
|
||||
EVP_F_ARIA_CCM_INIT_KEY:175:aria_ccm_init_key
|
||||
EVP_F_ARIA_GCM_CTRL:197:aria_gcm_ctrl
|
||||
@@ -795,6 +803,7 @@ EVP_F_EVP_MAC_CTRL_STR:210:EVP_MAC_ctrl_str
|
||||
EVP_F_EVP_MAC_CTX_COPY:211:EVP_MAC_CTX_copy
|
||||
EVP_F_EVP_MAC_CTX_NEW:213:EVP_MAC_CTX_new
|
||||
EVP_F_EVP_MAC_INIT:212:EVP_MAC_init
|
||||
EVP_F_EVP_MD_BLOCK_SIZE:232:EVP_MD_block_size
|
||||
EVP_F_EVP_MD_CTX_COPY_EX:110:EVP_MD_CTX_copy_ex
|
||||
EVP_F_EVP_MD_SIZE:162:EVP_MD_size
|
||||
EVP_F_EVP_OPENINIT:102:EVP_OpenInit
|
||||
@@ -849,6 +858,7 @@ EVP_F_EVP_PKEY_VERIFY:142:EVP_PKEY_verify
|
||||
EVP_F_EVP_PKEY_VERIFY_INIT:143:EVP_PKEY_verify_init
|
||||
EVP_F_EVP_PKEY_VERIFY_RECOVER:144:EVP_PKEY_verify_recover
|
||||
EVP_F_EVP_PKEY_VERIFY_RECOVER_INIT:145:EVP_PKEY_verify_recover_init
|
||||
EVP_F_EVP_SET_DEFAULT_PROPERTIES:236:EVP_set_default_properties
|
||||
EVP_F_EVP_SIGNFINAL:107:EVP_SignFinal
|
||||
EVP_F_EVP_VERIFYFINAL:108:EVP_VerifyFinal
|
||||
EVP_F_GMAC_CTRL:215:gmac_ctrl
|
||||
@@ -1093,6 +1103,7 @@ PROP_F_PARSE_OCT:105:parse_oct
|
||||
PROP_F_PARSE_STRING:106:parse_string
|
||||
PROP_F_PARSE_UNQUOTED:107:parse_unquoted
|
||||
RAND_F_DRBG_BYTES:101:drbg_bytes
|
||||
RAND_F_DRBG_CTR_INIT:125:drbg_ctr_init
|
||||
RAND_F_DRBG_GET_ENTROPY:105:drbg_get_entropy
|
||||
RAND_F_DRBG_SETUP:117:drbg_setup
|
||||
RAND_F_GET_ENTROPY:106:get_entropy
|
||||
@@ -2159,6 +2170,7 @@ CRYPTO_R_FIPS_MODE_NOT_SUPPORTED:101:fips mode not supported
|
||||
CRYPTO_R_ILLEGAL_HEX_DIGIT:102:illegal hex digit
|
||||
CRYPTO_R_ODD_NUMBER_OF_DIGITS:103:odd number of digits
|
||||
CRYPTO_R_PROVIDER_ALREADY_EXISTS:104:provider already exists
|
||||
CRYPTO_R_PROVIDER_SECTION_ERROR:105:provider section error
|
||||
CT_R_BASE64_DECODE_ERROR:108:base64 decode error
|
||||
CT_R_INVALID_LOG_ID_LENGTH:100:invalid log id length
|
||||
CT_R_LOG_CONF_INVALID:109:log conf invalid
|
||||
@@ -2413,6 +2425,8 @@ EVP_R_UNSUPPORTED_SALT_TYPE:126:unsupported salt type
|
||||
EVP_R_UPDATE_ERROR:189:update error
|
||||
EVP_R_WRAP_MODE_NOT_ALLOWED:170:wrap mode not allowed
|
||||
EVP_R_WRONG_FINAL_BLOCK_LENGTH:109:wrong final block length
|
||||
EVP_R_XTS_DATA_UNIT_IS_TOO_LARGE:191:xts data unit is too large
|
||||
EVP_R_XTS_DUPLICATED_KEYS:192:xts duplicated keys
|
||||
KDF_R_INVALID_DIGEST:100:invalid digest
|
||||
KDF_R_INVALID_MAC_TYPE:116:invalid mac type
|
||||
KDF_R_MISSING_ITERATION_COUNT:109:missing iteration count
|
||||
@@ -2594,6 +2608,8 @@ RAND_R_ADDITIONAL_INPUT_TOO_LONG:102:additional input too long
|
||||
RAND_R_ALREADY_INSTANTIATED:103:already instantiated
|
||||
RAND_R_ARGUMENT_OUT_OF_RANGE:105:argument out of range
|
||||
RAND_R_CANNOT_OPEN_FILE:121:Cannot open file
|
||||
RAND_R_DERIVATION_FUNCTION_MANDATORY_FOR_FIPS:137:\
|
||||
derivation function mandatory for fips
|
||||
RAND_R_DRBG_ALREADY_INITIALIZED:129:drbg already initialized
|
||||
RAND_R_DRBG_NOT_INITIALISED:104:drbg not initialised
|
||||
RAND_R_ENTROPY_INPUT_TOO_LONG:106:entropy input too long
|
||||
|
||||
+18
-1
@@ -83,6 +83,7 @@ void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
|
||||
EVP_MD_meth_free(ctx->fetched_digest);
|
||||
ctx->fetched_digest = NULL;
|
||||
ctx->digest = NULL;
|
||||
ctx->reqdigest = NULL;
|
||||
|
||||
OPENSSL_free(ctx);
|
||||
return;
|
||||
@@ -106,6 +107,9 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
|
||||
|
||||
EVP_MD_CTX_clear_flags(ctx, EVP_MD_CTX_FLAG_CLEANED);
|
||||
|
||||
if (type != NULL)
|
||||
ctx->reqdigest = type;
|
||||
|
||||
/* TODO(3.0): Legacy work around code below. Remove this */
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
/*
|
||||
@@ -141,6 +145,7 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)
|
||||
if (type->prov == NULL) {
|
||||
switch(type->type) {
|
||||
case NID_sha256:
|
||||
case NID_md2:
|
||||
break;
|
||||
default:
|
||||
goto legacy;
|
||||
@@ -545,6 +550,11 @@ static void *evp_md_from_dispatch(int mdtype, const OSSL_DISPATCH *fns,
|
||||
break;
|
||||
md->size = OSSL_get_OP_digest_size(fns);
|
||||
break;
|
||||
case OSSL_FUNC_DIGEST_BLOCK_SIZE:
|
||||
if (md->dblock_size != NULL)
|
||||
break;
|
||||
md->dblock_size = OSSL_get_OP_digest_block_size(fns);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((fncnt != 0 && fncnt != 5)
|
||||
@@ -576,10 +586,17 @@ static void evp_md_free(void *md)
|
||||
EVP_MD_meth_free(md);
|
||||
}
|
||||
|
||||
static int evp_md_nid(void *vmd)
|
||||
{
|
||||
EVP_MD *md = vmd;
|
||||
|
||||
return md->type;
|
||||
}
|
||||
|
||||
EVP_MD *EVP_MD_fetch(OPENSSL_CTX *ctx, const char *algorithm,
|
||||
const char *properties)
|
||||
{
|
||||
return evp_generic_fetch(ctx, OSSL_OP_DIGEST, algorithm, properties,
|
||||
evp_md_from_dispatch, evp_md_upref,
|
||||
evp_md_free);
|
||||
evp_md_free, evp_md_nid);
|
||||
}
|
||||
+79
-52
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2001-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -390,22 +390,33 @@ static int aesni_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
return 1;
|
||||
|
||||
if (key) {
|
||||
/* The key is two half length keys in reality */
|
||||
const int bytes = EVP_CIPHER_CTX_key_length(ctx) / 2;
|
||||
const int bits = bytes * 8;
|
||||
|
||||
/*
|
||||
* Verify that the two keys are different.
|
||||
*
|
||||
* This addresses Rogaway's vulnerability.
|
||||
* See comment in aes_xts_init_key() below.
|
||||
*/
|
||||
if (memcmp(key, key + bytes, bytes) == 0) {
|
||||
EVPerr(EVP_F_AESNI_XTS_INIT_KEY, EVP_R_XTS_DUPLICATED_KEYS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* key_len is two AES keys */
|
||||
if (enc) {
|
||||
aesni_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 4,
|
||||
&xctx->ks1.ks);
|
||||
aesni_set_encrypt_key(key, bits, &xctx->ks1.ks);
|
||||
xctx->xts.block1 = (block128_f) aesni_encrypt;
|
||||
xctx->stream = aesni_xts_encrypt;
|
||||
} else {
|
||||
aesni_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 4,
|
||||
&xctx->ks1.ks);
|
||||
aesni_set_decrypt_key(key, bits, &xctx->ks1.ks);
|
||||
xctx->xts.block1 = (block128_f) aesni_decrypt;
|
||||
xctx->stream = aesni_xts_decrypt;
|
||||
}
|
||||
|
||||
aesni_set_encrypt_key(key + EVP_CIPHER_CTX_key_length(ctx) / 2,
|
||||
EVP_CIPHER_CTX_key_length(ctx) * 4,
|
||||
&xctx->ks2.ks);
|
||||
aesni_set_encrypt_key(key + bytes, bits, &xctx->ks2.ks);
|
||||
xctx->xts.block2 = (block128_f) aesni_encrypt;
|
||||
|
||||
xctx->xts.key1 = &xctx->ks1;
|
||||
@@ -796,7 +807,21 @@ static int aes_t4_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
return 1;
|
||||
|
||||
if (key) {
|
||||
int bits = EVP_CIPHER_CTX_key_length(ctx) * 4;
|
||||
/* The key is two half length keys in reality */
|
||||
const int bytes = EVP_CIPHER_CTX_key_length(ctx) / 2;
|
||||
const int bits = bytes * 8;
|
||||
|
||||
/*
|
||||
* Verify that the two keys are different.
|
||||
*
|
||||
* This addresses Rogaway's vulnerability.
|
||||
* See comment in aes_xts_init_key() below.
|
||||
*/
|
||||
if (memcmp(key, key + bytes, bytes) == 0) {
|
||||
EVPerr(EVP_F_AES_T4_XTS_INIT_KEY, EVP_R_XTS_DUPLICATED_KEYS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
xctx->stream = NULL;
|
||||
/* key_len is two AES keys */
|
||||
if (enc) {
|
||||
@@ -813,8 +838,7 @@ static int aes_t4_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
aes_t4_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 4,
|
||||
&xctx->ks1.ks);
|
||||
aes_t4_set_decrypt_key(key, bits, &xctx->ks1.ks);
|
||||
xctx->xts.block1 = (block128_f) aes_t4_decrypt;
|
||||
switch (bits) {
|
||||
case 128:
|
||||
@@ -828,9 +852,7 @@ static int aes_t4_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
}
|
||||
}
|
||||
|
||||
aes_t4_set_encrypt_key(key + EVP_CIPHER_CTX_key_length(ctx) / 2,
|
||||
EVP_CIPHER_CTX_key_length(ctx) * 4,
|
||||
&xctx->ks2.ks);
|
||||
aes_t4_set_encrypt_key(key + bytes, bits, &xctx->ks2.ks);
|
||||
xctx->xts.block2 = (block128_f) aes_t4_encrypt;
|
||||
|
||||
xctx->xts.key1 = &xctx->ks1;
|
||||
@@ -3414,8 +3436,33 @@ static int aes_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
if (!iv && !key)
|
||||
return 1;
|
||||
|
||||
if (key)
|
||||
if (key) {
|
||||
do {
|
||||
/* The key is two half length keys in reality */
|
||||
const int bytes = EVP_CIPHER_CTX_key_length(ctx) / 2;
|
||||
const int bits = bytes * 8;
|
||||
|
||||
/*
|
||||
* Verify that the two keys are different.
|
||||
*
|
||||
* This addresses the vulnerability described in Rogaway's
|
||||
* September 2004 paper:
|
||||
*
|
||||
* "Efficient Instantiations of Tweakable Blockciphers and
|
||||
* Refinements to Modes OCB and PMAC".
|
||||
* (http://web.cs.ucdavis.edu/~rogaway/papers/offsets.pdf)
|
||||
*
|
||||
* FIPS 140-2 IG A.9 XTS-AES Key Generation Requirements states
|
||||
* that:
|
||||
* "The check for Key_1 != Key_2 shall be done at any place
|
||||
* BEFORE using the keys in the XTS-AES algorithm to process
|
||||
* data with them."
|
||||
*/
|
||||
if (memcmp(key, key + bytes, bytes) == 0) {
|
||||
EVPerr(EVP_F_AES_XTS_INIT_KEY, EVP_R_XTS_DUPLICATED_KEYS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef AES_XTS_ASM
|
||||
xctx->stream = enc ? AES_xts_encrypt : AES_xts_decrypt;
|
||||
#else
|
||||
@@ -3425,26 +3472,20 @@ static int aes_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
#ifdef HWAES_CAPABLE
|
||||
if (HWAES_CAPABLE) {
|
||||
if (enc) {
|
||||
HWAES_set_encrypt_key(key,
|
||||
EVP_CIPHER_CTX_key_length(ctx) * 4,
|
||||
&xctx->ks1.ks);
|
||||
HWAES_set_encrypt_key(key, bits, &xctx->ks1.ks);
|
||||
xctx->xts.block1 = (block128_f) HWAES_encrypt;
|
||||
# ifdef HWAES_xts_encrypt
|
||||
xctx->stream = HWAES_xts_encrypt;
|
||||
# endif
|
||||
} else {
|
||||
HWAES_set_decrypt_key(key,
|
||||
EVP_CIPHER_CTX_key_length(ctx) * 4,
|
||||
&xctx->ks1.ks);
|
||||
HWAES_set_decrypt_key(key, bits, &xctx->ks1.ks);
|
||||
xctx->xts.block1 = (block128_f) HWAES_decrypt;
|
||||
# ifdef HWAES_xts_decrypt
|
||||
xctx->stream = HWAES_xts_decrypt;
|
||||
#endif
|
||||
}
|
||||
|
||||
HWAES_set_encrypt_key(key + EVP_CIPHER_CTX_key_length(ctx) / 2,
|
||||
EVP_CIPHER_CTX_key_length(ctx) * 4,
|
||||
&xctx->ks2.ks);
|
||||
HWAES_set_encrypt_key(key + bytes, bits, &xctx->ks2.ks);
|
||||
xctx->xts.block2 = (block128_f) HWAES_encrypt;
|
||||
|
||||
xctx->xts.key1 = &xctx->ks1;
|
||||
@@ -3459,20 +3500,14 @@ static int aes_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
#ifdef VPAES_CAPABLE
|
||||
if (VPAES_CAPABLE) {
|
||||
if (enc) {
|
||||
vpaes_set_encrypt_key(key,
|
||||
EVP_CIPHER_CTX_key_length(ctx) * 4,
|
||||
&xctx->ks1.ks);
|
||||
vpaes_set_encrypt_key(key, bits, &xctx->ks1.ks);
|
||||
xctx->xts.block1 = (block128_f) vpaes_encrypt;
|
||||
} else {
|
||||
vpaes_set_decrypt_key(key,
|
||||
EVP_CIPHER_CTX_key_length(ctx) * 4,
|
||||
&xctx->ks1.ks);
|
||||
vpaes_set_decrypt_key(key, bits, &xctx->ks1.ks);
|
||||
xctx->xts.block1 = (block128_f) vpaes_decrypt;
|
||||
}
|
||||
|
||||
vpaes_set_encrypt_key(key + EVP_CIPHER_CTX_key_length(ctx) / 2,
|
||||
EVP_CIPHER_CTX_key_length(ctx) * 4,
|
||||
&xctx->ks2.ks);
|
||||
vpaes_set_encrypt_key(key + bytes, bits, &xctx->ks2.ks);
|
||||
xctx->xts.block2 = (block128_f) vpaes_encrypt;
|
||||
|
||||
xctx->xts.key1 = &xctx->ks1;
|
||||
@@ -3482,22 +3517,19 @@ static int aes_xts_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
(void)0; /* terminate potentially open 'else' */
|
||||
|
||||
if (enc) {
|
||||
AES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 4,
|
||||
&xctx->ks1.ks);
|
||||
AES_set_encrypt_key(key, bits, &xctx->ks1.ks);
|
||||
xctx->xts.block1 = (block128_f) AES_encrypt;
|
||||
} else {
|
||||
AES_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 4,
|
||||
&xctx->ks1.ks);
|
||||
AES_set_decrypt_key(key, bits, &xctx->ks1.ks);
|
||||
xctx->xts.block1 = (block128_f) AES_decrypt;
|
||||
}
|
||||
|
||||
AES_set_encrypt_key(key + EVP_CIPHER_CTX_key_length(ctx) / 2,
|
||||
EVP_CIPHER_CTX_key_length(ctx) * 4,
|
||||
&xctx->ks2.ks);
|
||||
AES_set_encrypt_key(key + bytes, bits, &xctx->ks2.ks);
|
||||
xctx->xts.block2 = (block128_f) AES_encrypt;
|
||||
|
||||
xctx->xts.key1 = &xctx->ks1;
|
||||
} while (0);
|
||||
}
|
||||
|
||||
if (iv) {
|
||||
xctx->xts.key2 = &xctx->ks2;
|
||||
@@ -3520,20 +3552,15 @@ static int aes_xts_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Verify that the two keys are different.
|
||||
*
|
||||
* This addresses the vulnerability described in Rogaway's September 2004
|
||||
* paper (http://web.cs.ucdavis.edu/~rogaway/papers/offsets.pdf):
|
||||
* "Efficient Instantiations of Tweakable Blockciphers and Refinements
|
||||
* to Modes OCB and PMAC".
|
||||
*
|
||||
* FIPS 140-2 IG A.9 XTS-AES Key Generation Requirements states that:
|
||||
* "The check for Key_1 != Key_2 shall be done at any place BEFORE
|
||||
* using the keys in the XTS-AES algorithm to process data with them."
|
||||
* Impose a limit of 2^20 blocks per data unit as specifed by
|
||||
* IEEE Std 1619-2018. The earlier and obsolete IEEE Std 1619-2007
|
||||
* indicated that this was a SHOULD NOT rather than a MUST NOT.
|
||||
* NIST SP 800-38E mandates the same limit.
|
||||
*/
|
||||
if (CRYPTO_memcmp(xctx->xts.key1, xctx->xts.key2,
|
||||
EVP_CIPHER_CTX_key_length(ctx) / 2) == 0)
|
||||
if (len > XTS_MAX_BLOCKS_PER_DATA_UNIT * AES_BLOCK_SIZE) {
|
||||
EVPerr(EVP_F_AES_XTS_CIPHER, EVP_R_XTS_DATA_UNIT_IS_TOO_LARGE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (xctx->stream)
|
||||
(*xctx->stream) (in, out, len,
|
||||
|
||||
+18
-4
@@ -13,9 +13,11 @@
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include <openssl/trace.h>
|
||||
|
||||
/* Algorithm configuration module. */
|
||||
|
||||
/* TODO(3.0): the config module functions should be passed a library context */
|
||||
static int alg_module_init(CONF_IMODULE *md, const CONF *cnf)
|
||||
{
|
||||
int i;
|
||||
@@ -23,6 +25,9 @@ static int alg_module_init(CONF_IMODULE *md, const CONF *cnf)
|
||||
STACK_OF(CONF_VALUE) *sktmp;
|
||||
CONF_VALUE *oval;
|
||||
|
||||
OSSL_TRACE2(CONF, "Loading EVP module: name %s, value %s\n",
|
||||
CONF_imodule_get_name(md), CONF_imodule_get_value(md));
|
||||
|
||||
oid_section = CONF_imodule_get_value(md);
|
||||
if ((sktmp = NCONF_get_section(cnf, oid_section)) == NULL) {
|
||||
EVPerr(EVP_F_ALG_MODULE_INIT, EVP_R_ERROR_LOADING_SECTION);
|
||||
@@ -32,18 +37,26 @@ static int alg_module_init(CONF_IMODULE *md, const CONF *cnf)
|
||||
oval = sk_CONF_VALUE_value(sktmp, i);
|
||||
if (strcmp(oval->name, "fips_mode") == 0) {
|
||||
int m;
|
||||
|
||||
if (!X509V3_get_value_bool(oval, &m)) {
|
||||
EVPerr(EVP_F_ALG_MODULE_INIT, EVP_R_INVALID_FIPS_MODE);
|
||||
return 0;
|
||||
}
|
||||
if (m > 0) {
|
||||
EVPerr(EVP_F_ALG_MODULE_INIT, EVP_R_FIPS_MODE_NOT_SUPPORTED);
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* fips_mode is deprecated and should not be used in new
|
||||
* configurations. Old configurations are likely to ONLY
|
||||
* have this, so we assume that no default properties have
|
||||
* been set before this.
|
||||
*/
|
||||
if (m > 0)
|
||||
EVP_set_default_properties(NULL, "fips=yes");
|
||||
} else if (strcmp(oval->name, "default_properties") == 0) {
|
||||
EVP_set_default_properties(NULL, oval->value);
|
||||
} else {
|
||||
EVPerr(EVP_F_ALG_MODULE_INIT, EVP_R_UNKNOWN_OPTION);
|
||||
ERR_add_error_data(4, "name=", oval->name,
|
||||
", value=", oval->value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -52,5 +65,6 @@ static int alg_module_init(CONF_IMODULE *md, const CONF *cnf)
|
||||
|
||||
void EVP_add_alg_module(void)
|
||||
{
|
||||
OSSL_TRACE(CONF, "Adding config module 'alg_section'\n");
|
||||
CONF_module_add("alg_section", alg_module_init, 0);
|
||||
}
|
||||
+10
-9
@@ -305,6 +305,11 @@ static int evp_EncryptDecryptUpdate(EVP_CIPHER_CTX *ctx,
|
||||
|
||||
bl = ctx->cipher->block_size;
|
||||
|
||||
if (inl <= 0) {
|
||||
*outl = 0;
|
||||
return inl == 0;
|
||||
}
|
||||
|
||||
if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
|
||||
/* If block size > 1 then the cipher will have to do this check */
|
||||
if (bl == 1 && is_partially_overlapping(out, in, cmpl)) {
|
||||
@@ -320,10 +325,6 @@ static int evp_EncryptDecryptUpdate(EVP_CIPHER_CTX *ctx,
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (inl <= 0) {
|
||||
*outl = 0;
|
||||
return inl == 0;
|
||||
}
|
||||
if (is_partially_overlapping(out + ctx->buf_len, in, cmpl)) {
|
||||
EVPerr(EVP_F_EVP_ENCRYPTDECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);
|
||||
return 0;
|
||||
@@ -457,6 +458,11 @@ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
|
||||
if (EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS))
|
||||
cmpl = (cmpl + 7) / 8;
|
||||
|
||||
if (inl <= 0) {
|
||||
*outl = 0;
|
||||
return inl == 0;
|
||||
}
|
||||
|
||||
if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
|
||||
if (b == 1 && is_partially_overlapping(out, in, cmpl)) {
|
||||
EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);
|
||||
@@ -472,11 +478,6 @@ int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (inl <= 0) {
|
||||
*outl = 0;
|
||||
return inl == 0;
|
||||
}
|
||||
|
||||
if (ctx->flags & EVP_CIPH_NO_PADDING)
|
||||
return evp_EncryptDecryptUpdate(ctx, out, outl, in, inl);
|
||||
|
||||
|
||||
@@ -15,12 +15,17 @@
|
||||
|
||||
static const ERR_STRING_DATA EVP_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_AESNI_INIT_KEY, 0), "aesni_init_key"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_AESNI_XTS_INIT_KEY, 0), "aesni_xts_init_key"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_AES_GCM_CTRL, 0), "aes_gcm_ctrl"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_AES_GCM_TLS_CIPHER, 0), "aes_gcm_tls_cipher"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_AES_INIT_KEY, 0), "aes_init_key"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_AES_OCB_CIPHER, 0), "aes_ocb_cipher"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_AES_T4_INIT_KEY, 0), "aes_t4_init_key"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_AES_T4_XTS_INIT_KEY, 0),
|
||||
"aes_t4_xts_init_key"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_AES_WRAP_CIPHER, 0), "aes_wrap_cipher"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_AES_XTS_CIPHER, 0), "aes_xts_cipher"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_AES_XTS_INIT_KEY, 0), "aes_xts_init_key"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_ALG_MODULE_INIT, 0), "alg_module_init"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_ARIA_CCM_INIT_KEY, 0), "aria_ccm_init_key"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_ARIA_GCM_CTRL, 0), "aria_gcm_ctrl"},
|
||||
@@ -70,6 +75,7 @@ static const ERR_STRING_DATA EVP_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_EVP_MAC_CTX_COPY, 0), "EVP_MAC_CTX_copy"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_EVP_MAC_CTX_NEW, 0), "EVP_MAC_CTX_new"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_EVP_MAC_INIT, 0), "EVP_MAC_init"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_EVP_MD_BLOCK_SIZE, 0), "EVP_MD_block_size"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_EVP_MD_CTX_COPY_EX, 0), "EVP_MD_CTX_copy_ex"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_EVP_MD_SIZE, 0), "EVP_MD_size"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_EVP_OPENINIT, 0), "EVP_OpenInit"},
|
||||
@@ -150,6 +156,8 @@ static const ERR_STRING_DATA EVP_str_functs[] = {
|
||||
"EVP_PKEY_verify_recover"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_EVP_PKEY_VERIFY_RECOVER_INIT, 0),
|
||||
"EVP_PKEY_verify_recover_init"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_EVP_SET_DEFAULT_PROPERTIES, 0),
|
||||
"EVP_set_default_properties"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_EVP_SIGNFINAL, 0), "EVP_SignFinal"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_EVP_VERIFYFINAL, 0), "EVP_VerifyFinal"},
|
||||
{ERR_PACK(ERR_LIB_EVP, EVP_F_GMAC_CTRL, 0), "gmac_ctrl"},
|
||||
@@ -303,6 +311,10 @@ static const ERR_STRING_DATA EVP_str_reasons[] = {
|
||||
"wrap mode not allowed"},
|
||||
{ERR_PACK(ERR_LIB_EVP, 0, EVP_R_WRONG_FINAL_BLOCK_LENGTH),
|
||||
"wrong final block length"},
|
||||
{ERR_PACK(ERR_LIB_EVP, 0, EVP_R_XTS_DATA_UNIT_IS_TOO_LARGE),
|
||||
"xts data unit is too large"},
|
||||
{ERR_PACK(ERR_LIB_EVP, 0, EVP_R_XTS_DUPLICATED_KEYS),
|
||||
"xts duplicated keys"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
|
||||
+29
-11
@@ -62,6 +62,7 @@ struct method_data_st {
|
||||
OSSL_PROVIDER *);
|
||||
int (*refcnt_up_method)(void *method);
|
||||
void (*destruct_method)(void *method);
|
||||
int (*nid_method)(void *method);
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -78,8 +79,7 @@ static void *alloc_tmp_method_store(void)
|
||||
ossl_method_store_free(store);
|
||||
}
|
||||
|
||||
static
|
||||
struct OSSL_METHOD_STORE *get_default_method_store(OPENSSL_CTX *libctx)
|
||||
static OSSL_METHOD_STORE *get_default_method_store(OPENSSL_CTX *libctx)
|
||||
{
|
||||
if (!RUN_ONCE(&default_method_store_init_flag,
|
||||
do_default_method_store_init))
|
||||
@@ -107,29 +107,35 @@ static void *get_method_from_store(OPENSSL_CTX *libctx, void *store,
|
||||
}
|
||||
|
||||
static int put_method_in_store(OPENSSL_CTX *libctx, void *store,
|
||||
const char *propdef, void *method,
|
||||
void *data)
|
||||
const char *propdef,
|
||||
void *method, void *data)
|
||||
{
|
||||
struct method_data_st *methdata = data;
|
||||
int nid = methdata->nid_method(method);
|
||||
|
||||
if (nid == NID_undef)
|
||||
return 0;
|
||||
|
||||
if (store == NULL
|
||||
&& (store = get_default_method_store(libctx)) == NULL)
|
||||
return 0;
|
||||
|
||||
if (methdata->refcnt_up_method(method)
|
||||
&& ossl_method_store_add(store, methdata->nid, propdef, method,
|
||||
&& ossl_method_store_add(store, nid, propdef, method,
|
||||
methdata->destruct_method))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *construct_method(const OSSL_DISPATCH *fns, OSSL_PROVIDER *prov,
|
||||
static void *construct_method(const char *algorithm_name,
|
||||
const OSSL_DISPATCH *fns, OSSL_PROVIDER *prov,
|
||||
void *data)
|
||||
{
|
||||
struct method_data_st *methdata = data;
|
||||
void *method = NULL;
|
||||
int nid = OBJ_sn2nid(algorithm_name);
|
||||
|
||||
if (methdata->nid == NID_undef) {
|
||||
if (nid == NID_undef) {
|
||||
/* Create a new NID for that name on the fly */
|
||||
ASN1_OBJECT tmpobj;
|
||||
|
||||
@@ -140,13 +146,13 @@ static void *construct_method(const OSSL_DISPATCH *fns, OSSL_PROVIDER *prov,
|
||||
tmpobj.length = 0;
|
||||
tmpobj.data = NULL;
|
||||
|
||||
methdata->nid = OBJ_add_object(&tmpobj);
|
||||
nid = OBJ_add_object(&tmpobj);
|
||||
}
|
||||
|
||||
if (methdata->nid == NID_undef)
|
||||
if (nid == NID_undef)
|
||||
return NULL;
|
||||
|
||||
method = methdata->method_from_dispatch(methdata->nid, fns, prov);
|
||||
method = methdata->method_from_dispatch(nid, fns, prov);
|
||||
if (method == NULL)
|
||||
return NULL;
|
||||
return method;
|
||||
@@ -164,7 +170,8 @@ void *evp_generic_fetch(OPENSSL_CTX *libctx, int operation_id,
|
||||
void *(*new_method)(int nid, const OSSL_DISPATCH *fns,
|
||||
OSSL_PROVIDER *prov),
|
||||
int (*upref_method)(void *),
|
||||
void (*free_method)(void *))
|
||||
void (*free_method)(void *),
|
||||
int (*nid_method)(void *))
|
||||
{
|
||||
int nid = OBJ_sn2nid(algorithm);
|
||||
void *method = NULL;
|
||||
@@ -187,6 +194,7 @@ void *evp_generic_fetch(OPENSSL_CTX *libctx, int operation_id,
|
||||
mcmdata.destruct_method = free_method;
|
||||
mcmdata.refcnt_up_method = upref_method;
|
||||
mcmdata.destruct_method = free_method;
|
||||
mcmdata.nid_method = nid_method;
|
||||
method = ossl_method_construct(libctx, operation_id, algorithm,
|
||||
properties, 0 /* !force_cache */,
|
||||
&mcm, &mcmdata);
|
||||
@@ -195,3 +203,13 @@ void *evp_generic_fetch(OPENSSL_CTX *libctx, int operation_id,
|
||||
|
||||
return method;
|
||||
}
|
||||
|
||||
int EVP_set_default_properties(OPENSSL_CTX *libctx, const char *propq)
|
||||
{
|
||||
OSSL_METHOD_STORE *store = get_default_method_store(libctx);
|
||||
|
||||
if (store != NULL)
|
||||
return ossl_method_store_set_global_properties(store, propq);
|
||||
EVPerr(EVP_F_EVP_SET_DEFAULT_PROPERTIES, ERR_R_INTERNAL_ERROR);
|
||||
return 0;
|
||||
}
|
||||
+10
-2
@@ -298,6 +298,14 @@ int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx)
|
||||
|
||||
int EVP_MD_block_size(const EVP_MD *md)
|
||||
{
|
||||
if (md == NULL) {
|
||||
EVPerr(EVP_F_EVP_MD_BLOCK_SIZE, EVP_R_MESSAGE_DIGEST_IS_NULL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (md->prov != NULL && md->dblock_size != NULL)
|
||||
return (int)md->dblock_size();
|
||||
|
||||
return md->block_size;
|
||||
}
|
||||
|
||||
@@ -479,9 +487,9 @@ int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd,
|
||||
|
||||
const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx)
|
||||
{
|
||||
if (!ctx)
|
||||
if (ctx == NULL)
|
||||
return NULL;
|
||||
return ctx->digest;
|
||||
return ctx->reqdigest;
|
||||
}
|
||||
|
||||
EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx)
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
/* EVP_MD_CTX related stuff */
|
||||
|
||||
struct evp_md_ctx_st {
|
||||
const EVP_MD *reqdigest; /* The original requested digest */
|
||||
const EVP_MD *digest;
|
||||
ENGINE *engine; /* functional reference if 'digest' is
|
||||
* ENGINE-provided */
|
||||
@@ -89,4 +90,5 @@ void *evp_generic_fetch(OPENSSL_CTX *ctx, int operation_id,
|
||||
void *(*new_method)(int nid, const OSSL_DISPATCH *fns,
|
||||
OSSL_PROVIDER *prov),
|
||||
int (*upref_method)(void *),
|
||||
void (*free_method)(void *));
|
||||
void (*free_method)(void *),
|
||||
int (*nid_method)(void *));
|
||||
+1
-1
@@ -40,7 +40,7 @@ int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
|
||||
}
|
||||
|
||||
size = EVP_PKEY_size(priv);
|
||||
key = OPENSSL_malloc(size + 2);
|
||||
key = OPENSSL_malloc(size);
|
||||
if (key == NULL) {
|
||||
/* ERROR */
|
||||
EVPerr(EVP_F_EVP_OPENINIT, ERR_R_MALLOC_FAILURE);
|
||||
|
||||
+7
-2
@@ -235,7 +235,7 @@ int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad)
|
||||
return 0;
|
||||
}
|
||||
for (i = 0; i < mx; i++) {
|
||||
if (storage[i] && storage[i]->new_func) {
|
||||
if (storage[i] != NULL && storage[i]->new_func != NULL) {
|
||||
ptr = CRYPTO_get_ex_data(ad, i);
|
||||
storage[i]->new_func(obj, ptr, ad, i,
|
||||
storage[i]->argl, storage[i]->argp);
|
||||
@@ -299,7 +299,7 @@ int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
|
||||
|
||||
for (i = 0; i < mx; i++) {
|
||||
ptr = CRYPTO_get_ex_data(from, i);
|
||||
if (storage[i] && storage[i]->dup_func)
|
||||
if (storage[i] != NULL && storage[i]->dup_func != NULL)
|
||||
if (!storage[i]->dup_func(to, from, &ptr, i,
|
||||
storage[i]->argl, storage[i]->argp))
|
||||
goto err;
|
||||
@@ -380,6 +380,8 @@ int CRYPTO_alloc_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad,
|
||||
return 1;
|
||||
|
||||
ip = get_and_lock(class_index);
|
||||
if (ip == NULL)
|
||||
return 0;
|
||||
f = sk_EX_CALLBACK_value(ip->meth, idx);
|
||||
CRYPTO_THREAD_unlock(ex_data_lock);
|
||||
|
||||
@@ -387,6 +389,9 @@ int CRYPTO_alloc_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad,
|
||||
* This should end up calling CRYPTO_set_ex_data(), which allocates
|
||||
* everything necessary to support placing the new data in the right spot.
|
||||
*/
|
||||
if (f->new_func == NULL)
|
||||
return 0;
|
||||
|
||||
f->new_func(obj, curval, ad, idx, f->argl, f->argp);
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#ifndef HEADER_DSO_CONF_H
|
||||
# define HEADER_DSO_CONF_H
|
||||
{- output_off() if $disabled{dso} -}
|
||||
{- # The DSO code currently always implements all functions so that no
|
||||
# applications will have to worry about that from a compilation point
|
||||
# of view. However, the "method"s may return zero unless that platform
|
||||
@@ -18,6 +17,9 @@
|
||||
# by a define "DSO_<name>" ... we translate the "dso_scheme" config
|
||||
# string entry into using the following logic;
|
||||
my $scheme = uc $target{dso_scheme};
|
||||
if (!$scheme) {
|
||||
$scheme = "NONE";
|
||||
}
|
||||
my @macros = ( "DSO_$scheme" );
|
||||
if ($scheme eq 'DLFCN') {
|
||||
@macros = ( "DSO_DLFCN", "HAVE_DLFCN_H" );
|
||||
@@ -26,5 +28,4 @@
|
||||
}
|
||||
join("\n", map { "# define $_" } @macros); -}
|
||||
# define DSO_EXTENSION "{- platform->dsoext() -}"
|
||||
{- output_on() if $disabled{dso} -}
|
||||
#endif
|
||||
@@ -204,6 +204,7 @@ struct evp_md_st {
|
||||
OSSL_OP_digest_freectx_fn *freectx;
|
||||
OSSL_OP_digest_dupctx_fn *dupctx;
|
||||
OSSL_OP_digest_size_fn *size;
|
||||
OSSL_OP_digest_block_size_fn *dblock_size;
|
||||
|
||||
} /* EVP_MD */ ;
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ struct x509_st {
|
||||
CRYPTO_RWLOCK *lock;
|
||||
volatile int ex_cached;
|
||||
# ifndef OPENSSL_NO_SM2
|
||||
ASN1_OCTET_STRING sm2_id;
|
||||
ASN1_OCTET_STRING *sm2_id;
|
||||
# endif
|
||||
} /* X509 */ ;
|
||||
|
||||
|
||||
+5
-7
@@ -160,8 +160,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_load_crypto_nodelete)
|
||||
{
|
||||
OSSL_TRACE(INIT, "ossl_init_load_crypto_nodelete()\n");
|
||||
|
||||
#if !defined(OPENSSL_NO_DSO) \
|
||||
&& !defined(OPENSSL_USE_NODELETE) \
|
||||
#if !defined(OPENSSL_USE_NODELETE) \
|
||||
&& !defined(OPENSSL_NO_PINSHARED)
|
||||
# if defined(DSO_WIN32) && !defined(_WIN32_WCE)
|
||||
{
|
||||
@@ -179,7 +178,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_load_crypto_nodelete)
|
||||
(ret == TRUE ? "No!" : "Yes."));
|
||||
return (ret == TRUE) ? 1 : 0;
|
||||
}
|
||||
# else
|
||||
# elif !defined(DSO_NONE)
|
||||
/*
|
||||
* Deliberately leak a reference to ourselves. This will force the library
|
||||
* to remain loaded until the atexit() handler is run at process exit.
|
||||
@@ -671,7 +670,7 @@ int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings)
|
||||
ret = RUN_ONCE(&config, ossl_init_config);
|
||||
conf_settings = NULL;
|
||||
CRYPTO_THREAD_unlock(init_lock);
|
||||
if (!ret)
|
||||
if (ret <= 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -733,8 +732,7 @@ int OPENSSL_atexit(void (*handler)(void))
|
||||
{
|
||||
OPENSSL_INIT_STOP *newhand;
|
||||
|
||||
#if !defined(OPENSSL_NO_DSO) \
|
||||
&& !defined(OPENSSL_USE_NODELETE)\
|
||||
#if !defined(OPENSSL_USE_NODELETE)\
|
||||
&& !defined(OPENSSL_NO_PINSHARED)
|
||||
{
|
||||
union {
|
||||
@@ -759,7 +757,7 @@ int OPENSSL_atexit(void (*handler)(void))
|
||||
if (!ret)
|
||||
return 0;
|
||||
}
|
||||
# else
|
||||
# elif !defined(DSO_NONE)
|
||||
/*
|
||||
* Deliberately leak a reference to the handler. This will force the
|
||||
* library/code containing the handler to remain loaded until we run the
|
||||
|
||||
+27
-7
@@ -182,6 +182,8 @@ static int kdf_hkdf_ctrl_str(EVP_KDF_IMPL *impl, const char *type,
|
||||
|
||||
static size_t kdf_hkdf_size(EVP_KDF_IMPL *impl)
|
||||
{
|
||||
int sz;
|
||||
|
||||
if (impl->mode != EVP_KDF_HKDF_MODE_EXTRACT_ONLY)
|
||||
return SIZE_MAX;
|
||||
|
||||
@@ -189,7 +191,11 @@ static size_t kdf_hkdf_size(EVP_KDF_IMPL *impl)
|
||||
KDFerr(KDF_F_KDF_HKDF_SIZE, KDF_R_MISSING_MESSAGE_DIGEST);
|
||||
return 0;
|
||||
}
|
||||
return EVP_MD_size(impl->md);
|
||||
sz = EVP_MD_size(impl->md);
|
||||
if (sz < 0)
|
||||
return 0;
|
||||
|
||||
return sz;
|
||||
}
|
||||
|
||||
static int kdf_hkdf_derive(EVP_KDF_IMPL *impl, unsigned char *key,
|
||||
@@ -241,8 +247,13 @@ static int HKDF(const EVP_MD *evp_md,
|
||||
unsigned char *okm, size_t okm_len)
|
||||
{
|
||||
unsigned char prk[EVP_MAX_MD_SIZE];
|
||||
int ret;
|
||||
size_t prk_len = EVP_MD_size(evp_md);
|
||||
int ret, sz;
|
||||
size_t prk_len;
|
||||
|
||||
sz = EVP_MD_size(evp_md);
|
||||
if (sz < 0)
|
||||
return 0;
|
||||
prk_len = (size_t)sz;
|
||||
|
||||
if (!HKDF_Extract(evp_md, salt, salt_len, key, key_len, prk, prk_len))
|
||||
return 0;
|
||||
@@ -258,7 +269,11 @@ static int HKDF_Extract(const EVP_MD *evp_md,
|
||||
const unsigned char *key, size_t key_len,
|
||||
unsigned char *prk, size_t prk_len)
|
||||
{
|
||||
if (prk_len != (size_t)EVP_MD_size(evp_md)) {
|
||||
int sz = EVP_MD_size(evp_md);
|
||||
|
||||
if (sz < 0)
|
||||
return 0;
|
||||
if (prk_len != (size_t)sz) {
|
||||
KDFerr(KDF_F_HKDF_EXTRACT, KDF_R_WRONG_OUTPUT_BUFFER_SIZE);
|
||||
return 0;
|
||||
}
|
||||
@@ -271,11 +286,16 @@ static int HKDF_Expand(const EVP_MD *evp_md,
|
||||
unsigned char *okm, size_t okm_len)
|
||||
{
|
||||
HMAC_CTX *hmac;
|
||||
int ret = 0;
|
||||
int ret = 0, sz;
|
||||
unsigned int i;
|
||||
unsigned char prev[EVP_MAX_MD_SIZE];
|
||||
size_t done_len = 0, dig_len = EVP_MD_size(evp_md);
|
||||
size_t n = okm_len / dig_len;
|
||||
size_t done_len = 0, dig_len, n;
|
||||
|
||||
sz = EVP_MD_size(evp_md);
|
||||
if (sz <= 0)
|
||||
return 0;
|
||||
dig_len = (size_t)sz;
|
||||
n = okm_len / dig_len;
|
||||
|
||||
if (okm_len % dig_len)
|
||||
n++;
|
||||
|
||||
+6
-6
@@ -14,7 +14,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <openssl/crypto.h>
|
||||
#ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
|
||||
#if !defined(OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE) && !defined(FIPS_MODE)
|
||||
# include <execinfo.h>
|
||||
#endif
|
||||
|
||||
@@ -30,7 +30,7 @@ static void *(*realloc_impl)(void *, size_t, const char *, int)
|
||||
static void (*free_impl)(void *, const char *, int)
|
||||
= CRYPTO_free;
|
||||
|
||||
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
|
||||
#if !defined(OPENSSL_NO_CRYPTO_MDEBUG) && !defined(FIPS_MODE)
|
||||
# include "internal/tsan_assist.h"
|
||||
|
||||
static TSAN_QUALIFIER int malloc_count;
|
||||
@@ -94,7 +94,7 @@ void CRYPTO_get_mem_functions(
|
||||
*f = free_impl;
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
|
||||
#if !defined(OPENSSL_NO_CRYPTO_MDEBUG) && !defined(FIPS_MODE)
|
||||
void CRYPTO_get_alloc_counts(int *mcount, int *rcount, int *fcount)
|
||||
{
|
||||
if (mcount != NULL)
|
||||
@@ -209,7 +209,7 @@ void *CRYPTO_malloc(size_t num, const char *file, int line)
|
||||
*/
|
||||
allow_customize = 0;
|
||||
}
|
||||
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
|
||||
#if !defined(OPENSSL_NO_CRYPTO_MDEBUG) && !defined(FIPS_MODE)
|
||||
if (call_malloc_debug) {
|
||||
CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);
|
||||
ret = malloc(num);
|
||||
@@ -250,7 +250,7 @@ void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
|
||||
#if !defined(OPENSSL_NO_CRYPTO_MDEBUG) && !defined(FIPS_MODE)
|
||||
if (call_malloc_debug) {
|
||||
void *ret;
|
||||
CRYPTO_mem_debug_realloc(str, NULL, num, 0, file, line);
|
||||
@@ -300,7 +300,7 @@ void CRYPTO_free(void *str, const char *file, int line)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
|
||||
#if !defined(OPENSSL_NO_CRYPTO_MDEBUG) && !defined(FIPS_MODE)
|
||||
if (call_malloc_debug) {
|
||||
CRYPTO_mem_debug_free(str, 0, file, line);
|
||||
free(str);
|
||||
|
||||
@@ -133,6 +133,12 @@ struct gcm128_context {
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* The maximum permitted number of cipher blocks per data unit in XTS mode.
|
||||
* Reference IEEE Std 1619-2018.
|
||||
*/
|
||||
#define XTS_MAX_BLOCKS_PER_DATA_UNIT (1<<20)
|
||||
|
||||
struct xts128_context {
|
||||
void *key1, *key2;
|
||||
block128_f block1, block2;
|
||||
|
||||
+23
-4
@@ -348,6 +348,13 @@ OSSL_PARAM OSSL_PARAM_construct_size_t(const char *key, size_t *buf,
|
||||
return ossl_param_construct(key, OSSL_PARAM_UNSIGNED_INTEGER, buf,
|
||||
sizeof(size_t), rsize); }
|
||||
|
||||
#ifndef FIPS_MODE
|
||||
/*
|
||||
* TODO(3.0): Make this available in FIPS mode.
|
||||
*
|
||||
* Temporarily we don't include these functions in FIPS mode to avoid pulling
|
||||
* in the entire BN sub-library into the module at this point.
|
||||
*/
|
||||
int OSSL_PARAM_get_BN(const OSSL_PARAM *p, BIGNUM **val)
|
||||
{
|
||||
BIGNUM *b;
|
||||
@@ -375,6 +382,10 @@ int OSSL_PARAM_set_BN(const OSSL_PARAM *p, const BIGNUM *val)
|
||||
if (val == NULL || p->data_type != OSSL_PARAM_UNSIGNED_INTEGER)
|
||||
return 0;
|
||||
|
||||
/* For the moment, only positive values are permitted */
|
||||
if (BN_is_negative(val))
|
||||
return 0;
|
||||
|
||||
bytes = (size_t)BN_num_bytes(val);
|
||||
SET_RETURN_SIZE(p, bytes);
|
||||
return p->data_size >= bytes
|
||||
@@ -387,6 +398,7 @@ OSSL_PARAM OSSL_PARAM_construct_BN(const char *key, unsigned char *buf,
|
||||
return ossl_param_construct(key, OSSL_PARAM_UNSIGNED_INTEGER,
|
||||
buf, bsize, rsize);
|
||||
}
|
||||
#endif
|
||||
|
||||
int OSSL_PARAM_get_double(const OSSL_PARAM *p, double *val)
|
||||
{
|
||||
@@ -568,13 +580,20 @@ int OSSL_PARAM_set_octet_ptr(const OSSL_PARAM *p, const void *val,
|
||||
}
|
||||
|
||||
OSSL_PARAM OSSL_PARAM_construct_utf8_ptr(const char *key, char **buf,
|
||||
size_t *rsize)
|
||||
size_t bsize, size_t *rsize)
|
||||
{
|
||||
return ossl_param_construct(key, OSSL_PARAM_UTF8_PTR, buf, 0, rsize);
|
||||
return ossl_param_construct(key, OSSL_PARAM_UTF8_PTR, buf, bsize, rsize);
|
||||
}
|
||||
|
||||
OSSL_PARAM OSSL_PARAM_construct_octet_ptr(const char *key, void **buf,
|
||||
size_t *rsize)
|
||||
size_t bsize, size_t *rsize)
|
||||
{
|
||||
return ossl_param_construct(key, OSSL_PARAM_OCTET_PTR, buf, 0, rsize);
|
||||
return ossl_param_construct(key, OSSL_PARAM_OCTET_PTR, buf, bsize, rsize);
|
||||
}
|
||||
|
||||
OSSL_PARAM OSSL_PARAM_construct_end(void)
|
||||
{
|
||||
OSSL_PARAM end = OSSL_PARAM_END;
|
||||
|
||||
return end;
|
||||
}
|
||||
@@ -31,7 +31,7 @@ int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,
|
||||
int i, ret = 0;
|
||||
unsigned int m_len;
|
||||
|
||||
m = OPENSSL_malloc(EVP_PKEY_size(pkey) + 2);
|
||||
m = OPENSSL_malloc(EVP_PKEY_size(pkey));
|
||||
if (m == NULL) {
|
||||
PEMerr(PEM_F_PEM_SIGNFINAL, ERR_R_MALLOC_FAILURE);
|
||||
goto err;
|
||||
|
||||
@@ -523,6 +523,7 @@ int ossl_property_parse_init(void)
|
||||
{
|
||||
static const char *const predefined_names[] = {
|
||||
"default", /* Being provided by the default built-in provider */
|
||||
"legacy", /* Provided by the legacy provider */
|
||||
"provider", /* Name of provider (default, fips) */
|
||||
"version", /* Version number of this provider */
|
||||
"fips", /* FIPS supporting provider */
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
* Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <openssl/trace.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/safestack.h>
|
||||
#include "internal/provider.h"
|
||||
|
||||
/* PROVIDER config module */
|
||||
|
||||
DEFINE_STACK_OF(OSSL_PROVIDER)
|
||||
static STACK_OF(OSSL_PROVIDER) *activated_providers = NULL;
|
||||
|
||||
static const char *skip_dot(const char *name)
|
||||
{
|
||||
const char *p = strchr(name, '.');
|
||||
|
||||
if (p != NULL)
|
||||
return p + 1;
|
||||
return name;
|
||||
}
|
||||
|
||||
static int provider_conf_params(OSSL_PROVIDER *prov,
|
||||
const char *name, const char *value,
|
||||
const CONF *cnf)
|
||||
{
|
||||
STACK_OF(CONF_VALUE) *sect;
|
||||
int ok = 1;
|
||||
|
||||
sect = NCONF_get_section(cnf, value);
|
||||
if (sect != NULL) {
|
||||
int i;
|
||||
char buffer[512];
|
||||
size_t buffer_len = 0;
|
||||
|
||||
OSSL_TRACE1(CONF, "Provider params: start section %s\n", value);
|
||||
|
||||
if (name != NULL) {
|
||||
OPENSSL_strlcpy(buffer, name, sizeof(buffer));
|
||||
OPENSSL_strlcat(buffer, ".", sizeof(buffer));
|
||||
buffer_len = strlen(buffer);
|
||||
}
|
||||
|
||||
for (i = 0; i < sk_CONF_VALUE_num(sect); i++) {
|
||||
CONF_VALUE *sectconf = sk_CONF_VALUE_value(sect, i);
|
||||
|
||||
if (buffer_len + strlen(sectconf->name) >= sizeof(buffer))
|
||||
return 0;
|
||||
buffer[buffer_len] = '\0';
|
||||
OPENSSL_strlcat(buffer, sectconf->name, sizeof(buffer));
|
||||
if (!provider_conf_params(prov, buffer, sectconf->value, cnf))
|
||||
return 0;
|
||||
}
|
||||
|
||||
OSSL_TRACE1(CONF, "Provider params: finish section %s\n", value);
|
||||
} else {
|
||||
OSSL_TRACE2(CONF, "Provider params: %s = %s\n", name, value);
|
||||
ok = ossl_provider_add_parameter(prov, name, value);
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
static int provider_conf_load(OPENSSL_CTX *libctx, const char *name,
|
||||
const char *value, const CONF *cnf)
|
||||
{
|
||||
int i;
|
||||
STACK_OF(CONF_VALUE) *ecmds;
|
||||
int soft = 0;
|
||||
OSSL_PROVIDER *prov = NULL;
|
||||
const char *path = NULL;
|
||||
long activate = 0;
|
||||
int ok = 0;
|
||||
|
||||
name = skip_dot(name);
|
||||
OSSL_TRACE1(CONF, "Configuring provider %s\n", name);
|
||||
/* Value is a section containing PROVIDER commands */
|
||||
ecmds = NCONF_get_section(cnf, value);
|
||||
|
||||
if (!ecmds) {
|
||||
CRYPTOerr(CRYPTO_F_PROVIDER_CONF_LOAD, CRYPTO_R_PROVIDER_SECTION_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Find the needed data first */
|
||||
for (i = 0; i < sk_CONF_VALUE_num(ecmds); i++) {
|
||||
CONF_VALUE *ecmd = sk_CONF_VALUE_value(ecmds, i);
|
||||
const char *confname = skip_dot(ecmd->name);
|
||||
const char *confvalue = ecmd->value;
|
||||
|
||||
OSSL_TRACE2(CONF, "Provider command: %s = %s\n",
|
||||
confname, confvalue);
|
||||
|
||||
/* First handle some special pseudo confs */
|
||||
|
||||
/* Override provider name to use */
|
||||
if (strcmp(confname, "identity") == 0)
|
||||
name = confvalue;
|
||||
else if (strcmp(confname, "soft_load") == 0)
|
||||
soft = 1;
|
||||
/* Load a dynamic PROVIDER */
|
||||
else if (strcmp(confname, "module") == 0)
|
||||
path = confvalue;
|
||||
else if (strcmp(confname, "activate") == 0)
|
||||
activate = 1;
|
||||
}
|
||||
|
||||
prov = ossl_provider_new(libctx, name, NULL);
|
||||
if (prov == NULL) {
|
||||
if (soft)
|
||||
ERR_clear_error();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (path != NULL)
|
||||
ossl_provider_set_module_path(prov, path);
|
||||
|
||||
ok = provider_conf_params(prov, NULL, value, cnf);
|
||||
|
||||
if (ok && activate) {
|
||||
if (!ossl_provider_activate(prov)) {
|
||||
ok = 0;
|
||||
} else {
|
||||
if (activated_providers == NULL)
|
||||
activated_providers = sk_OSSL_PROVIDER_new_null();
|
||||
sk_OSSL_PROVIDER_push(activated_providers, prov);
|
||||
ok = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(activate && ok))
|
||||
ossl_provider_free(prov);
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
static int provider_conf_init(CONF_IMODULE *md, const CONF *cnf)
|
||||
{
|
||||
STACK_OF(CONF_VALUE) *elist;
|
||||
CONF_VALUE *cval;
|
||||
int i;
|
||||
|
||||
OSSL_TRACE1(CONF, "Loading providers module: section %s\n",
|
||||
CONF_imodule_get_value(md));
|
||||
|
||||
/* Value is a section containing PROVIDERs to configure */
|
||||
elist = NCONF_get_section(cnf, CONF_imodule_get_value(md));
|
||||
|
||||
if (!elist) {
|
||||
CRYPTOerr(CRYPTO_F_PROVIDER_CONF_INIT,
|
||||
CRYPTO_R_PROVIDER_SECTION_ERROR);
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < sk_CONF_VALUE_num(elist); i++) {
|
||||
cval = sk_CONF_VALUE_value(elist, i);
|
||||
if (!provider_conf_load(NULL, cval->name, cval->value, cnf))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static void provider_conf_deinit(CONF_IMODULE *md)
|
||||
{
|
||||
sk_OSSL_PROVIDER_pop_free(activated_providers, ossl_provider_free);
|
||||
activated_providers = NULL;
|
||||
OSSL_TRACE(CONF, "Cleaned up providers\n");
|
||||
}
|
||||
|
||||
void ossl_provider_add_conf_module(void)
|
||||
{
|
||||
OSSL_TRACE(CONF, "Adding config module 'providers'\n");
|
||||
CONF_module_add("providers", provider_conf_init, provider_conf_deinit);
|
||||
}
|
||||
+81
-21
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <openssl/core.h>
|
||||
#include <openssl/core_numbers.h>
|
||||
#include <openssl/params.h>
|
||||
#include <openssl/opensslv.h>
|
||||
#include "internal/cryptlib.h"
|
||||
#include "internal/nelem.h"
|
||||
@@ -25,6 +26,12 @@ static OSSL_PROVIDER *provider_new(const char *name,
|
||||
* =========================
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
char *value;
|
||||
} INFOPAIR;
|
||||
DEFINE_STACK_OF(INFOPAIR)
|
||||
|
||||
struct provider_store_st; /* Forward declaration */
|
||||
|
||||
struct ossl_provider_st {
|
||||
@@ -36,8 +43,10 @@ struct ossl_provider_st {
|
||||
CRYPTO_REF_COUNT refcnt;
|
||||
CRYPTO_RWLOCK *refcnt_lock; /* For the ref counter */
|
||||
char *name;
|
||||
char *path;
|
||||
DSO *module;
|
||||
OSSL_provider_init_fn *init_function;
|
||||
STACK_OF(INFOPAIR) *parameters;
|
||||
struct provider_store_st *store; /* The store this instance belongs to */
|
||||
|
||||
/* Provider side functions */
|
||||
@@ -243,6 +252,13 @@ OSSL_PROVIDER *ossl_provider_new(OPENSSL_CTX *libctx, const char *name,
|
||||
return prov;
|
||||
}
|
||||
|
||||
static void free_infopair(INFOPAIR *pair)
|
||||
{
|
||||
OPENSSL_free(pair->name);
|
||||
OPENSSL_free(pair->value);
|
||||
OPENSSL_free(pair);
|
||||
}
|
||||
|
||||
void ossl_provider_free(OSSL_PROVIDER *prov)
|
||||
{
|
||||
if (prov != NULL) {
|
||||
@@ -270,6 +286,8 @@ void ossl_provider_free(OSSL_PROVIDER *prov)
|
||||
if (ref == 0) {
|
||||
DSO_free(prov->module);
|
||||
OPENSSL_free(prov->name);
|
||||
OPENSSL_free(prov->path);
|
||||
sk_INFOPAIR_pop_free(prov->parameters, free_infopair);
|
||||
#ifndef HAVE_ATOMICS
|
||||
CRYPTO_THREAD_lock_free(prov->refcnt_lock);
|
||||
#endif
|
||||
@@ -278,6 +296,40 @@ void ossl_provider_free(OSSL_PROVIDER *prov)
|
||||
}
|
||||
}
|
||||
|
||||
/* Setters */
|
||||
int ossl_provider_set_module_path(OSSL_PROVIDER *prov, const char *module_path)
|
||||
{
|
||||
OPENSSL_free(prov->path);
|
||||
if (module_path == NULL)
|
||||
return 1;
|
||||
if ((prov->path = OPENSSL_strdup(module_path)) != NULL)
|
||||
return 1;
|
||||
CRYPTOerr(CRYPTO_F_OSSL_PROVIDER_SET_MODULE_PATH, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ossl_provider_add_parameter(OSSL_PROVIDER *prov,
|
||||
const char *name, const char *value)
|
||||
{
|
||||
INFOPAIR *pair = NULL;
|
||||
|
||||
if ((pair = OPENSSL_zalloc(sizeof(*pair))) != NULL
|
||||
&& (prov->parameters != NULL
|
||||
|| (prov->parameters = sk_INFOPAIR_new_null()) != NULL)
|
||||
&& (pair->name = OPENSSL_strdup(name)) != NULL
|
||||
&& (pair->value = OPENSSL_strdup(value)) != NULL
|
||||
&& sk_INFOPAIR_push(prov->parameters, pair) > 0)
|
||||
return 1;
|
||||
|
||||
if (pair != NULL) {
|
||||
OPENSSL_free(pair->name);
|
||||
OPENSSL_free(pair->value);
|
||||
OPENSSL_free(pair);
|
||||
}
|
||||
CRYPTOerr(CRYPTO_F_OSSL_PROVIDER_ADD_PARAMETER, ERR_R_MALLOC_FAILURE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Provider activation.
|
||||
*
|
||||
@@ -310,8 +362,9 @@ static int provider_activate(OSSL_PROVIDER *prov)
|
||||
*/
|
||||
if (prov->init_function == NULL) {
|
||||
if (prov->module == NULL) {
|
||||
char *platform_module_name = NULL;
|
||||
char *module_path = NULL;
|
||||
char *allocated_path = NULL;
|
||||
const char *module_path = NULL;
|
||||
char *merged_path = NULL;
|
||||
const char *load_dir = ossl_safe_getenv("OPENSSL_MODULES");
|
||||
|
||||
if ((prov->module = DSO_new()) == NULL) {
|
||||
@@ -324,19 +377,22 @@ static int provider_activate(OSSL_PROVIDER *prov)
|
||||
|
||||
DSO_ctrl(prov->module, DSO_CTRL_SET_FLAGS,
|
||||
DSO_FLAG_NAME_TRANSLATION_EXT_ONLY, NULL);
|
||||
if ((platform_module_name =
|
||||
DSO_convert_filename(prov->module, prov->name)) == NULL
|
||||
|| (module_path =
|
||||
DSO_merge(prov->module, platform_module_name,
|
||||
load_dir)) == NULL
|
||||
|| DSO_load(prov->module, module_path, NULL,
|
||||
DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == NULL) {
|
||||
|
||||
module_path = prov->path;
|
||||
if (module_path == NULL)
|
||||
module_path = allocated_path =
|
||||
DSO_convert_filename(prov->module, prov->name);
|
||||
if (module_path != NULL)
|
||||
merged_path = DSO_merge(prov->module, module_path, load_dir);
|
||||
|
||||
if (merged_path == NULL
|
||||
|| (DSO_load(prov->module, merged_path, NULL, 0)) == NULL) {
|
||||
DSO_free(prov->module);
|
||||
prov->module = NULL;
|
||||
}
|
||||
|
||||
OPENSSL_free(platform_module_name);
|
||||
OPENSSL_free(module_path);
|
||||
OPENSSL_free(merged_path);
|
||||
OPENSSL_free(allocated_path);
|
||||
}
|
||||
|
||||
if (prov->module != NULL)
|
||||
@@ -565,17 +621,21 @@ static const OSSL_ITEM *core_get_param_types(const OSSL_PROVIDER *prov)
|
||||
static int core_get_params(const OSSL_PROVIDER *prov, const OSSL_PARAM params[])
|
||||
{
|
||||
int i;
|
||||
const OSSL_PARAM *p;
|
||||
|
||||
for (i = 0; params[i].key != NULL; i++) {
|
||||
if (strcmp(params[i].key, "openssl-version") == 0) {
|
||||
*(void **)params[i].data = OPENSSL_VERSION_STR;
|
||||
if (params[i].return_size)
|
||||
*params[i].return_size = sizeof(OPENSSL_VERSION_STR);
|
||||
} else if (strcmp(params[i].key, "provider-name") == 0) {
|
||||
*(void **)params[i].data = prov->name;
|
||||
if (params[i].return_size)
|
||||
*params[i].return_size = strlen(prov->name) + 1;
|
||||
}
|
||||
if ((p = OSSL_PARAM_locate(params, "openssl-version")) != NULL)
|
||||
OSSL_PARAM_set_utf8_ptr(p, OPENSSL_VERSION_STR);
|
||||
if ((p = OSSL_PARAM_locate(params, "provider-name")) != NULL)
|
||||
OSSL_PARAM_set_utf8_ptr(p, prov->name);
|
||||
|
||||
if (prov->parameters == NULL)
|
||||
return 1;
|
||||
|
||||
for (i = 0; i < sk_INFOPAIR_num(prov->parameters); i++) {
|
||||
INFOPAIR *pair = sk_INFOPAIR_value(prov->parameters, i);
|
||||
|
||||
if ((p = OSSL_PARAM_locate(params, pair->name)) != NULL)
|
||||
OSSL_PARAM_set_utf8_ptr(p, pair->value);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -422,6 +422,11 @@ int drbg_ctr_init(RAND_DRBG *drbg)
|
||||
drbg->max_perslen = DRBG_MAX_LENGTH;
|
||||
drbg->max_adinlen = DRBG_MAX_LENGTH;
|
||||
} else {
|
||||
#ifdef FIPS_MODE
|
||||
RANDerr(RAND_F_DRBG_CTR_INIT,
|
||||
RAND_R_DERIVATION_FUNCTION_MANDATORY_FOR_FIPS);
|
||||
return 0;
|
||||
#else
|
||||
drbg->min_entropylen = drbg->seedlen;
|
||||
drbg->max_entropylen = drbg->seedlen;
|
||||
/* Nonce not used */
|
||||
@@ -429,6 +434,7 @@ int drbg_ctr_init(RAND_DRBG *drbg)
|
||||
drbg->max_noncelen = 0;
|
||||
drbg->max_perslen = drbg->seedlen;
|
||||
drbg->max_adinlen = drbg->seedlen;
|
||||
#endif
|
||||
}
|
||||
|
||||
drbg->max_request = 1 << 16;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Generated by util/mkerr.pl DO NOT EDIT
|
||||
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
static const ERR_STRING_DATA RAND_str_functs[] = {
|
||||
{ERR_PACK(ERR_LIB_RAND, RAND_F_DRBG_BYTES, 0), "drbg_bytes"},
|
||||
{ERR_PACK(ERR_LIB_RAND, RAND_F_DRBG_CTR_INIT, 0), "drbg_ctr_init"},
|
||||
{ERR_PACK(ERR_LIB_RAND, RAND_F_DRBG_GET_ENTROPY, 0), "drbg_get_entropy"},
|
||||
{ERR_PACK(ERR_LIB_RAND, RAND_F_DRBG_SETUP, 0), "drbg_setup"},
|
||||
{ERR_PACK(ERR_LIB_RAND, RAND_F_GET_ENTROPY, 0), "get_entropy"},
|
||||
@@ -60,6 +61,8 @@ static const ERR_STRING_DATA RAND_str_reasons[] = {
|
||||
{ERR_PACK(ERR_LIB_RAND, 0, RAND_R_ARGUMENT_OUT_OF_RANGE),
|
||||
"argument out of range"},
|
||||
{ERR_PACK(ERR_LIB_RAND, 0, RAND_R_CANNOT_OPEN_FILE), "Cannot open file"},
|
||||
{ERR_PACK(ERR_LIB_RAND, 0, RAND_R_DERIVATION_FUNCTION_MANDATORY_FOR_FIPS),
|
||||
"derivation function mandatory for fips"},
|
||||
{ERR_PACK(ERR_LIB_RAND, 0, RAND_R_DRBG_ALREADY_INITIALIZED),
|
||||
"drbg already initialized"},
|
||||
{ERR_PACK(ERR_LIB_RAND, 0, RAND_R_DRBG_NOT_INITIALISED),
|
||||
|
||||
@@ -183,17 +183,6 @@ size_t rand_drbg_get_entropy(RAND_DRBG *drbg,
|
||||
}
|
||||
|
||||
} else {
|
||||
if (prediction_resistance) {
|
||||
/*
|
||||
* We don't have any entropy sources that comply with the NIST
|
||||
* standard to provide prediction resistance (see NIST SP 800-90C,
|
||||
* Section 5.4).
|
||||
*/
|
||||
RANDerr(RAND_F_RAND_DRBG_GET_ENTROPY,
|
||||
RAND_R_PREDICTION_RESISTANCE_NOT_SUPPORTED);
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Get entropy by polling system entropy sources. */
|
||||
entropy_available = rand_pool_acquire_entropy(pool);
|
||||
}
|
||||
@@ -203,7 +192,6 @@ size_t rand_drbg_get_entropy(RAND_DRBG *drbg,
|
||||
*pout = rand_pool_detach(pool);
|
||||
}
|
||||
|
||||
err:
|
||||
if (drbg->seed_pool == NULL)
|
||||
rand_pool_free(pool);
|
||||
return ret;
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
# endif
|
||||
|
||||
# include <windows.h>
|
||||
/* On Windows 7 or higher use BCrypt instead of the legacy CryptoAPI */
|
||||
# if defined(_MSC_VER) && defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0601
|
||||
/* On Windows Vista or higher use BCrypt instead of the legacy CryptoAPI */
|
||||
# if defined(_MSC_VER) && defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600
|
||||
# define USE_BCRYPTGENRANDOM
|
||||
# endif
|
||||
|
||||
|
||||
@@ -583,10 +583,12 @@ static RSA_PSS_PARAMS *rsa_ctx_to_pss(EVP_PKEY_CTX *pkctx)
|
||||
return NULL;
|
||||
if (saltlen == -1) {
|
||||
saltlen = EVP_MD_size(sigmd);
|
||||
} else if (saltlen == -2) {
|
||||
} else if (saltlen == -2 || saltlen == -3) {
|
||||
saltlen = EVP_PKEY_size(pk) - EVP_MD_size(sigmd) - 2;
|
||||
if ((EVP_PKEY_bits(pk) & 0x7) == 1)
|
||||
saltlen--;
|
||||
if (saltlen < 0)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return rsa_pss_params_create(sigmd, mgf1md, saltlen);
|
||||
|
||||
+88
-88
@@ -152,17 +152,17 @@ static int parse_env(struct OPENSSL_s390xcap_st *cap)
|
||||
* Facility detection would fail on real hw (no STFLE).
|
||||
*/
|
||||
static const struct OPENSSL_s390xcap_st z900 = {
|
||||
.stfle = {0ULL, 0ULL, 0ULL, 0ULL},
|
||||
.kimd = {0ULL, 0ULL},
|
||||
.klmd = {0ULL, 0ULL},
|
||||
.km = {0ULL, 0ULL},
|
||||
.kmc = {0ULL, 0ULL},
|
||||
.kmac = {0ULL, 0ULL},
|
||||
.kmctr = {0ULL, 0ULL},
|
||||
.kmo = {0ULL, 0ULL},
|
||||
.kmf = {0ULL, 0ULL},
|
||||
.prno = {0ULL, 0ULL},
|
||||
.kma = {0ULL, 0ULL},
|
||||
/*.stfle = */{0ULL, 0ULL, 0ULL, 0ULL},
|
||||
/*.kimd = */{0ULL, 0ULL},
|
||||
/*.klmd = */{0ULL, 0ULL},
|
||||
/*.km = */{0ULL, 0ULL},
|
||||
/*.kmc = */{0ULL, 0ULL},
|
||||
/*.kmac = */{0ULL, 0ULL},
|
||||
/*.kmctr = */{0ULL, 0ULL},
|
||||
/*.kmo = */{0ULL, 0ULL},
|
||||
/*.kmf = */{0ULL, 0ULL},
|
||||
/*.prno = */{0ULL, 0ULL},
|
||||
/*.kma = */{0ULL, 0ULL},
|
||||
};
|
||||
|
||||
/*-
|
||||
@@ -170,25 +170,25 @@ static int parse_env(struct OPENSSL_s390xcap_st *cap)
|
||||
* Implements MSA. Facility detection would fail on real hw (no STFLE).
|
||||
*/
|
||||
static const struct OPENSSL_s390xcap_st z990 = {
|
||||
.stfle = {S390X_CAPBIT(S390X_MSA),
|
||||
/*.stfle = */{S390X_CAPBIT(S390X_MSA),
|
||||
0ULL, 0ULL, 0ULL},
|
||||
.kimd = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kimd = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_SHA_1),
|
||||
0ULL},
|
||||
.klmd = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.klmd = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_SHA_1),
|
||||
0ULL},
|
||||
.km = {S390X_CAPBIT(S390X_QUERY),
|
||||
/*.km = */{S390X_CAPBIT(S390X_QUERY),
|
||||
0ULL},
|
||||
.kmc = {S390X_CAPBIT(S390X_QUERY),
|
||||
/*.kmc = */{S390X_CAPBIT(S390X_QUERY),
|
||||
0ULL},
|
||||
.kmac = {S390X_CAPBIT(S390X_QUERY),
|
||||
/*.kmac = */{S390X_CAPBIT(S390X_QUERY),
|
||||
0ULL},
|
||||
.kmctr = {0ULL, 0ULL},
|
||||
.kmo = {0ULL, 0ULL},
|
||||
.kmf = {0ULL, 0ULL},
|
||||
.prno = {0ULL, 0ULL},
|
||||
.kma = {0ULL, 0ULL},
|
||||
/*.kmctr = */{0ULL, 0ULL},
|
||||
/*.kmo = */{0ULL, 0ULL},
|
||||
/*.kmf = */{0ULL, 0ULL},
|
||||
/*.prno = */{0ULL, 0ULL},
|
||||
/*.kma = */{0ULL, 0ULL},
|
||||
};
|
||||
|
||||
/*-
|
||||
@@ -196,30 +196,30 @@ static int parse_env(struct OPENSSL_s390xcap_st *cap)
|
||||
* Implements MSA and MSA1.
|
||||
*/
|
||||
static const struct OPENSSL_s390xcap_st z9 = {
|
||||
.stfle = {S390X_CAPBIT(S390X_MSA)
|
||||
/*.stfle = */{S390X_CAPBIT(S390X_MSA)
|
||||
| S390X_CAPBIT(S390X_STCKF),
|
||||
0ULL, 0ULL, 0ULL},
|
||||
.kimd = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kimd = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_SHA_1)
|
||||
| S390X_CAPBIT(S390X_SHA_256),
|
||||
0ULL},
|
||||
.klmd = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.klmd = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_SHA_1)
|
||||
| S390X_CAPBIT(S390X_SHA_256),
|
||||
0ULL},
|
||||
.km = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.km = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128),
|
||||
0ULL},
|
||||
.kmc = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmc = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128),
|
||||
0ULL},
|
||||
.kmac = {S390X_CAPBIT(S390X_QUERY),
|
||||
/*.kmac = */{S390X_CAPBIT(S390X_QUERY),
|
||||
0ULL},
|
||||
.kmctr = {0ULL, 0ULL},
|
||||
.kmo = {0ULL, 0ULL},
|
||||
.kmf = {0ULL, 0ULL},
|
||||
.prno = {0ULL, 0ULL},
|
||||
.kma = {0ULL, 0ULL},
|
||||
/*.kmctr = */{0ULL, 0ULL},
|
||||
/*.kmo = */{0ULL, 0ULL},
|
||||
/*.kmf = */{0ULL, 0ULL},
|
||||
/*.prno = */{0ULL, 0ULL},
|
||||
/*.kma = */{0ULL, 0ULL},
|
||||
};
|
||||
|
||||
/*-
|
||||
@@ -227,36 +227,36 @@ static int parse_env(struct OPENSSL_s390xcap_st *cap)
|
||||
* Implements MSA and MSA1-2.
|
||||
*/
|
||||
static const struct OPENSSL_s390xcap_st z10 = {
|
||||
.stfle = {S390X_CAPBIT(S390X_MSA)
|
||||
/*.stfle = */{S390X_CAPBIT(S390X_MSA)
|
||||
| S390X_CAPBIT(S390X_STCKF),
|
||||
0ULL, 0ULL, 0ULL},
|
||||
.kimd = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kimd = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_SHA_1)
|
||||
| S390X_CAPBIT(S390X_SHA_256)
|
||||
| S390X_CAPBIT(S390X_SHA_512),
|
||||
0ULL},
|
||||
.klmd = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.klmd = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_SHA_1)
|
||||
| S390X_CAPBIT(S390X_SHA_256)
|
||||
| S390X_CAPBIT(S390X_SHA_512),
|
||||
0ULL},
|
||||
.km = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.km = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.kmc = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmc = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.kmac = {S390X_CAPBIT(S390X_QUERY),
|
||||
/*.kmac = */{S390X_CAPBIT(S390X_QUERY),
|
||||
0ULL},
|
||||
.kmctr = {0ULL, 0ULL},
|
||||
.kmo = {0ULL, 0ULL},
|
||||
.kmf = {0ULL, 0ULL},
|
||||
.prno = {0ULL, 0ULL},
|
||||
.kma = {0ULL, 0ULL},
|
||||
/*.kmctr = */{0ULL, 0ULL},
|
||||
/*.kmo = */{0ULL, 0ULL},
|
||||
/*.kmf = */{0ULL, 0ULL},
|
||||
/*.prno = */{0ULL, 0ULL},
|
||||
/*.kma = */{0ULL, 0ULL},
|
||||
};
|
||||
|
||||
/*-
|
||||
@@ -264,55 +264,55 @@ static int parse_env(struct OPENSSL_s390xcap_st *cap)
|
||||
* Implements MSA and MSA1-4.
|
||||
*/
|
||||
static const struct OPENSSL_s390xcap_st z196 = {
|
||||
.stfle = {S390X_CAPBIT(S390X_MSA)
|
||||
/*.stfle = */{S390X_CAPBIT(S390X_MSA)
|
||||
| S390X_CAPBIT(S390X_STCKF),
|
||||
S390X_CAPBIT(S390X_MSA3)
|
||||
| S390X_CAPBIT(S390X_MSA4),
|
||||
0ULL, 0ULL},
|
||||
.kimd = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kimd = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_SHA_1)
|
||||
| S390X_CAPBIT(S390X_SHA_256)
|
||||
| S390X_CAPBIT(S390X_SHA_512),
|
||||
S390X_CAPBIT(S390X_GHASH)},
|
||||
.klmd = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.klmd = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_SHA_1)
|
||||
| S390X_CAPBIT(S390X_SHA_256)
|
||||
| S390X_CAPBIT(S390X_SHA_512),
|
||||
0ULL},
|
||||
.km = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.km = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256)
|
||||
| S390X_CAPBIT(S390X_XTS_AES_128)
|
||||
| S390X_CAPBIT(S390X_XTS_AES_256),
|
||||
0ULL},
|
||||
.kmc = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmc = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.kmac = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmac = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.kmctr = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmctr = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.kmo = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmo = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.kmf = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmf = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.prno = {0ULL, 0ULL},
|
||||
.kma = {0ULL, 0ULL},
|
||||
/*.prno = */{0ULL, 0ULL},
|
||||
/*.kma = */{0ULL, 0ULL},
|
||||
};
|
||||
|
||||
/*-
|
||||
@@ -320,55 +320,55 @@ static int parse_env(struct OPENSSL_s390xcap_st *cap)
|
||||
* Implements MSA and MSA1-4.
|
||||
*/
|
||||
static const struct OPENSSL_s390xcap_st zEC12 = {
|
||||
.stfle = {S390X_CAPBIT(S390X_MSA)
|
||||
/*.stfle = */{S390X_CAPBIT(S390X_MSA)
|
||||
| S390X_CAPBIT(S390X_STCKF),
|
||||
S390X_CAPBIT(S390X_MSA3)
|
||||
| S390X_CAPBIT(S390X_MSA4),
|
||||
0ULL, 0ULL},
|
||||
.kimd = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kimd = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_SHA_1)
|
||||
| S390X_CAPBIT(S390X_SHA_256)
|
||||
| S390X_CAPBIT(S390X_SHA_512),
|
||||
S390X_CAPBIT(S390X_GHASH)},
|
||||
.klmd = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.klmd = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_SHA_1)
|
||||
| S390X_CAPBIT(S390X_SHA_256)
|
||||
| S390X_CAPBIT(S390X_SHA_512),
|
||||
0ULL},
|
||||
.km = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.km = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256)
|
||||
| S390X_CAPBIT(S390X_XTS_AES_128)
|
||||
| S390X_CAPBIT(S390X_XTS_AES_256),
|
||||
0ULL},
|
||||
.kmc = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmc = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.kmac = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmac = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.kmctr = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmctr = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.kmo = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmo = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.kmf = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmf = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.prno = {0ULL, 0ULL},
|
||||
.kma = {0ULL, 0ULL},
|
||||
/*.prno = */{0ULL, 0ULL},
|
||||
/*.kma = */{0ULL, 0ULL},
|
||||
};
|
||||
|
||||
/*-
|
||||
@@ -376,59 +376,59 @@ static int parse_env(struct OPENSSL_s390xcap_st *cap)
|
||||
* Implements MSA and MSA1-5.
|
||||
*/
|
||||
static const struct OPENSSL_s390xcap_st z13 = {
|
||||
.stfle = {S390X_CAPBIT(S390X_MSA)
|
||||
/*.stfle = */{S390X_CAPBIT(S390X_MSA)
|
||||
| S390X_CAPBIT(S390X_STCKF)
|
||||
| S390X_CAPBIT(S390X_MSA5),
|
||||
S390X_CAPBIT(S390X_MSA3)
|
||||
| S390X_CAPBIT(S390X_MSA4),
|
||||
S390X_CAPBIT(S390X_VX),
|
||||
0ULL},
|
||||
.kimd = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kimd = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_SHA_1)
|
||||
| S390X_CAPBIT(S390X_SHA_256)
|
||||
| S390X_CAPBIT(S390X_SHA_512),
|
||||
S390X_CAPBIT(S390X_GHASH)},
|
||||
.klmd = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.klmd = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_SHA_1)
|
||||
| S390X_CAPBIT(S390X_SHA_256)
|
||||
| S390X_CAPBIT(S390X_SHA_512),
|
||||
0ULL},
|
||||
.km = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.km = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256)
|
||||
| S390X_CAPBIT(S390X_XTS_AES_128)
|
||||
| S390X_CAPBIT(S390X_XTS_AES_256),
|
||||
0ULL},
|
||||
.kmc = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmc = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.kmac = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmac = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.kmctr = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmctr = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.kmo = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmo = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.kmf = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmf = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.prno = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.prno = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_SHA_512_DRNG),
|
||||
0ULL},
|
||||
.kma = {0ULL, 0ULL},
|
||||
/*.kma = */{0ULL, 0ULL},
|
||||
};
|
||||
|
||||
/*-
|
||||
@@ -436,7 +436,7 @@ static int parse_env(struct OPENSSL_s390xcap_st *cap)
|
||||
* Implements MSA and MSA1-8.
|
||||
*/
|
||||
static const struct OPENSSL_s390xcap_st z14 = {
|
||||
.stfle = {S390X_CAPBIT(S390X_MSA)
|
||||
/*.stfle = */{S390X_CAPBIT(S390X_MSA)
|
||||
| S390X_CAPBIT(S390X_STCKF)
|
||||
| S390X_CAPBIT(S390X_MSA5),
|
||||
S390X_CAPBIT(S390X_MSA3)
|
||||
@@ -446,7 +446,7 @@ static int parse_env(struct OPENSSL_s390xcap_st *cap)
|
||||
| S390X_CAPBIT(S390X_VXE)
|
||||
| S390X_CAPBIT(S390X_MSA8),
|
||||
0ULL},
|
||||
.kimd = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kimd = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_SHA_1)
|
||||
| S390X_CAPBIT(S390X_SHA_256)
|
||||
| S390X_CAPBIT(S390X_SHA_512)
|
||||
@@ -457,7 +457,7 @@ static int parse_env(struct OPENSSL_s390xcap_st *cap)
|
||||
| S390X_CAPBIT(S390X_SHAKE_128)
|
||||
| S390X_CAPBIT(S390X_SHAKE_256),
|
||||
S390X_CAPBIT(S390X_GHASH)},
|
||||
.klmd = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.klmd = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_SHA_1)
|
||||
| S390X_CAPBIT(S390X_SHA_256)
|
||||
| S390X_CAPBIT(S390X_SHA_512)
|
||||
@@ -468,42 +468,42 @@ static int parse_env(struct OPENSSL_s390xcap_st *cap)
|
||||
| S390X_CAPBIT(S390X_SHAKE_128)
|
||||
| S390X_CAPBIT(S390X_SHAKE_256),
|
||||
0ULL},
|
||||
.km = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.km = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256)
|
||||
| S390X_CAPBIT(S390X_XTS_AES_128)
|
||||
| S390X_CAPBIT(S390X_XTS_AES_256),
|
||||
0ULL},
|
||||
.kmc = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmc = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.kmac = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmac = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.kmctr = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmctr = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.kmo = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmo = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.kmf = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kmf = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
0ULL},
|
||||
.prno = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.prno = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_SHA_512_DRNG),
|
||||
S390X_CAPBIT(S390X_TRNG)},
|
||||
.kma = {S390X_CAPBIT(S390X_QUERY)
|
||||
/*.kma = */{S390X_CAPBIT(S390X_QUERY)
|
||||
| S390X_CAPBIT(S390X_AES_128)
|
||||
| S390X_CAPBIT(S390X_AES_192)
|
||||
| S390X_CAPBIT(S390X_AES_256),
|
||||
|
||||
@@ -3,6 +3,8 @@ SOURCE[../../libcrypto]=\
|
||||
sha1dgst.c sha1_one.c sha256.c sha512.c {- $target{sha1_asm_src} -} \
|
||||
{- $target{keccak1600_asm_src} -}
|
||||
|
||||
SOURCE[../../providers/fips]= sha256.c
|
||||
|
||||
GENERATE[sha1-586.s]=asm/sha1-586.pl \
|
||||
$(PERLASM_SCHEME) $(LIB_CFLAGS) $(LIB_CPPFLAGS) $(PROCESSOR)
|
||||
DEPEND[sha1-586.s]=../perlasm/x86asm.pl
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ static const struct trace_category_st trace_categories[] = {
|
||||
TRACE_CATEGORY_(INIT),
|
||||
TRACE_CATEGORY_(TLS),
|
||||
TRACE_CATEGORY_(TLS_CIPHER),
|
||||
TRACE_CATEGORY_(ENGINE_CONF),
|
||||
TRACE_CATEGORY_(CONF),
|
||||
TRACE_CATEGORY_(ENGINE_TABLE),
|
||||
TRACE_CATEGORY_(ENGINE_REF_COUNT),
|
||||
TRACE_CATEGORY_(PKCS5V2),
|
||||
|
||||
@@ -297,6 +297,9 @@ int X509_STORE_CTX_get_by_subject(X509_STORE_CTX *vs, X509_LOOKUP_TYPE type,
|
||||
if (ctx == NULL)
|
||||
return 0;
|
||||
|
||||
stmp.type = X509_LU_NONE;
|
||||
stmp.data.ptr = NULL;
|
||||
|
||||
CRYPTO_THREAD_write_lock(ctx->lock);
|
||||
tmp = X509_OBJECT_retrieve_by_subject(ctx->objs, type, name);
|
||||
CRYPTO_THREAD_unlock(ctx->lock);
|
||||
|
||||
+4
-1
@@ -72,7 +72,10 @@ static int x509_verify_sm2(X509 *x, EVP_PKEY *pkey, int mdnid, int pknid)
|
||||
ret = 0;
|
||||
goto err;
|
||||
}
|
||||
if (EVP_PKEY_CTX_set1_id(pctx, x->sm2_id.data, x->sm2_id.length) != 1) {
|
||||
/* NOTE: we tolerate no actual ID, to provide maximum flexibility */
|
||||
if (x->sm2_id != NULL
|
||||
&& EVP_PKEY_CTX_set1_id(pctx, x->sm2_id->data,
|
||||
x->sm2_id->length) != 1) {
|
||||
X509err(X509_F_X509_VERIFY_SM2, ERR_R_EVP_LIB);
|
||||
ret = 0;
|
||||
goto err;
|
||||
|
||||
+10
-3
@@ -72,6 +72,9 @@ static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
|
||||
#ifndef OPENSSL_NO_RFC3779
|
||||
ret->rfc3779_addr = NULL;
|
||||
ret->rfc3779_asid = NULL;
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SM2
|
||||
ret->sm2_id = NULL;
|
||||
#endif
|
||||
ret->aux = NULL;
|
||||
ret->crldp = NULL;
|
||||
@@ -91,6 +94,9 @@ static int x509_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
|
||||
#ifndef OPENSSL_NO_RFC3779
|
||||
sk_IPAddressFamily_pop_free(ret->rfc3779_addr, IPAddressFamily_free);
|
||||
ASIdentifiers_free(ret->rfc3779_asid);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SM2
|
||||
ASN1_OCTET_STRING_free(ret->sm2_id);
|
||||
#endif
|
||||
break;
|
||||
|
||||
@@ -246,13 +252,14 @@ int X509_get_signature_nid(const X509 *x)
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_SM2
|
||||
void X509_set_sm2_id(X509 *x, ASN1_OCTET_STRING *sm2_id)
|
||||
void X509_set0_sm2_id(X509 *x, ASN1_OCTET_STRING *sm2_id)
|
||||
{
|
||||
x->sm2_id = *sm2_id;
|
||||
ASN1_OCTET_STRING_free(x->sm2_id);
|
||||
x->sm2_id = sm2_id;
|
||||
}
|
||||
|
||||
ASN1_OCTET_STRING *X509_get0_sm2_id(X509 *x)
|
||||
{
|
||||
return &x->sm2_id;
|
||||
return x->sm2_id;
|
||||
}
|
||||
#endif
|
||||
@@ -14,7 +14,8 @@ evp_generic_fetch - generic algorithm fetcher and method creator for EVP
|
||||
void *(*new_method)(int nid, const OSSL_DISPATCH *fns,
|
||||
OSSL_PROVIDER *prov),
|
||||
int (*upref_method)(void *),
|
||||
void (*free_method)(void *));
|
||||
void (*free_method)(void *),
|
||||
int (*nid_method)(void *));
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
@@ -41,6 +42,10 @@ one.
|
||||
|
||||
frees the given method.
|
||||
|
||||
=item nid_method()
|
||||
|
||||
returns the nid associated with the given method.
|
||||
|
||||
=back
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
@@ -21,8 +21,8 @@ OSSL_METHOD_CONSTRUCT_METHOD, ossl_method_construct
|
||||
int (*put)(OPENSSL_CTX *libctx, void *store, const char *propdef,
|
||||
void *method, void *data);
|
||||
/* Construct a new method */
|
||||
void *(*construct)(const OSSL_DISPATCH *fns, OSSL_PROVIDER *prov,
|
||||
void *data);
|
||||
void *(*construct)(const char *algorithm_name, const OSSL_DISPATCH *fns,
|
||||
OSSL_PROVIDER *prov, void *data);
|
||||
/* Destruct a method */
|
||||
void (*destruct)(void *method);
|
||||
};
|
||||
@@ -107,7 +107,8 @@ This function is expected to increment the C<method>'s reference count.
|
||||
|
||||
=item construct()
|
||||
|
||||
Constructs a sub-system method given a dispatch table C<fns>.
|
||||
Constructs a sub-system method for the given C<algorithm_name> and the given
|
||||
dispatch table C<fns>.
|
||||
|
||||
The associated I<provider object> C<prov> is passed as well, to make
|
||||
it possible for the sub-system constructor to keep a reference, which
|
||||
|
||||
@@ -17,6 +17,7 @@ B<openssl ecparam>
|
||||
[B<-text>]
|
||||
[B<-C>]
|
||||
[B<-check>]
|
||||
[B<-check_named>]
|
||||
[B<-name arg>]
|
||||
[B<-list_curves>]
|
||||
[B<-conv_form arg>]
|
||||
@@ -79,6 +80,11 @@ be loaded by calling the get_ec_group_XXX() function.
|
||||
|
||||
Validate the elliptic curve parameters.
|
||||
|
||||
=item B<-check_named>
|
||||
|
||||
Validate the elliptic name curve parameters by checking if the curve parameters
|
||||
match any built-in curves.
|
||||
|
||||
=item B<-name arg>
|
||||
|
||||
Use the EC parameters with the specified 'short' name. Use B<-list_curves>
|
||||
|
||||
@@ -88,6 +88,7 @@ B<openssl> B<ocsp>
|
||||
[B<-ndays n>]
|
||||
[B<-resp_key_id>]
|
||||
[B<-nrequest n>]
|
||||
[B<-rcid I<digest>>]
|
||||
[B<-I<digest>>]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
@@ -304,6 +305,12 @@ status information is immediately available. In this case the age of the
|
||||
B<notBefore> field is checked to see it is not older than B<age> seconds old.
|
||||
By default this additional check is not performed.
|
||||
|
||||
=item B<-rcid I<digest>>
|
||||
|
||||
This option sets the digest algorithm to use for certificate identification
|
||||
in the OCSP response. Any digest supported by the OpenSSL B<dgst> command can
|
||||
be used. The default is the same digest algorithm used in the request.
|
||||
|
||||
=item B<-I<digest>>
|
||||
|
||||
This option sets digest algorithm to use for certificate identification in the
|
||||
|
||||
@@ -13,6 +13,7 @@ B<openssl speed>
|
||||
[B<-elapsed>]
|
||||
[B<-evp algo>]
|
||||
[B<-hmac algo>]
|
||||
[B<-cmac algo>]
|
||||
[B<-decrypt>]
|
||||
[B<-rand file...>]
|
||||
[B<-writerand file>]
|
||||
@@ -60,6 +61,10 @@ aes-128-cbc-hmac-sha1, then B<-mb> will time multi-buffer operation.
|
||||
|
||||
Time the HMAC algorithm using the specified message digest.
|
||||
|
||||
=item B<-cmac cipher>
|
||||
|
||||
Time the CMAC algorithm using the specified cipher e.g. B<speed -cmac aes128>.
|
||||
|
||||
=item B<-decrypt>
|
||||
|
||||
Time the decryption instead of encryption. Affects only the EVP testing.
|
||||
|
||||
@@ -95,19 +95,19 @@ B<INVALID_SOCKET> (-1) on error. When an error has occurred, the
|
||||
OpenSSL error stack will hold the error data and errno has the system
|
||||
error.
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
BIO_gethostname(), BIO_get_port(), BIO_get_host_ip(),
|
||||
BIO_get_accept_socket() and BIO_accept() were deprecated in
|
||||
OpenSSL 1.1.0. Use the functions described above instead.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<BIO_ADDR(3)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
BIO_gethostname(), BIO_get_port(), BIO_get_host_ip(),
|
||||
BIO_get_accept_socket() and BIO_accept() were deprecated in OpenSSL 1.1.0.
|
||||
Use the functions described above instead.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
+11
-4
@@ -5,7 +5,8 @@
|
||||
BIO_ctrl, BIO_callback_ctrl, BIO_ptr_ctrl, BIO_int_ctrl, BIO_reset,
|
||||
BIO_seek, BIO_tell, BIO_flush, BIO_eof, BIO_set_close, BIO_get_close,
|
||||
BIO_pending, BIO_wpending, BIO_ctrl_pending, BIO_ctrl_wpending,
|
||||
BIO_get_info_callback, BIO_set_info_callback, BIO_info_cb, BIO_get_ktls_send
|
||||
BIO_get_info_callback, BIO_set_info_callback, BIO_info_cb, BIO_get_ktls_send,
|
||||
BIO_get_ktls_recv
|
||||
- BIO control operations
|
||||
|
||||
=head1 SYNOPSIS
|
||||
@@ -35,6 +36,7 @@ BIO_get_info_callback, BIO_set_info_callback, BIO_info_cb, BIO_get_ktls_send
|
||||
int BIO_set_info_callback(BIO *b, BIO_info_cb *cb);
|
||||
|
||||
int BIO_get_ktls_send(BIO *b);
|
||||
int BIO_get_ktls_recv(BIO *b);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
@@ -74,8 +76,10 @@ Not all BIOs support these calls. BIO_ctrl_pending() and BIO_ctrl_wpending()
|
||||
return a size_t type and are functions, BIO_pending() and BIO_wpending() are
|
||||
macros which call BIO_ctrl().
|
||||
|
||||
BIO_get_ktls_send() return 1 if the BIO is using the Kernel TLS data-path for
|
||||
BIO_get_ktls_send() returns 1 if the BIO is using the Kernel TLS data-path for
|
||||
sending. Otherwise, it returns zero.
|
||||
BIO_get_ktls_recv() returns 1 if the BIO is using the Kernel TLS data-path for
|
||||
receiving. Otherwise, it returns zero.
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
@@ -97,8 +101,10 @@ BIO_get_close() returns the close flag value: BIO_CLOSE or BIO_NOCLOSE.
|
||||
BIO_pending(), BIO_ctrl_pending(), BIO_wpending() and BIO_ctrl_wpending()
|
||||
return the amount of pending data.
|
||||
|
||||
BIO_get_ktls_send() return 1 if the BIO is using the Kernel TLS data-path for
|
||||
BIO_get_ktls_send() returns 1 if the BIO is using the Kernel TLS data-path for
|
||||
sending. Otherwise, it returns zero.
|
||||
BIO_get_ktls_recv() returns 1 if the BIO is using the Kernel TLS data-path for
|
||||
receiving. Otherwise, it returns zero.
|
||||
|
||||
=head1 NOTES
|
||||
|
||||
@@ -134,7 +140,8 @@ the case of BIO_seek() on a file BIO for a successful operation.
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The BIO_get_ktls_send() function was added in OpenSSL 3.0.0.
|
||||
The BIO_get_ktls_send() and BIO_get_ktls_recv() functions were added in
|
||||
OpenSSL 3.0.0.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
|
||||
+10
-10
@@ -59,6 +59,15 @@ seeded with enough randomness to ensure an unpredictable byte sequence.
|
||||
The functions return 1 on success, 0 on error.
|
||||
The error codes can be obtained by L<ERR_get_error(3)>.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<ERR_get_error(3)>,
|
||||
L<RAND_add(3)>,
|
||||
L<RAND_bytes(3)>,
|
||||
L<RAND_priv_bytes(3)>,
|
||||
L<RAND(7)>,
|
||||
L<RAND_DRBG(7)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
=over 2
|
||||
@@ -78,18 +87,9 @@ BN_priv_rand() and BN_priv_rand_range() functions were added in OpenSSL 1.1.1.
|
||||
|
||||
=back
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<ERR_get_error(3)>,
|
||||
L<RAND_add(3)>,
|
||||
L<RAND_bytes(3)>,
|
||||
L<RAND_priv_bytes(3)>,
|
||||
L<RAND(7)>,
|
||||
L<RAND_DRBG(7)>
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -31,17 +31,17 @@ Number of security bits.
|
||||
ECC (Elliptic Curve Cryptography) is not covered by the BN_security_bits()
|
||||
function. The symmetric algorithms are not covered neither.
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The BN_security_bits() function was added in OpenSSL 1.1.0.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<DH_security_bits(3)>, L<DSA_security_bits(3)>, L<RSA_security_bits(3)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The BN_security_bits() function was added in OpenSSL 1.1.0.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -296,6 +296,11 @@ last 4 bytes of the checksum of the input.
|
||||
DES_fcrypt() returns a pointer to the caller-provided buffer and DES_crypt() -
|
||||
to a static buffer on success; otherwise they return NULL.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<des_modes(7)>,
|
||||
L<EVP_EncryptInit(3)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The requirement that the B<salt> parameter to DES_crypt() and DES_fcrypt()
|
||||
@@ -304,14 +309,9 @@ OpenSSL 1.1.0. Previous versions tried to use the letter uppercase B<A>
|
||||
if both character were not present, and could crash when given non-ASCII
|
||||
on some platforms.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<des_modes(7)>,
|
||||
L<EVP_EncryptInit(3)>
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -9,7 +9,8 @@ EC_GROUP_set_curve_name, EC_GROUP_get_curve_name, EC_GROUP_set_asn1_flag,
|
||||
EC_GROUP_get_asn1_flag, EC_GROUP_set_point_conversion_form,
|
||||
EC_GROUP_get_point_conversion_form, EC_GROUP_get0_seed,
|
||||
EC_GROUP_get_seed_len, EC_GROUP_set_seed, EC_GROUP_get_degree,
|
||||
EC_GROUP_check, EC_GROUP_check_discriminant, EC_GROUP_cmp,
|
||||
EC_GROUP_check, EC_GROUP_check_named_curve,
|
||||
EC_GROUP_check_discriminant, EC_GROUP_cmp,
|
||||
EC_GROUP_get_basis_type, EC_GROUP_get_trinomial_basis,
|
||||
EC_GROUP_get_pentanomial_basis, EC_GROUP_get0_field
|
||||
- Functions for manipulating EC_GROUP objects
|
||||
@@ -50,6 +51,7 @@ EC_GROUP_get_pentanomial_basis, EC_GROUP_get0_field
|
||||
int EC_GROUP_get_degree(const EC_GROUP *group);
|
||||
|
||||
int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx);
|
||||
int EC_GROUP_check_named_curve(const EC_GROUP *group, int nist_only);
|
||||
|
||||
int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx);
|
||||
|
||||
@@ -128,7 +130,7 @@ in that a parameter obtained in this way is highly unlikely to be susceptible to
|
||||
If the seed is present for a curve then the b parameter was generated in a verifiable fashion using that seed. The OpenSSL EC library
|
||||
does not use this seed value but does enable you to inspect it using EC_GROUP_get0_seed. This returns a pointer to a memory block
|
||||
containing the seed that was used. The length of the memory block can be obtained using EC_GROUP_get_seed_len. A number of the
|
||||
builtin curves within the library provide seed values that can be obtained. It is also possible to set a custom seed using
|
||||
built-in curves within the library provide seed values that can be obtained. It is also possible to set a custom seed using
|
||||
EC_GROUP_set_seed and passing a pointer to a memory block, along with the length of the seed. Again, the EC library will not use
|
||||
this seed value, although it will be preserved in any ASN1 based communications.
|
||||
|
||||
@@ -143,6 +145,14 @@ The function EC_GROUP_check performs a number of checks on a curve to verify tha
|
||||
verifying that the discriminant is non zero; that a generator has been defined; that the generator is on the curve and has
|
||||
the correct order.
|
||||
|
||||
The function EC_GROUP_check_named_curve determines if the group's domain parameters match one of the built-in curves supported by the library.
|
||||
The curve name is returned as a B<NID> if it matches. If the group's domain parameters have been modified then no match will be found.
|
||||
If the curve name of the given group is B<NID_undef> (e.g. it has been created by using explicit parameters with no curve name),
|
||||
then this method can be used to lookup the name of the curve that matches the group domain parameters. The built-in curves contain
|
||||
aliases, so that multiple NID's can map to the same domain parameters. For such curves it is unspecified which of the aliases will be
|
||||
returned if the curve name of the given group is NID_undef.
|
||||
If B<nist_only> is 1 it will only look for NIST approved curves, otherwise it searches all built-in curves.
|
||||
|
||||
EC_GROUP_cmp compares B<a> and B<b> to determine whether they represent the same curve or not.
|
||||
|
||||
The functions EC_GROUP_get_basis_type, EC_GROUP_get_trinomial_basis and EC_GROUP_get_pentanomial_basis should only be called for curves
|
||||
@@ -175,6 +185,8 @@ EC_GROUP_get_order, EC_GROUP_get_cofactor, EC_GROUP_get_curve_name, EC_GROUP_get
|
||||
and EC_GROUP_get_degree return the order, cofactor, curve name (NID), ASN1 flag, point_conversion_form and degree for the
|
||||
specified curve respectively. If there is no curve name associated with a curve then EC_GROUP_get_curve_name will return 0.
|
||||
|
||||
EC_GROUP_check_named_curve() returns the nid of the matching named curve, otherwise it returns 0 for no match, or -1 on error.
|
||||
|
||||
EC_GROUP_get0_order() returns an internal pointer to the group order.
|
||||
EC_GROUP_order_bits() returns the number of bits in the group order.
|
||||
EC_GROUP_get0_cofactor() returns an internal pointer to the group cofactor.
|
||||
@@ -198,9 +210,13 @@ L<crypto(7)>, L<EC_GROUP_new(3)>,
|
||||
L<EC_POINT_new(3)>, L<EC_POINT_add(3)>, L<EC_KEY_new(3)>,
|
||||
L<EC_GFp_simple_method(3)>, L<d2i_ECPKParameters(3)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The EC_GROUP_check_named_curve() function was added in OpenSSL 3.0.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2013-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2013-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -182,7 +182,12 @@ EVP_MD_meth_set_app_datasize().
|
||||
|
||||
=item EVP_MD_CTX_md()
|
||||
|
||||
Returns the B<EVP_MD> structure corresponding to the passed B<EVP_MD_CTX>.
|
||||
Returns the B<EVP_MD> structure corresponding to the passed B<EVP_MD_CTX>. This
|
||||
will be the same B<EVP_MD> object originally passed to EVP_DigestInit_ex() (or
|
||||
other similar function) when the EVP_MD_CTX was first initialised. Note that
|
||||
where explicit fetch is in use (see L<EVP_MD_fetch(3)>) the value returned from
|
||||
this function will not have its reference count incremented and therefore it
|
||||
should not be used after the EVP_MD_CTX is freed.
|
||||
|
||||
=item EVP_MD_CTX_set_update_fn()
|
||||
|
||||
|
||||
@@ -21,13 +21,13 @@ calculate the digest of input data using functions such as
|
||||
L<EVP_DigestInit_ex(3)>, L<EVP_DigestUpdate(3)> and L<EVP_DigestFinal_ex(3)>.
|
||||
|
||||
Digest implementations may be obtained in one of three ways, i.e. implicit
|
||||
lookup, explicit lookup or user defined.
|
||||
fetch, explicit fetch or user defined.
|
||||
|
||||
=over 4
|
||||
|
||||
=item Implicit Lookup
|
||||
=item Implicit Fetch
|
||||
|
||||
With implicit lookup an application can use functions such as L<EVP_sha256(3)>,
|
||||
With implicit fetch an application can use functions such as L<EVP_sha256(3)>,
|
||||
L<EVP_sha512(3)> or L<EVP_blake2b512(3)> to obtain an B<EVP_MD> object. When
|
||||
used in a function like L<EVP_DigestInit_ex(3)> the actual implementation to
|
||||
be used will be fetched implicitly using default search criteria. Typically,
|
||||
@@ -35,13 +35,15 @@ be used will be fetched implicitly using default search criteria. Typically,
|
||||
have been loaded), this will return an implementation of the appropriate
|
||||
algorithm from the default provider.
|
||||
|
||||
=item Explicit Lookup
|
||||
=item Explicit Fetch
|
||||
|
||||
With explicit lookup an application uses the EVP_MD_fetch() function to obtain
|
||||
With explicit fetch an application uses the EVP_MD_fetch() function to obtain
|
||||
an algorithm implementation. An implementation with the given name and
|
||||
satisfying the search criteria specified in the B<properties> parameter will be
|
||||
looked for within the available providers and returned. See L<OSSL_PROVIDER(3)>
|
||||
for information about providers.
|
||||
satisfying the search criteria specified in the B<properties> parameter
|
||||
combined with the default search criteria will be looked for within the
|
||||
available providers and returned.
|
||||
See L<EVP_set_default_properties(3)> for information on default search criteria
|
||||
and L<OSSL_PROVIDER(3)> for information about providers.
|
||||
|
||||
=item User defined
|
||||
|
||||
@@ -83,6 +85,18 @@ The return value from a call to EVP_MD_fetch() must be freed by the caller using
|
||||
L<EVP_MD_meth_free(3)>. Note that EVP_MD objects are reference counted. See
|
||||
L<EVP_MD_upref(3)>.
|
||||
|
||||
=head1 NOTES
|
||||
|
||||
Where an application that previously used implicit fetch is converted to use
|
||||
explicit fetch care should be taken with the L<EVP_MD_CTX_md(3)> function.
|
||||
Specifically, this function returns the EVP_MD object orginally passed to
|
||||
EVP_DigestInit_ex() (or other similar function). With implicit fetch the
|
||||
returned EVP_MD object is guaranteed to be available throughout the application
|
||||
lifetime. However, with explicit fetch EVP_MD objects are reference counted.
|
||||
EVP_MD_CTX_md does not increment the reference count and so the returned EVP_MD
|
||||
object may not be accessible beyond the lifetime of the EVP_MD_CTX it is
|
||||
associated with.
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
EVP_MD_fetch() returns a pointer to the algorithm implementation represented by
|
||||
@@ -144,7 +158,8 @@ other providers:
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<EVP_DigestInit(3)>, L<EVP_MD_meth_new(3)>, L<EVP_MD_meth_free(3)>,
|
||||
L<EVP_MD_upref(3)>, L<OSSL_PROVIDER_load(3)>, L<OPENSSL_CTX(3)>
|
||||
L<EVP_MD_upref(3)>, L<OSSL_PROVIDER_load(3)>, L<OPENSSL_CTX(3)>,
|
||||
L<EVP_set_default_properties(3)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
EVP_set_default_properties
|
||||
- Set default properties for future algorithm fetches
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
#include <openssl/evp.h>
|
||||
|
||||
int EVP_set_default_properties(OPENSSL_CTX *libctx, const char *propq);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
EVP_set_default_properties() sets the default properties for all
|
||||
future EVP algorithm fetches, implicit as well as explicit.
|
||||
|
||||
=for comment TODO(3.0) We should consider having an EVP document in
|
||||
section 7 that details everything about implicit vs explicit fetches
|
||||
and how they relate to properties.
|
||||
|
||||
EVP_set_default_properties stores the properties given with the string
|
||||
I<propq> among the EVP data that's been stored in the library context
|
||||
given with I<libctx> (NULL signifies the default library context).
|
||||
|
||||
Any previous default property for the specified library context will
|
||||
be dropped.
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
EVP_set_default_properties() returns 1 on success, or 0 on failure.
|
||||
The latter adds an error on the error stack.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<EVP_MD_fetch>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The functions described here were added in OpenSSL 3.0.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
in the file LICENSE in the source distribution or at
|
||||
L<https://www.openssl.org/source/license.html>.
|
||||
|
||||
=cut
|
||||
@@ -10,7 +10,8 @@ OSSL_PARAM_SIZED_octet_ptr, OSSL_PARAM_END, OSSL_PARAM_construct_TYPE,
|
||||
OSSL_PARAM_END,
|
||||
OSSL_PARAM_construct_BN, OSSL_PARAM_construct_utf8_string,
|
||||
OSSL_PARAM_construct_utf8_ptr, OSSL_PARAM_construct_octet_string,
|
||||
OSSL_PARAM_construct_octet_ptr, OSSL_PARAM_locate, OSSL_PARAM_get_TYPE,
|
||||
OSSL_PARAM_construct_octet_ptr, OSSL_PARAM_construct_end,
|
||||
OSSL_PARAM_locate, OSSL_PARAM_get_TYPE,
|
||||
OSSL_PARAM_set_TYPE, OSSL_PARAM_get_BN, OSSL_PARAM_set_BN,
|
||||
OSSL_PARAM_get_utf8_string, OSSL_PARAM_set_utf8_string,
|
||||
OSSL_PARAM_get_octet_string, OSSL_PARAM_set_octet_string,
|
||||
@@ -43,9 +44,10 @@ OSSL_PARAM_set_octet_ptr
|
||||
OSSL_PARAM OSSL_PARAM_construct_octet_string(const char *key, void *buf,
|
||||
size_t bsize, size_t *rsize);
|
||||
OSSL_PARAM OSSL_PARAM_construct_utf8_ptr(const char *key, char **buf,
|
||||
size_t *rsize);
|
||||
size_t bsize, size_t *rsize);
|
||||
OSSL_PARAM OSSL_PARAM_construct_octet_ptr(const char *key, void **buf,
|
||||
size_t *rsize);
|
||||
size_t bsize, size_t *rsize);
|
||||
OSSL_PARAM OSSL_PARAM_construct_end(void);
|
||||
|
||||
OSSL_PARAM *OSSL_PARAM_locate(OSSL_PARAM *array, const char *key);
|
||||
|
||||
@@ -171,13 +173,16 @@ size B<rsize> is created.
|
||||
|
||||
OSSL_PARAM_construct_utf8_ptr() is a function that constructes a UTF string
|
||||
pointer OSSL_PARAM structure.
|
||||
A parameter with name B<key>, storage pointer B<*buf> and return size B<rsize>
|
||||
is created.
|
||||
A parameter with name B<key>, storage pointer B<*buf>, size B<bsize> and
|
||||
return size B<rsize> is created.
|
||||
|
||||
OSSL_PARAM_construct_octet_ptr() is a function that constructes an OCTET string
|
||||
pointer OSSL_PARAM structure.
|
||||
A parameter with name B<key>, storage pointer B<*buf> and return size B<rsize>
|
||||
is created.
|
||||
A parameter with name B<key>, storage pointer B<*buf>, size B<bsize> and
|
||||
return size B<rsize> is created.
|
||||
|
||||
OSSL_PARAM_construct_end() is a function that constructs the terminating
|
||||
OSSL_PARAM structure.
|
||||
|
||||
OSSL_PARAM_locate() is a function that searches an B<array> of parameters for
|
||||
the one matching the B<key> name.
|
||||
@@ -249,6 +254,13 @@ Integral types will be widened and sign extended as required.
|
||||
Apart from that, the functions must be used appropriately for the
|
||||
expected type of the parameter.
|
||||
|
||||
For OSSL_PARAM_get_utf8_ptr() and OSSL_PARAM_get_octet_ptr(), B<bsize>
|
||||
is not relevant if the purpose is to send the B<OSSL_PARAM> array to a
|
||||
I<responder>, i.e. to get parameter data back.
|
||||
In that case, B<bsize> can safely be given zero.
|
||||
See L<OSSL_PARAM(3)/DESCRIPTION> for further information on the
|
||||
possible purposes.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
Reusing the examples from L<OSSL_PARAM(3)> to just show how
|
||||
|
||||
@@ -176,6 +176,10 @@ point during evaluation.
|
||||
|
||||
Traces BIGNUM context operations.
|
||||
|
||||
=item C<OSSL_TRACE_CATEGORY_PROVIDER_CONF>
|
||||
|
||||
Traces the OSSL_PROVIDER configuration.
|
||||
|
||||
=back
|
||||
|
||||
There is also C<OSSL_TRACE_CATEGORY_ALL>, which works as a fallback
|
||||
|
||||
@@ -459,20 +459,20 @@ Skeleton pass phrase callback:
|
||||
return len;
|
||||
}
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<EVP_EncryptInit(3)>, L<EVP_BytesToKey(3)>,
|
||||
L<passphrase-encoding(7)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The old Netscape certificate sequences were no longer documented
|
||||
in OpenSSL 1.1.0; applications should use the PKCS7 standard instead
|
||||
as they will be formally deprecated in a future releases.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<EVP_EncryptInit(3)>, L<EVP_BytesToKey(3)>,
|
||||
L<passphrase-encoding(7)>
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2001-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -29,7 +29,9 @@ number of generate requests (I<reseed interval>) or the maximum timespan
|
||||
(I<reseed time interval>) since its last seeding have been reached.
|
||||
If this is the case, the DRBG reseeds automatically.
|
||||
Additionally, an immediate reseeding can be requested by setting the
|
||||
B<prediction_resistance> flag to 1. See NOTES section for more details.
|
||||
B<prediction_resistance> flag to 1.
|
||||
Requesting prediction resistance is a relative expensive operation.
|
||||
See NOTES section for more details.
|
||||
|
||||
The caller can optionally provide additional data to be used for reseeding
|
||||
by passing a pointer B<adin> to a buffer of length B<adinlen>.
|
||||
@@ -59,15 +61,9 @@ If necessary, they can be changed using L<RAND_DRBG_set_reseed_interval(3)>
|
||||
and L<RAND_DRBG_set_reseed_time_interval(3)>, respectively.
|
||||
|
||||
A request for prediction resistance can only be satisfied by pulling fresh
|
||||
entropy from one of the approved entropy sources listed in section 5.5.2 of
|
||||
[NIST SP 800-90C].
|
||||
Since the default DRBG implementation does not have access to such an approved
|
||||
entropy source, a request for prediction resistance will always fail.
|
||||
In other words, prediction resistance is currently not supported yet by the DRBG.
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The RAND_DRBG functions were added in OpenSSL 1.1.1.
|
||||
entropy from a live entropy source (section 5.5.2 of [NIST SP 800-90C]).
|
||||
It is up to the user to ensure that a live entropy source is configured
|
||||
and is being used.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
@@ -76,9 +72,15 @@ L<RAND_DRBG_set_reseed_interval(3)>,
|
||||
L<RAND_DRBG_set_reseed_time_interval(3)>,
|
||||
L<RAND_DRBG(7)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The RAND_DRBG functions were added in OpenSSL 1.1.1.
|
||||
|
||||
Prediction resistance is supported from OpenSSL 3.0.0.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -53,11 +53,6 @@ During initialization, it is possible to change the reseed interval
|
||||
and reseed time interval.
|
||||
It is also possible to exchange the reseeding callbacks entirely.
|
||||
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The RAND_DRBG functions were added in OpenSSL 1.1.1.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<RAND_DRBG_set_callbacks(3)>,
|
||||
@@ -68,9 +63,13 @@ L<RAND_DRBG_set_callbacks(3)>,
|
||||
L<RAND_DRBG_generate(3)>,
|
||||
L<RAND_DRBG(7)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The RAND_DRBG functions were added in OpenSSL 1.1.1.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -134,10 +134,6 @@ To ensure that they are applied to the global and thread-local DRBG instances
|
||||
RAND_DRBG_set_defaults() before creating any thread and before calling any
|
||||
cryptographic routines that obtain random data directly or indirectly.
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The RAND_DRBG functions were added in OpenSSL 1.1.1.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<OPENSSL_zalloc(3)>,
|
||||
@@ -145,9 +141,13 @@ L<OPENSSL_secure_zalloc(3)>,
|
||||
L<RAND_DRBG_generate(3)>,
|
||||
L<RAND_DRBG(7)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The RAND_DRBG functions were added in OpenSSL 1.1.1.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -13,7 +13,8 @@ RAND_DRBG_set_reseed_defaults
|
||||
#include <openssl/rand_drbg.h>
|
||||
|
||||
int RAND_DRBG_reseed(RAND_DRBG *drbg,
|
||||
const unsigned char *adin, size_t adinlen);
|
||||
const unsigned char *adin, size_t adinlen,
|
||||
int prediction_resistance);
|
||||
|
||||
int RAND_DRBG_set_reseed_interval(RAND_DRBG *drbg,
|
||||
unsigned int interval);
|
||||
@@ -37,6 +38,10 @@ and mixing in the specified additional data provided in the buffer B<adin>
|
||||
of length B<adinlen>.
|
||||
The additional data can be omitted by setting B<adin> to NULL and B<adinlen>
|
||||
to 0.
|
||||
An immediate reseeding can be requested by setting the
|
||||
B<prediction_resistance> flag to 1.
|
||||
Requesting prediction resistance is a relative expensive operation.
|
||||
See NOTES section for more details.
|
||||
|
||||
RAND_DRBG_set_reseed_interval()
|
||||
sets the reseed interval of the B<drbg>, which is the maximum allowed number
|
||||
@@ -88,10 +93,6 @@ To ensure that they are applied to the global and thread-local DRBG instances
|
||||
RAND_DRBG_set_reseed_defaults() before creating any thread and before calling any
|
||||
cryptographic routines that obtain random data directly or indirectly.
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The RAND_DRBG functions were added in OpenSSL 1.1.1.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<RAND_DRBG_generate(3)>,
|
||||
@@ -99,9 +100,15 @@ L<RAND_DRBG_bytes(3)>,
|
||||
L<RAND_DRBG_set_callbacks(3)>.
|
||||
L<RAND_DRBG(7)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The RAND_DRBG functions were added in OpenSSL 1.1.1.
|
||||
|
||||
Prediction resistance is supported from OpenSSL 3.0.0.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -104,12 +104,9 @@ contents safely before freeing it, in order not to leave sensitive information
|
||||
about the DRBG's state in memory.
|
||||
|
||||
A request for prediction resistance can only be satisfied by pulling fresh
|
||||
entropy from one of the approved entropy sources listed in section 5.5.2 of
|
||||
[NIST SP 800-90C].
|
||||
Since the default implementation of the get_entropy callback does not have access
|
||||
to such an approved entropy source, a request for prediction resistance will
|
||||
always fail.
|
||||
In other words, prediction resistance is currently not supported yet by the DRBG.
|
||||
entropy from a live entropy source (section 5.5.2 of [NIST SP 800-90C]).
|
||||
It is up to the user to ensure that a live entropy source is configured
|
||||
and is being used.
|
||||
|
||||
The derivation function is disabled during initialization by calling the
|
||||
RAND_DRBG_set() function with the RAND_DRBG_FLAG_CTR_NO_DF flag.
|
||||
@@ -124,20 +121,19 @@ In this case the DRBG will automatically request an extra amount of entropy
|
||||
utilize for the nonce, following the recommendations of [NIST SP 800-90A Rev. 1],
|
||||
section 8.6.7.
|
||||
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The RAND_DRBG functions were added in OpenSSL 1.1.1.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<RAND_DRBG_new(3)>,
|
||||
L<RAND_DRBG_reseed(3)>,
|
||||
L<RAND_DRBG(7)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The RAND_DRBG functions were added in OpenSSL 1.1.1.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -80,11 +80,6 @@ RAND_event() returns RAND_status().
|
||||
|
||||
The other functions do not return values.
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
RAND_event() and RAND_screen() were deprecated in OpenSSL 1.1.0 and should
|
||||
not be used.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<RAND_bytes(3)>,
|
||||
@@ -92,9 +87,14 @@ L<RAND_egd(3)>,
|
||||
L<RAND_load_file(3)>,
|
||||
L<RAND(7)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
RAND_event() and RAND_screen() were deprecated in OpenSSL 1.1.0 and should
|
||||
not be used.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
+10
-10
@@ -43,6 +43,15 @@ return 1 on success, -1 if not supported by the current
|
||||
RAND method, or 0 on other failure. The error code can be
|
||||
obtained by L<ERR_get_error(3)>.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<RAND_add(3)>,
|
||||
L<RAND_bytes(3)>,
|
||||
L<RAND_priv_bytes(3)>,
|
||||
L<ERR_get_error(3)>,
|
||||
L<RAND(7)>,
|
||||
L<RAND_DRBG(7)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
=over 2
|
||||
@@ -57,18 +66,9 @@ The RAND_priv_bytes() function was added in OpenSSL 1.1.1.
|
||||
|
||||
=back
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<RAND_add(3)>,
|
||||
L<RAND_bytes(3)>,
|
||||
L<RAND_priv_bytes(3)>,
|
||||
L<ERR_get_error(3)>,
|
||||
L<RAND(7)>,
|
||||
L<RAND_DRBG(7)>
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -25,18 +25,18 @@ L<OPENSSL_init_crypto(3)>.
|
||||
|
||||
RAND_cleanup() returns no value.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<RAND(7)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
RAND_cleanup() was deprecated in OpenSSL 1.1.0; do not use it.
|
||||
See L<OPENSSL_init_crypto(3)>
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<RAND(7)>
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -124,7 +124,10 @@ Textual representation of the cipher name.
|
||||
|
||||
=item <protocol version>
|
||||
|
||||
Protocol version, such as B<TLSv1.2>, when the cipher was first defined.
|
||||
The minimum protocol version that the ciphersuite supports, such as B<TLSv1.2>.
|
||||
Note that this is not always the same as the protocol version in which the
|
||||
ciphersuite was first defined because some ciphersuites are backwards compatible
|
||||
with earlier protocol versions.
|
||||
|
||||
=item Kx=<key exchange>
|
||||
|
||||
@@ -177,6 +180,11 @@ SSL_CIPHER_get_id() returns a 4-byte integer representing the OpenSSL-specific I
|
||||
SSL_CIPHER_get_protocol_id() returns a 2-byte integer representing the TLS
|
||||
protocol-specific ID.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<ssl(7)>, L<SSL_get_current_cipher(3)>,
|
||||
L<SSL_get_ciphers(3)>, L<ciphers(1)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The SSL_CIPHER_get_version() function was updated to always return the
|
||||
@@ -193,14 +201,9 @@ required to enable this function.
|
||||
|
||||
The OPENSSL_cipher_name() function was added in OpenSSL 1.1.1.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<ssl(7)>, L<SSL_get_current_cipher(3)>,
|
||||
L<SSL_get_ciphers(3)>, L<ciphers(1)>
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -190,6 +190,11 @@ SSL_CTX_up_ref() returns 1 for success and 0 for failure.
|
||||
|
||||
=back
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<SSL_CTX_set_options(3)>, L<SSL_CTX_free(3)>, L<SSL_accept(3)>,
|
||||
L<SSL_CTX_set_min_proto_version(3)>, L<ssl(7)>, L<SSL_set_connect_state(3)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
Support for SSLv2 and the corresponding SSLv2_method(),
|
||||
@@ -198,18 +203,13 @@ removed in OpenSSL 1.1.0.
|
||||
|
||||
SSLv23_method(), SSLv23_server_method() and SSLv23_client_method()
|
||||
were deprecated and the preferred TLS_method(), TLS_server_method()
|
||||
and TLS_client_method() functions were introduced in OpenSSL 1.1.0.
|
||||
and TLS_client_method() functions were added in OpenSSL 1.1.0.
|
||||
|
||||
All version-specific methods were deprecated in OpenSSL 1.1.0.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<SSL_CTX_set_options(3)>, L<SSL_CTX_free(3)>, L<SSL_accept(3)>,
|
||||
L<SSL_CTX_set_min_proto_version(3)>, L<ssl(7)>, L<SSL_set_connect_state(3)>
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -90,20 +90,20 @@ truncated.
|
||||
return strlen(buf);
|
||||
}
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<ssl(7)>,
|
||||
L<SSL_CTX_use_certificate(3)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
SSL_CTX_get_default_passwd_cb(), SSL_CTX_get_default_passwd_cb_userdata(),
|
||||
SSL_set_default_passwd_cb() and SSL_set_default_passwd_cb_userdata() were
|
||||
added in OpenSSL 1.1.0.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<ssl(7)>,
|
||||
L<SSL_CTX_use_certificate(3)>
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -52,18 +52,18 @@ lowest or highest protocol, respectively.
|
||||
|
||||
All these functions are implemented using macros.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<SSL_CTX_set_options(3)>, L<SSL_CONF_cmd(3)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The setter functions were added in OpenSSL 1.1.0. The getter functions
|
||||
were added in OpenSSL 1.1.1.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<SSL_CTX_set_options(3)>, L<SSL_CONF_cmd(3)>
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -162,6 +162,10 @@ SSL_set_default_read_buffer_len(), SSL_CTX_set_tlsext_max_fragment_length(),
|
||||
SSL_set_tlsext_max_fragment_length() and SSL_SESSION_get_max_fragment_length()
|
||||
all these functions are implemented using macros.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<SSL_CTX_set_read_ahead(3)>, L<SSL_pending(3)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The SSL_CTX_set_max_pipelines(), SSL_set_max_pipelines(),
|
||||
@@ -172,13 +176,9 @@ functions were added in OpenSSL 1.1.0.
|
||||
The SSL_CTX_set_tlsext_max_fragment_length(), SSL_set_tlsext_max_fragment_length()
|
||||
and SSL_SESSION_get_max_fragment_length() functions were added in OpenSSL 1.1.1.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<SSL_CTX_set_read_ahead(3)>, L<SSL_pending(3)>
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -126,10 +126,6 @@ You should instead call SSL_get_error() to find out if it's retryable.
|
||||
|
||||
=back
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The SSL_read_ex() and SSL_peek_ex() functions were added in OpenSSL 1.1.1.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<SSL_get_error(3)>, L<SSL_write_ex(3)>,
|
||||
@@ -140,9 +136,13 @@ L<SSL_pending(3)>,
|
||||
L<SSL_shutdown(3)>, L<SSL_set_shutdown(3)>,
|
||||
L<ssl(7)>, L<bio(7)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The SSL_read_ex() and SSL_peek_ex() functions were added in OpenSSL 1.1.1.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
@@ -104,10 +104,6 @@ You should instead call SSL_get_error() to find out if it's retryable.
|
||||
|
||||
=back
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The SSL_write_ex() function was added in OpenSSL 1.1.1.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<SSL_get_error(3)>, L<SSL_read_ex(3)>, L<SSL_read(3)>
|
||||
@@ -116,9 +112,13 @@ L<SSL_connect(3)>, L<SSL_accept(3)>
|
||||
L<SSL_set_connect_state(3)>,
|
||||
L<ssl(7)>, L<bio(7)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
The SSL_write_ex() function was added in OpenSSL 1.1.1.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
|
||||
Copyright 2000-2019 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user