Update 1.1.1-pre8

This commit is contained in:
2018-06-24 20:52:36 +09:00
parent 5d513892b8
commit 4c4004fa50
48 changed files with 288 additions and 298 deletions
+22
View File
@@ -8,6 +8,28 @@
release branch. release branch.
Changes between 1.1.0h and 1.1.1 [xx XXX xxxx] Changes between 1.1.0h and 1.1.1 [xx XXX xxxx]
*) Numerous side-channel attack mitigations have been applied. This may have
performance impacts for some algorithms for the benefit of improved
security. Specific changes are noted in this change log by their respective
authors.
[Matt Caswell]
*) AIX shared library support overhaul. Switch to AIX "natural" way of
handling shared libraries, which means collecting shared objects of
different versions and bitnesses in one common archive. This allows to
mitigate conflict between 1.0 and 1.1 side-by-side installations. It
doesn't affect the way 3rd party applications are linked, only how
multi-version installation is managed.
[Andy Polyakov]
*) Make ec_group_do_inverse_ord() more robust and available to other
EC cryptosystems, so that irrespective of BN_FLG_CONSTTIME, SCA
mitigations are applied to the fallback BN_mod_inverse().
When using this function rather than BN_mod_inverse() directly, new
EC cryptosystem implementations are then safer-by-default.
[Billy Bob Brumley]
*) Add coordinate blinding for EC_POINT and implement projective *) Add coordinate blinding for EC_POINT and implement projective
coordinate blinding for generic prime curves as a countermeasure to coordinate blinding for generic prime curves as a countermeasure to
chosen point SCA attacks. chosen point SCA attacks.
+9 -4
View File
@@ -1110,14 +1110,17 @@ my %targets = (
template => 1, template => 1,
sys_id => "AIX", sys_id => "AIX",
lib_cppflags => "-DB_ENDIAN", lib_cppflags => "-DB_ENDIAN",
lflags => "-Wl,-bsvr4",
thread_scheme => "pthreads", thread_scheme => "pthreads",
dso_scheme => "dlfcn", dso_scheme => "dlfcn",
shared_target => "self", shared_target => "self",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)", module_ldflags => "-Wl,-G,-bsymbolic,-bexpall",
bin_lflags => shared("-Wl,-bsvr4"), shared_ldflag => "-Wl,-G,-bsymbolic",
module_ldflags => "-Wl,-G,-bsymbolic,-bexpall,-bnolibpath",
shared_ldflag => "-Wl,-G,-bsymbolic,-bnolibpath",
shared_defflag => "-Wl,-bE:", shared_defflag => "-Wl,-bE:",
shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
dso_extension => ".so",
lib_extension => shared("_a.a"),
shared_extension_simple => shared(".a"),
}, },
"aix-gcc" => { "aix-gcc" => {
inherit_from => [ "aix-common", asm("ppc32_asm") ], inherit_from => [ "aix-common", asm("ppc32_asm") ],
@@ -1142,6 +1145,7 @@ my %targets = (
bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR", bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
perlasm_scheme => "aix64", perlasm_scheme => "aix64",
shared_ldflag => add_before("-shared -static-libgcc"), shared_ldflag => add_before("-shared -static-libgcc"),
shared_extension => "64.so.\$(SHLIB_VERSION_NUMBER)",
AR => add("-X64"), AR => add("-X64"),
RANLIB => add("-X64"), RANLIB => add("-X64"),
}, },
@@ -1173,6 +1177,7 @@ my %targets = (
perlasm_scheme => "aix64", perlasm_scheme => "aix64",
dso_scheme => "dlfcn", dso_scheme => "dlfcn",
shared_cflag => "-qpic", shared_cflag => "-qpic",
shared_extension => "64.so.\$(SHLIB_VERSION_NUMBER)",
AR => add("-X64"), AR => add("-X64"),
RANLIB => add("-X64"), RANLIB => add("-X64"),
}, },
+34 -10
View File
@@ -16,6 +16,10 @@
sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ } sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ }
# Shared AIX support is special. We put libcrypto[64].so.ver into
# libcrypto.a and use libcrypto_a.a as static one.
sub sharedaix { !$disabled{shared} && $config{target} =~ /^aix/ }
our $sover_dirname = $config{shlib_version_number}; our $sover_dirname = $config{shlib_version_number};
$sover_dirname =~ s|\.|_|g $sover_dirname =~ s|\.|_|g
if $config{target} =~ /^mingw/; if $config{target} =~ /^mingw/;
@@ -506,7 +510,7 @@ install_dev:
s2=`echo "$$s" | cut -f2 -d";"`; \ s2=`echo "$$s" | cut -f2 -d";"`; \
fn1=`basename $$s1`; \ fn1=`basename $$s1`; \
fn2=`basename $$s2`; \ fn2=`basename $$s2`; \
: {- output_off() if windowsdll(); "" -}; \ : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \
$(ECHO) "install $$s1 -> $(DESTDIR)$(libdir)/$$fn1"; \ $(ECHO) "install $$s1 -> $(DESTDIR)$(libdir)/$$fn1"; \
cp $$s1 $(DESTDIR)$(libdir)/$$fn1.new; \ cp $$s1 $(DESTDIR)$(libdir)/$$fn1.new; \
chmod 755 $(DESTDIR)$(libdir)/$$fn1.new; \ chmod 755 $(DESTDIR)$(libdir)/$$fn1.new; \
@@ -516,13 +520,28 @@ install_dev:
$(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \ $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \
ln -sf $$fn1 $(DESTDIR)$(libdir)/$$fn2; \ ln -sf $$fn1 $(DESTDIR)$(libdir)/$$fn2; \
fi; \ fi; \
: {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \ : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \
$(ECHO) "install $$s2 -> $(DESTDIR)$(libdir)/$$fn2"; \ $(ECHO) "install $$s2 -> $(DESTDIR)$(libdir)/$$fn2"; \
cp $$s2 $(DESTDIR)$(libdir)/$$fn2.new; \ cp $$s2 $(DESTDIR)$(libdir)/$$fn2.new; \
chmod 755 $(DESTDIR)$(libdir)/$$fn2.new; \ chmod 755 $(DESTDIR)$(libdir)/$$fn2.new; \
mv -f $(DESTDIR)$(libdir)/$$fn2.new \ mv -f $(DESTDIR)$(libdir)/$$fn2.new \
$(DESTDIR)$(libdir)/$$fn2; \ $(DESTDIR)$(libdir)/$$fn2; \
: {- output_on() unless windowsdll(); "" -}; \ : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \
a=$(DESTDIR)$(libdir)/$$fn2; \
$(ECHO) "install $$s1 -> $$a"; \
if [ -f $$a ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \
mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \
cp -f $$a $$a.new; \
for so in `$(AR) t $$a`; do \
$(AR) x $$a $$so; \
chmod u+w $$so; \
strip -X32_64 -e $$so; \
$(AR) r $$a.new $$so; \
done; \
)); fi; \
$(AR) r $$a.new $$s1; \
mv -f $$a.new $$a; \
: {- output_off() if sharedaix(); output_on(); "" -}; \
done done
@ : {- output_on() if $disabled{shared}; "" -} @ : {- output_on() if $disabled{shared}; "" -}
@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)/pkgconfig @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)/pkgconfig
@@ -562,11 +581,11 @@ uninstall_dev:
fn1=`basename $$s1`; \ fn1=`basename $$s1`; \
fn2=`basename $$s2`; \ fn2=`basename $$s2`; \
: {- output_off() if windowsdll(); "" -}; \ : {- output_off() if windowsdll(); "" -}; \
$(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \ $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
$(RM) $(DESTDIR)$(libdir)/$$fn1; \ $(RM) $(DESTDIR)$(libdir)/$$fn2; \
if [ "$$fn1" != "$$fn2" ]; then \ if [ "$$fn1" != "$$fn2" -a -f "$(DESTDIR)$(libdir)/$$fn1" ]; then \
$(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \ $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \
$(RM) $(DESTDIR)$(libdir)/$$fn2; \ $(RM) $(DESTDIR)$(libdir)/$$fn1; \
fi; \ fi; \
: {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \ : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
$(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \ $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
@@ -1104,6 +1123,11 @@ EOF
cp -p $shlib'\$(SHLIB_EXT)' apps/ cp -p $shlib'\$(SHLIB_EXT)' apps/
cp -p $shlib'\$(SHLIB_EXT)' test/ cp -p $shlib'\$(SHLIB_EXT)' test/
cp -p $shlib'\$(SHLIB_EXT)' fuzz/ cp -p $shlib'\$(SHLIB_EXT)' fuzz/
EOF
} elsif (sharedaix()) {
$recipe .= <<"EOF";
rm -f $target && \\
\$(AR) r $target $target_full
EOF EOF
} else { } else {
$recipe .= <<"EOF"; $recipe .= <<"EOF";
@@ -1168,8 +1192,8 @@ EOF
push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
} }
my $linkflags = join("", map { "-L$_ " } @linkdirs); my $linkflags = join("", map { "-L$_ " } @linkdirs);
my $linklibs = join("", map { if ($_ =~ /\.a$/) { my $linklibs = join("", map { if ($_ =~ s/\.a$//) {
" $_"; " $_$libext";
} else { } else {
my $f = basename($_); my $f = basename($_);
(my $l = $f) =~ s/^lib//; (my $l = $f) =~ s/^lib//;
+10 -8
View File
@@ -125,6 +125,7 @@ my $gcc_devteam_warn = "-DDEBUG_UNUSED"
. " -Wswitch" . " -Wswitch"
. " -Wsign-compare" . " -Wsign-compare"
. " -Wmissing-prototypes" . " -Wmissing-prototypes"
. " -Wstrict-prototypes"
. " -Wshadow" . " -Wshadow"
. " -Wformat" . " -Wformat"
. " -Wtype-limits" . " -Wtype-limits"
@@ -822,11 +823,7 @@ while (@argvcopy)
{ {
read_config $1; read_config $1;
} }
elsif (/^-L(.*)$/) elsif (/^-l(.*)$/)
{
push @{$useradd{LDFLAGS}}, $_;
}
elsif (/^-l(.*)$/ or /^-Wl,/)
{ {
push @{$useradd{LDLIBS}}, $_; push @{$useradd{LDLIBS}}, $_;
} }
@@ -834,6 +831,10 @@ while (@argvcopy)
{ {
push @{$useradd{LDLIBS}}, $_, shift(@argvcopy); push @{$useradd{LDLIBS}}, $_, shift(@argvcopy);
} }
elsif (/^-L(.*)$/ or /^-Wl,/)
{
push @{$useradd{LDFLAGS}}, $_;
}
elsif (/^-rpath$/ or /^-R$/) elsif (/^-rpath$/ or /^-R$/)
# -rpath is the OSF1 rpath flag # -rpath is the OSF1 rpath flag
# -R is the old Solaris rpath flag # -R is the old Solaris rpath flag
@@ -953,7 +954,7 @@ foreach (keys %user) {
} }
} }
if (grep { $_ =~ /(^|\s)-Wl,-rpath,/ } ($user{LDLIBS} ? @{$user{LDLIBS}} : ()) if (grep { /-rpath\b/ } ($user{LDFLAGS} ? @{$user{LDFLAGS}} : ())
&& !$disabled{shared} && !$disabled{shared}
&& !($disabled{asan} && $disabled{msan} && $disabled{ubsan})) { && !($disabled{asan} && $disabled{msan} && $disabled{ubsan})) {
die "***** Cannot simultaneously use -rpath, shared libraries, and\n", die "***** Cannot simultaneously use -rpath, shared libraries, and\n",
@@ -1110,8 +1111,9 @@ $target{exe_extension}=".exe" if ($config{target} eq "DJGPP"
$target{exe_extension}=".pm" if ($config{target} =~ /vos/); $target{exe_extension}=".pm" if ($config{target} =~ /vos/);
($target{shared_extension_simple}=$target{shared_extension}) ($target{shared_extension_simple}=$target{shared_extension})
=~ s|\.\$\(SHLIB_VERSION_NUMBER\)||; =~ s|\.\$\(SHLIB_VERSION_NUMBER\)||
$target{dso_extension}=$target{shared_extension_simple}; unless defined($target{shared_extension_simple});
$target{dso_extension}//=$target{shared_extension_simple};
($target{shared_import_extension}=$target{shared_extension_simple}.".a") ($target{shared_import_extension}=$target{shared_extension_simple}.".a")
if ($config{target} =~ /^(?:Cygwin|mingw)/); if ($config{target} =~ /^(?:Cygwin|mingw)/);
+3 -3
View File
@@ -1706,11 +1706,11 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
BIO_printf(bio_err, "Memory allocation failure\n"); BIO_printf(bio_err, "Memory allocation failure\n");
goto end; goto end;
} }
i = -1;
while ((i = X509_NAME_get_index_by_NID(dn_subject, while ((i = X509_NAME_get_index_by_NID(dn_subject,
NID_pkcs9_emailAddress, NID_pkcs9_emailAddress,
-1)) >= 0) { i)) >= 0) {
tmpne = X509_NAME_get_entry(dn_subject, i); tmpne = X509_NAME_delete_entry(dn_subject, i--);
X509_NAME_delete_entry(dn_subject, i);
X509_NAME_ENTRY_free(tmpne); X509_NAME_ENTRY_free(tmpne);
} }
-8
View File
@@ -23,10 +23,6 @@
# include "internal/bn_int.h" # include "internal/bn_int.h"
#ifdef __cplusplus
extern "C" {
#endif
/* /*
* These preprocessor symbols control various aspects of the bignum headers * These preprocessor symbols control various aspects of the bignum headers
* and library code. They're not defined by any "normal" configuration, as * and library code. They're not defined by any "normal" configuration, as
@@ -659,8 +655,4 @@ static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2); return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2);
} }
#ifdef __cplusplus
}
#endif
#endif #endif
+13 -15
View File
@@ -154,19 +154,21 @@ int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
int i, j, ret = -1; int i, j, ret = -1;
int k; int k;
BN_CTX *ctx = NULL; BN_CTX *ctx = NULL;
BIGNUM *A1, *A1_odd, *check; /* taken from ctx */ BIGNUM *A1, *A1_odd, *A3, *check; /* taken from ctx */
BN_MONT_CTX *mont = NULL; BN_MONT_CTX *mont = NULL;
if (BN_cmp(a, BN_value_one()) <= 0) /* Take care of the really small primes 2 & 3 */
if (BN_is_word(a, 2) || BN_is_word(a, 3))
return 1;
/* Check odd and bigger than 1 */
if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0)
return 0; return 0;
if (checks == BN_prime_checks) if (checks == BN_prime_checks)
checks = BN_prime_checks_for_size(BN_num_bits(a)); checks = BN_prime_checks_for_size(BN_num_bits(a));
/* first look for small factors */ /* first look for small factors */
if (!BN_is_odd(a))
/* a is even => a is prime if and only if a == 2 */
return BN_is_word(a, 2);
if (do_trial_division) { if (do_trial_division) {
for (i = 1; i < NUMPRIMES; i++) { for (i = 1; i < NUMPRIMES; i++) {
BN_ULONG mod = BN_mod_word(a, primes[i]); BN_ULONG mod = BN_mod_word(a, primes[i]);
@@ -186,20 +188,18 @@ int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
BN_CTX_start(ctx); BN_CTX_start(ctx);
A1 = BN_CTX_get(ctx); A1 = BN_CTX_get(ctx);
A3 = BN_CTX_get(ctx);
A1_odd = BN_CTX_get(ctx); A1_odd = BN_CTX_get(ctx);
check = BN_CTX_get(ctx); check = BN_CTX_get(ctx);
if (check == NULL) if (check == NULL)
goto err; goto err;
/* compute A1 := a - 1 */ /* compute A1 := a - 1 */
if (!BN_copy(A1, a)) if (!BN_copy(A1, a) || !BN_sub_word(A1, 1))
goto err; goto err;
if (!BN_sub_word(A1, 1)) /* compute A3 := a - 3 */
if (!BN_copy(A3, a) || !BN_sub_word(A3, 3))
goto err; goto err;
if (BN_is_zero(A1)) {
ret = 0;
goto err;
}
/* write A1 as A1_odd * 2^k */ /* write A1 as A1_odd * 2^k */
k = 1; k = 1;
@@ -216,11 +216,9 @@ int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
goto err; goto err;
for (i = 0; i < checks; i++) { for (i = 0; i < checks; i++) {
if (!BN_priv_rand_range(check, A1)) /* 1 < check < a-1 */
if (!BN_priv_rand_range(check, A3) || !BN_add_word(check, 2))
goto err; goto err;
if (!BN_add_word(check, 1))
goto err;
/* now 1 <= check < a */
j = witness(check, a, A1, A1_odd, k, ctx, mont); j = witness(check, a, A1, A1_odd, k, ctx, mont);
if (j == -1) if (j == -1)
-7
View File
@@ -10,10 +10,6 @@
#ifndef HEADER_CMS_LCL_H #ifndef HEADER_CMS_LCL_H
# define HEADER_CMS_LCL_H # define HEADER_CMS_LCL_H
#ifdef __cplusplus
extern "C" {
#endif
# include <openssl/x509.h> # include <openssl/x509.h>
/* /*
@@ -438,7 +434,4 @@ DECLARE_ASN1_ITEM(CMS_RevocationInfoChoice)
DECLARE_ASN1_ITEM(CMS_SignedData) DECLARE_ASN1_ITEM(CMS_SignedData)
DECLARE_ASN1_ITEM(CMS_CompressedData) DECLARE_ASN1_ITEM(CMS_CompressedData)
#ifdef __cplusplus
}
#endif
#endif #endif
+1 -1
View File
@@ -46,7 +46,7 @@ typedef struct ctlog_store_load_ctx_st {
* Creates an empty context for loading a CT log store. * Creates an empty context for loading a CT log store.
* It should be populated before use. * It should be populated before use.
*/ */
static CTLOG_STORE_LOAD_CTX *ctlog_store_load_ctx_new(); static CTLOG_STORE_LOAD_CTX *ctlog_store_load_ctx_new(void);
/* /*
* Deletes a CT log store load context. * Deletes a CT log store load context.
+1 -1
View File
@@ -150,7 +150,7 @@ void x25519_fe51_mul121666(fe51 h, fe51 f);
typedef uint64_t fe64[4]; typedef uint64_t fe64[4];
int x25519_fe64_eligible(); int x25519_fe64_eligible(void);
/* /*
* There are no reference C implementations for this radix. * There are no reference C implementations for this radix.
+4 -4
View File
@@ -174,8 +174,8 @@ struct ec_method_st {
int (*ecdh_compute_key)(unsigned char **pout, size_t *poutlen, int (*ecdh_compute_key)(unsigned char **pout, size_t *poutlen,
const EC_POINT *pub_key, const EC_KEY *ecdh); const EC_POINT *pub_key, const EC_KEY *ecdh);
/* Inverse modulo order */ /* Inverse modulo order */
int (*field_inverse_mod_ord)(const EC_GROUP *, BIGNUM *r, BIGNUM *x, int (*field_inverse_mod_ord)(const EC_GROUP *, BIGNUM *r,
BN_CTX *ctx); const BIGNUM *x, BN_CTX *);
int (*blind_coordinates)(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx); int (*blind_coordinates)(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx);
}; };
@@ -636,7 +636,7 @@ int X25519(uint8_t out_shared_key[32], const uint8_t private_key[32],
void X25519_public_from_private(uint8_t out_public_value[32], void X25519_public_from_private(uint8_t out_public_value[32],
const uint8_t private_key[32]); const uint8_t private_key[32]);
int EC_GROUP_do_inverse_ord(const EC_GROUP *group, BIGNUM *res, int ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res,
BIGNUM *x, BN_CTX *ctx); const BIGNUM *x, BN_CTX *ctx);
int ec_point_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx); int ec_point_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx);
+57 -3
View File
@@ -1017,13 +1017,67 @@ int ec_group_simple_order_bits(const EC_GROUP *group)
return BN_num_bits(group->order); return BN_num_bits(group->order);
} }
int EC_GROUP_do_inverse_ord(const EC_GROUP *group, BIGNUM *res, static int ec_field_inverse_mod_ord(const EC_GROUP *group, BIGNUM *r,
BIGNUM *x, BN_CTX *ctx) const BIGNUM *x, BN_CTX *ctx)
{
BIGNUM *e = NULL;
BN_CTX *new_ctx = NULL;
int ret = 0;
if (group->mont_data == NULL)
return 0;
if (ctx == NULL && (ctx = new_ctx = BN_CTX_secure_new()) == NULL)
return 0;
BN_CTX_start(ctx);
if ((e = BN_CTX_get(ctx)) == NULL)
goto err;
/*-
* We want inverse in constant time, therefore we utilize the fact
* order must be prime and use Fermats Little Theorem instead.
*/
if (!BN_set_word(e, 2))
goto err;
if (!BN_sub(e, group->order, e))
goto err;
/*-
* Exponent e is public.
* No need for scatter-gather or BN_FLG_CONSTTIME.
*/
if (!BN_mod_exp_mont(r, x, e, group->order, ctx, group->mont_data))
goto err;
ret = 1;
err:
if (ctx != NULL)
BN_CTX_end(ctx);
BN_CTX_free(new_ctx);
return ret;
}
/*-
* Default behavior, if group->meth->field_inverse_mod_ord is NULL:
* - When group->order is even, this function returns an error.
* - When group->order is otherwise composite, the correctness
* of the output is not guaranteed.
* - When x is outside the range [1, group->order), the correctness
* of the output is not guaranteed.
* - Otherwise, this function returns the multiplicative inverse in the
* range [1, group->order).
*
* EC_METHODs must implement their own field_inverse_mod_ord for
* other functionality.
*/
int ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res,
const BIGNUM *x, BN_CTX *ctx)
{ {
if (group->meth->field_inverse_mod_ord != NULL) if (group->meth->field_inverse_mod_ord != NULL)
return group->meth->field_inverse_mod_ord(group, res, x, ctx); return group->meth->field_inverse_mod_ord(group, res, x, ctx);
else else
return 0; return ec_field_inverse_mod_ord(group, res, x, ctx);
} }
/*- /*-
+9 -35
View File
@@ -136,34 +136,10 @@ static int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in,
} }
while (BN_is_zero(r)); while (BN_is_zero(r));
/* Check if optimized inverse is implemented */ /* compute the inverse of k */
if (EC_GROUP_do_inverse_ord(group, k, k, ctx) == 0) { if (!ec_group_do_inverse_ord(group, k, k, ctx)) {
/* compute the inverse of k */ ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_BN_LIB);
if (group->mont_data != NULL) { goto err;
/*
* We want inverse in constant time, therefore we utilize the fact
* order must be prime and use Fermats Little Theorem instead.
*/
if (!BN_set_word(X, 2)) {
ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_BN_LIB);
goto err;
}
if (!BN_mod_sub(X, order, X, order, ctx)) {
ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_BN_LIB);
goto err;
}
BN_set_flags(X, BN_FLG_CONSTTIME);
if (!BN_mod_exp_mont_consttime(k, k, X, order, ctx,
group->mont_data)) {
ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_BN_LIB);
goto err;
}
} else {
if (!BN_mod_inverse(k, k, order, ctx)) {
ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_BN_LIB);
goto err;
}
}
} }
/* clear old values if necessary */ /* clear old values if necessary */
@@ -360,7 +336,8 @@ ECDSA_SIG *ossl_ecdsa_sign_sig(const unsigned char *dgst, int dgst_len,
ECDSA_SIG_free(ret); ECDSA_SIG_free(ret);
ret = NULL; ret = NULL;
} }
BN_CTX_end(ctx); if (ctx != NULL)
BN_CTX_end(ctx);
BN_CTX_free(ctx); BN_CTX_free(ctx);
BN_clear_free(kinv); BN_clear_free(kinv);
return ret; return ret;
@@ -449,12 +426,9 @@ int ossl_ecdsa_verify_sig(const unsigned char *dgst, int dgst_len,
goto err; goto err;
} }
/* calculate tmp1 = inv(S) mod order */ /* calculate tmp1 = inv(S) mod order */
/* Check if optimized inverse is implemented */ if (!ec_group_do_inverse_ord(group, u2, sig->s, ctx)) {
if (EC_GROUP_do_inverse_ord(group, u2, sig->s, ctx) == 0) { ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_BN_LIB);
if (!BN_mod_inverse(u2, sig->s, order, ctx)) { goto err;
ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_BN_LIB);
goto err;
}
} }
/* digest -> m */ /* digest -> m */
i = BN_num_bits(order); i = BN_num_bits(order);
+1 -1
View File
@@ -1212,7 +1212,7 @@ static void batch_mul(felem x_out, felem y_out, felem z_out,
* FUNCTIONS TO MANAGE PRECOMPUTATION * FUNCTIONS TO MANAGE PRECOMPUTATION
*/ */
static NISTP224_PRE_COMP *nistp224_pre_comp_new() static NISTP224_PRE_COMP *nistp224_pre_comp_new(void)
{ {
NISTP224_PRE_COMP *ret = OPENSSL_zalloc(sizeof(*ret)); NISTP224_PRE_COMP *ret = OPENSSL_zalloc(sizeof(*ret));
+1 -1
View File
@@ -1832,7 +1832,7 @@ const EC_METHOD *EC_GFp_nistp256_method(void)
* FUNCTIONS TO MANAGE PRECOMPUTATION * FUNCTIONS TO MANAGE PRECOMPUTATION
*/ */
static NISTP256_PRE_COMP *nistp256_pre_comp_new() static NISTP256_PRE_COMP *nistp256_pre_comp_new(void)
{ {
NISTP256_PRE_COMP *ret = OPENSSL_zalloc(sizeof(*ret)); NISTP256_PRE_COMP *ret = OPENSSL_zalloc(sizeof(*ret));
+1 -1
View File
@@ -1671,7 +1671,7 @@ const EC_METHOD *EC_GFp_nistp521_method(void)
* FUNCTIONS TO MANAGE PRECOMPUTATION * FUNCTIONS TO MANAGE PRECOMPUTATION
*/ */
static NISTP521_PRE_COMP *nistp521_pre_comp_new() static NISTP521_PRE_COMP *nistp521_pre_comp_new(void)
{ {
NISTP521_PRE_COMP *ret = OPENSSL_zalloc(sizeof(*ret)); NISTP521_PRE_COMP *ret = OPENSSL_zalloc(sizeof(*ret));
+1 -1
View File
@@ -1512,7 +1512,7 @@ void ecp_nistz256_ord_sqr_mont(BN_ULONG res[P256_LIMBS],
int rep); int rep);
static int ecp_nistz256_inv_mod_ord(const EC_GROUP *group, BIGNUM *r, static int ecp_nistz256_inv_mod_ord(const EC_GROUP *group, BIGNUM *r,
BIGNUM *x, BN_CTX *ctx) const BIGNUM *x, BN_CTX *ctx)
{ {
/* RR = 2^512 mod ord(p256) */ /* RR = 2^512 mod ord(p256) */
static const BN_ULONG RR[P256_LIMBS] = { static const BN_ULONG RR[P256_LIMBS] = {
-8
View File
@@ -16,10 +16,6 @@
# include "internal/thread_once.h" # include "internal/thread_once.h"
# include "internal/refcount.h" # include "internal/refcount.h"
#ifdef __cplusplus
extern "C" {
#endif
extern CRYPTO_RWLOCK *global_engine_lock; extern CRYPTO_RWLOCK *global_engine_lock;
/* /*
@@ -172,8 +168,4 @@ typedef struct st_engine_pile ENGINE_PILE;
DEFINE_LHASH_OF(ENGINE_PILE); DEFINE_LHASH_OF(ENGINE_PILE);
#ifdef __cplusplus
}
#endif
#endif /* HEADER_ENGINE_INT_H */ #endif /* HEADER_ENGINE_INT_H */
-11
View File
@@ -10,13 +10,6 @@
#ifndef HEADER_HMAC_LCL_H #ifndef HEADER_HMAC_LCL_H
# define HEADER_HMAC_LCL_H # define HEADER_HMAC_LCL_H
#ifdef __cplusplus
extern "C" {
#endif
#if 0 /* emacs indentation fix */
}
#endif
struct hmac_ctx_st { struct hmac_ctx_st {
const EVP_MD *md; const EVP_MD *md;
EVP_MD_CTX *md_ctx; EVP_MD_CTX *md_ctx;
@@ -26,8 +19,4 @@ struct hmac_ctx_st {
unsigned char key[HMAC_MAX_MD_CBLOCK]; unsigned char key[HMAC_MAX_MD_CBLOCK];
}; };
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif #endif
-8
View File
@@ -25,10 +25,6 @@
# define ARIA_BLOCK_SIZE 16 /* Size of each encryption/decryption block */ # define ARIA_BLOCK_SIZE 16 /* Size of each encryption/decryption block */
# define ARIA_MAX_KEYS 17 /* Number of keys needed in the worst case */ # define ARIA_MAX_KEYS 17 /* Number of keys needed in the worst case */
# ifdef __cplusplus
extern "C" {
# endif
typedef union { typedef union {
unsigned char c[ARIA_BLOCK_SIZE]; unsigned char c[ARIA_BLOCK_SIZE];
unsigned int u[ARIA_BLOCK_SIZE / sizeof(unsigned int)]; unsigned int u[ARIA_BLOCK_SIZE / sizeof(unsigned int)];
@@ -51,8 +47,4 @@ int aria_set_decrypt_key(const unsigned char *userKey, const int bits,
void aria_encrypt(const unsigned char *in, unsigned char *out, void aria_encrypt(const unsigned char *in, unsigned char *out,
const ARIA_KEY *key); const ARIA_KEY *key);
# ifdef __cplusplus
}
# endif
#endif #endif
-8
View File
@@ -13,10 +13,6 @@
# include <openssl/bn.h> # include <openssl/bn.h>
# include <limits.h> # include <limits.h>
#ifdef __cplusplus
extern "C" {
#endif
BIGNUM *bn_wexpand(BIGNUM *a, int words); BIGNUM *bn_wexpand(BIGNUM *a, int words);
BIGNUM *bn_expand2(BIGNUM *a, int words); BIGNUM *bn_expand2(BIGNUM *a, int words);
@@ -64,8 +60,4 @@ void bn_set_static_words(BIGNUM *a, BN_ULONG *words, int size);
*/ */
int bn_set_words(BIGNUM *a, BN_ULONG *words, int num_words); int bn_set_words(BIGNUM *a, BN_ULONG *words, int num_words);
#ifdef __cplusplus
}
#endif
#endif #endif
-7
View File
@@ -12,10 +12,6 @@
#include <stddef.h> #include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/* /*
* ChaCha20_ctr32 encrypts |len| bytes from |inp| with the given key and * ChaCha20_ctr32 encrypts |len| bytes from |inp| with the given key and
* nonce and writes the result to |out|, which may be equal to |inp|. * nonce and writes the result to |out|, which may be equal to |inp|.
@@ -43,7 +39,4 @@ void ChaCha20_ctr32(unsigned char *out, const unsigned char *inp,
#define CHACHA_CTR_SIZE 16 #define CHACHA_CTR_SIZE 16
#define CHACHA_BLK_SIZE 64 #define CHACHA_BLK_SIZE 64
#ifdef __cplusplus
}
#endif
#endif #endif
-8
View File
@@ -15,10 +15,6 @@
# ifndef OPENSSL_NO_SM2 # ifndef OPENSSL_NO_SM2
# ifdef __cplusplus
extern "C" {
# endif
# include <openssl/ec.h> # include <openssl/ec.h>
/* The default user id as specified in GM/T 0009-2012 */ /* The default user id as specified in GM/T 0009-2012 */
@@ -74,9 +70,5 @@ int sm2_decrypt(const EC_KEY *key,
const uint8_t *ciphertext, const uint8_t *ciphertext,
size_t ciphertext_len, uint8_t *ptext_buf, size_t *ptext_len); size_t ciphertext_len, uint8_t *ptext_buf, size_t *ptext_len);
# ifdef __cplusplus
}
# endif
# endif /* OPENSSL_NO_SM2 */ # endif /* OPENSSL_NO_SM2 */
#endif #endif
-3
View File
@@ -15,9 +15,6 @@
# ifndef OPENSSL_NO_SM2 # ifndef OPENSSL_NO_SM2
# ifdef __cplusplus
extern "C"
# endif
int ERR_load_SM2_strings(void); int ERR_load_SM2_strings(void);
/* /*
-7
View File
@@ -14,10 +14,6 @@
# include <openssl/store.h> # include <openssl/store.h>
# include <openssl/ui.h> # include <openssl/ui.h>
# ifdef __cplusplus
extern "C" {
# endif
/* /*
* Two functions to read PEM data off an already opened BIO. To be used * Two functions to read PEM data off an already opened BIO. To be used
* instead of OSSLSTORE_open() and OSSLSTORE_close(). Everything is done * instead of OSSLSTORE_open() and OSSLSTORE_close(). Everything is done
@@ -27,7 +23,4 @@ OSSL_STORE_CTX *ossl_store_attach_pem_bio(BIO *bp, const UI_METHOD *ui_method,
void *ui_data); void *ui_data);
int ossl_store_detach_pem_bio(OSSL_STORE_CTX *ctx); int ossl_store_detach_pem_bio(OSSL_STORE_CTX *ctx);
# ifdef __cplusplus
}
# endif
#endif #endif
-8
View File
@@ -45,10 +45,6 @@ typedef unsigned int seed_word;
# endif # endif
#ifdef __cplusplus
extern "C" {
#endif
# define char2word(c, i) \ # define char2word(c, i) \
(i) = ((((seed_word)(c)[0]) << 24) | (((seed_word)(c)[1]) << 16) | (((seed_word)(c)[2]) << 8) | ((seed_word)(c)[3])) (i) = ((((seed_word)(c)[0]) << 24) | (((seed_word)(c)[1]) << 16) | (((seed_word)(c)[2]) << 8) | ((seed_word)(c)[3]))
@@ -113,8 +109,4 @@ extern "C" {
(X1) ^= (T0); \ (X1) ^= (T0); \
(X2) ^= (T1) (X2) ^= (T1)
#ifdef __cplusplus
}
#endif
#endif /* HEADER_SEED_LOCL_H */ #endif /* HEADER_SEED_LOCL_H */
+1 -1
View File
@@ -254,7 +254,7 @@ for($i=0;$i<16;$i++) { &BODY_00_15($i,@V); unshift(@V,pop(@V)); }
$code.=".Lrounds_16_xx:\n"; $code.=".Lrounds_16_xx:\n";
for (;$i<32;$i++) { &BODY_16_XX($i,@V); unshift(@V,pop(@V)); } for (;$i<32;$i++) { &BODY_16_XX($i,@V); unshift(@V,pop(@V)); }
$code.=<<___; $code.=<<___;
#if __ARM_ARCH__>=7 #ifdef __thumb2__
ite eq @ Thumb2 thing, sanity check in ARM ite eq @ Thumb2 thing, sanity check in ARM
#endif #endif
ldreq $t3,[sp,#16*4] @ pull ctx ldreq $t3,[sp,#16*4] @ pull ctx
+2 -2
View File
@@ -157,7 +157,7 @@ $code.=<<___;
teq $t0,#$magic teq $t0,#$magic
ldr $t3,[sp,#$Coff+0] @ c.lo ldr $t3,[sp,#$Coff+0] @ c.lo
#if __ARM_ARCH__>=7 #ifdef __thumb2__
it eq @ Thumb2 thing, sanity check in ARM it eq @ Thumb2 thing, sanity check in ARM
#endif #endif
orreq $Ktbl,$Ktbl,#1 orreq $Ktbl,$Ktbl,#1
@@ -411,7 +411,7 @@ $code.=<<___;
___ ___
&BODY_00_15(0x17); &BODY_00_15(0x17);
$code.=<<___; $code.=<<___;
#if __ARM_ARCH__>=7 #ifdef __thumb2__
ittt eq @ Thumb2 thing, sanity check in ARM ittt eq @ Thumb2 thing, sanity check in ARM
#endif #endif
ldreq $t0,[sp,#`$Xoff+8*(16-1)`+0] ldreq $t0,[sp,#`$Xoff+8*(16-1)`+0]
-7
View File
@@ -10,10 +10,6 @@
#ifndef HEADER_V3_ADMISSION_H #ifndef HEADER_V3_ADMISSION_H
# define HEADER_V3_ADMISSION_H # define HEADER_V3_ADMISSION_H
#ifdef __cplusplus
extern "C" {
#endif
struct NamingAuthority_st { struct NamingAuthority_st {
ASN1_OBJECT* namingAuthorityId; ASN1_OBJECT* namingAuthorityId;
ASN1_IA5STRING* namingAuthorityUrl; ASN1_IA5STRING* namingAuthorityUrl;
@@ -39,7 +35,4 @@ struct AdmissionSyntax_st {
STACK_OF(ADMISSIONS)* contentsOfAdmissions; STACK_OF(ADMISSIONS)* contentsOfAdmissions;
}; };
#ifdef __cplusplus
}
#endif
#endif #endif
+2 -2
View File
@@ -11,10 +11,10 @@ ASN1_INTEGER_get_int64, ASN1_INTEGER_get, ASN1_INTEGER_set_int64, ASN1_INTEGER_s
#include <openssl/asn1.h> #include <openssl/asn1.h>
int ASN1_INTEGER_get_int64(int64_t *pr, const ASN1_INTEGER *a); int ASN1_INTEGER_get_int64(int64_t *pr, const ASN1_INTEGER *a);
int ASN1_INTEGER_get(const ASN1_INTEGER *a, long v); long ASN1_INTEGER_get(const ASN1_INTEGER *a);
int ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r); int ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r);
long ASN1_INTEGER_set(const ASN1_INTEGER *a); int ASN1_INTEGER_set(const ASN1_INTEGER *a, long v);
int ASN1_INTEGER_get_uint64(uint64_t *pr, const ASN1_INTEGER *a); int ASN1_INTEGER_get_uint64(uint64_t *pr, const ASN1_INTEGER *a);
int ASN1_INTEGER_set_uint64(ASN1_INTEGER *a, uint64_t r); int ASN1_INTEGER_set_uint64(ASN1_INTEGER *a, uint64_t r);
+29 -1
View File
@@ -8,7 +8,8 @@ OCSP_resp_get0_id,
OCSP_resp_get1_id, OCSP_resp_get1_id,
OCSP_resp_get0_produced_at, OCSP_resp_get0_produced_at,
OCSP_resp_find_status, OCSP_resp_count, OCSP_resp_get0, OCSP_resp_find, OCSP_resp_find_status, OCSP_resp_count, OCSP_resp_get0, OCSP_resp_find,
OCSP_single_get0_status, OCSP_check_validity OCSP_single_get0_status, OCSP_check_validity,
OCSP_basic_verify
- OCSP response utility functions - OCSP response utility functions
=head1 SYNOPSIS =head1 SYNOPSIS
@@ -48,6 +49,9 @@ OCSP_single_get0_status, OCSP_check_validity
ASN1_GENERALIZEDTIME *nextupd, ASN1_GENERALIZEDTIME *nextupd,
long sec, long maxsec); long sec, long maxsec);
int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs,
X509_STORE *st, unsigned long flags);
=head1 DESCRIPTION =head1 DESCRIPTION
OCSP_resp_find_status() searches B<bs> for an OCSP response for B<id>. If it is OCSP_resp_find_status() searches B<bs> for an OCSP response for B<id>. If it is
@@ -100,6 +104,27 @@ OCSP_single_get0_status(). If B<sec> is non-zero it indicates how many seconds
leeway should be allowed in the check. If B<maxsec> is positive it indicates leeway should be allowed in the check. If B<maxsec> is positive it indicates
the maximum age of B<thisupd> in seconds. the maximum age of B<thisupd> in seconds.
OCSP_basic_verify() checks that the basic response message B<bs> is correctly
signed and that the signer certificate can be validated. It takes B<st> as
the trusted store and B<certs> as a set of untrusted intermediate certificates.
The function first tries to find the signer certificate of the response
in <certs>. It also searches the certificates the responder may have included
in B<bs> unless the B<flags> contain B<OCSP_NOINTERN>.
It fails if the signer certificate cannot be found.
Next, the function checks the signature of B<bs> and fails on error
unless the B<flags> contain B<OCSP_NOSIGS>. Then the function already returns
success if the B<flags> contain B<OCSP_NOVERIFY> or if the signer certificate
was found in B<certs> and the B<flags> contain B<OCSP_TRUSTOTHER>.
Otherwise the function continues by validating the signer certificate.
To this end, all certificates in B<cert> and in B<bs> are considered as
untrusted certificates for the construction of the validation path for the
signer certificate unless the B<OCSP_NOCHAIN> flag is set. After successful path
validation the function returns success if the B<OCSP_NOCHECKS> flag is set.
Otherwise it verifies that the signer certificate meets the OCSP issuer
criteria including potential delegation. If this does not succeed and the
B<flags> do not contain B<OCSP_NOEXPLICIT> the function checks for explicit
trust for OCSP signing in the root CA certificate.
=head1 RETURN VALUES =head1 RETURN VALUES
OCSP_resp_find_status() returns 1 if B<id> is found in B<bs> and 0 otherwise. OCSP_resp_find_status() returns 1 if B<id> is found in B<bs> and 0 otherwise.
@@ -119,6 +144,9 @@ occurred.
OCSP_resp_get0_signer() returns 1 if the signing certificate was located, OCSP_resp_get0_signer() returns 1 if the signing certificate was located,
or 0 on error. or 0 on error.
OCSP_basic_verify() returns 1 on success, 0 on error, or -1 on fatal error such
as malloc failure.
=head1 NOTES =head1 NOTES
Applications will typically call OCSP_resp_find_status() using the certificate Applications will typically call OCSP_resp_find_status() using the certificate
+1
View File
@@ -54,6 +54,7 @@
(arglist-close . c-lineup-arglist) ; From "gnu" style (arglist-close . c-lineup-arglist) ; From "gnu" style
(inline-open . 0) ; From "gnu" style (inline-open . 0) ; From "gnu" style
(brace-list-open . +) ; From "gnu" style (brace-list-open . +) ; From "gnu" style
(inextern-lang . 0) ; Don't indent inside extern block
(topmost-intro-cont first c-lineup-topmost-intro-cont (topmost-intro-cont first c-lineup-topmost-intro-cont
c-lineup-gnu-DEFUN-intro-cont) ; From "gnu" style c-lineup-gnu-DEFUN-intro-cont) ; From "gnu" style
) )
-8
View File
@@ -22,10 +22,6 @@
* outside; this file e_os.h is not part of the exported interface. * outside; this file e_os.h is not part of the exported interface.
*/ */
#ifdef __cplusplus
extern "C" {
#endif
# ifndef DEVRANDOM # ifndef DEVRANDOM
/* /*
* set this to a comma-separated list of 'random' device files to try out. By * set this to a comma-separated list of 'random' device files to try out. By
@@ -325,8 +321,4 @@ struct servent *getservbyname(const char *name, const char *proto);
# define CRYPTO_memcmp memcmp # define CRYPTO_memcmp memcmp
#endif #endif
#ifdef __cplusplus
}
#endif
#endif #endif
+40 -34
View File
@@ -148,7 +148,7 @@ static int afalg_setup_async_event_notification(afalg_aio *aio)
/* Async mode */ /* Async mode */
waitctx = ASYNC_get_wait_ctx(job); waitctx = ASYNC_get_wait_ctx(job);
if (waitctx == NULL) { if (waitctx == NULL) {
ALG_WARN("%s: ASYNC_get_wait_ctx error", __func__); ALG_WARN("%s(%d): ASYNC_get_wait_ctx error", __FILE__, __LINE__);
return 0; return 0;
} }
/* Get waitfd from ASYNC_WAIT_CTX if it is already set */ /* Get waitfd from ASYNC_WAIT_CTX if it is already set */
@@ -161,7 +161,8 @@ static int afalg_setup_async_event_notification(afalg_aio *aio)
*/ */
aio->efd = eventfd(0); aio->efd = eventfd(0);
if (aio->efd == -1) { if (aio->efd == -1) {
ALG_PERR("%s: Failed to get eventfd : ", __func__); ALG_PERR("%s(%d): Failed to get eventfd : ", __FILE__,
__LINE__);
AFALGerr(AFALG_F_AFALG_SETUP_ASYNC_EVENT_NOTIFICATION, AFALGerr(AFALG_F_AFALG_SETUP_ASYNC_EVENT_NOTIFICATION,
AFALG_R_EVENTFD_FAILED); AFALG_R_EVENTFD_FAILED);
return 0; return 0;
@@ -170,14 +171,14 @@ static int afalg_setup_async_event_notification(afalg_aio *aio)
aio->efd, custom, aio->efd, custom,
afalg_waitfd_cleanup); afalg_waitfd_cleanup);
if (ret == 0) { if (ret == 0) {
ALG_WARN("%s: Failed to set wait fd", __func__); ALG_WARN("%s(%d): Failed to set wait fd", __FILE__, __LINE__);
close(aio->efd); close(aio->efd);
return 0; return 0;
} }
/* make fd non-blocking in async mode */ /* make fd non-blocking in async mode */
if (fcntl(aio->efd, F_SETFL, O_NONBLOCK) != 0) { if (fcntl(aio->efd, F_SETFL, O_NONBLOCK) != 0) {
ALG_WARN("%s: Failed to set event fd as NONBLOCKING", ALG_WARN("%s(%d): Failed to set event fd as NONBLOCKING",
__func__); __FILE__, __LINE__);
} }
} }
aio->mode = MODE_ASYNC; aio->mode = MODE_ASYNC;
@@ -185,7 +186,7 @@ static int afalg_setup_async_event_notification(afalg_aio *aio)
/* Sync mode */ /* Sync mode */
aio->efd = eventfd(0); aio->efd = eventfd(0);
if (aio->efd == -1) { if (aio->efd == -1) {
ALG_PERR("%s: Failed to get eventfd : ", __func__); ALG_PERR("%s(%d): Failed to get eventfd : ", __FILE__, __LINE__);
AFALGerr(AFALG_F_AFALG_SETUP_ASYNC_EVENT_NOTIFICATION, AFALGerr(AFALG_F_AFALG_SETUP_ASYNC_EVENT_NOTIFICATION,
AFALG_R_EVENTFD_FAILED); AFALG_R_EVENTFD_FAILED);
return 0; return 0;
@@ -203,7 +204,7 @@ static int afalg_init_aio(afalg_aio *aio)
aio->aio_ctx = 0; aio->aio_ctx = 0;
r = io_setup(MAX_INFLIGHTS, &aio->aio_ctx); r = io_setup(MAX_INFLIGHTS, &aio->aio_ctx);
if (r < 0) { if (r < 0) {
ALG_PERR("%s: io_setup error : ", __func__); ALG_PERR("%s(%d): io_setup error : ", __FILE__, __LINE__);
AFALGerr(AFALG_F_AFALG_INIT_AIO, AFALG_R_IO_SETUP_FAILED); AFALGerr(AFALG_F_AFALG_INIT_AIO, AFALG_R_IO_SETUP_FAILED);
return 0; return 0;
} }
@@ -257,7 +258,7 @@ static int afalg_fin_cipher_aio(afalg_aio *aio, int sfd, unsigned char *buf,
*/ */
r = io_read(aio->aio_ctx, 1, &cb); r = io_read(aio->aio_ctx, 1, &cb);
if (r < 0) { if (r < 0) {
ALG_PWARN("%s: io_read failed : ", __func__); ALG_PWARN("%s(%d): io_read failed : ", __FILE__, __LINE__);
return 0; return 0;
} }
@@ -270,11 +271,11 @@ static int afalg_fin_cipher_aio(afalg_aio *aio, int sfd, unsigned char *buf,
if (r < 0) { if (r < 0) {
if (errno == EAGAIN || errno == EWOULDBLOCK) if (errno == EAGAIN || errno == EWOULDBLOCK)
continue; continue;
ALG_PERR("%s: read failed for event fd : ", __func__); ALG_PERR("%s(%d): read failed for event fd : ", __FILE__, __LINE__);
return 0; return 0;
} else if (r == 0 || eval <= 0) { } else if (r == 0 || eval <= 0) {
ALG_WARN("%s: eventfd read %d bytes, eval = %lu\n", __func__, r, ALG_WARN("%s(%d): eventfd read %d bytes, eval = %lu\n", __FILE__,
eval); __LINE__, r, eval);
} }
if (eval > 0) { if (eval > 0) {
@@ -294,8 +295,8 @@ static int afalg_fin_cipher_aio(afalg_aio *aio, int sfd, unsigned char *buf,
if (events[0].res == -EBUSY && retry++ < 3) { if (events[0].res == -EBUSY && retry++ < 3) {
r = io_read(aio->aio_ctx, 1, &cb); r = io_read(aio->aio_ctx, 1, &cb);
if (r < 0) { if (r < 0) {
ALG_PERR("%s: retry %d for io_read failed : ", ALG_PERR("%s(%d): retry %d for io_read failed : ",
__func__, retry); __FILE__, __LINE__, retry);
return 0; return 0;
} }
continue; continue;
@@ -305,18 +306,19 @@ static int afalg_fin_cipher_aio(afalg_aio *aio, int sfd, unsigned char *buf,
* condition for this instance of operation. * condition for this instance of operation.
*/ */
ALG_WARN ALG_WARN
("%s: Crypto Operation failed with code %lld\n", ("%s(%d): Crypto Operation failed with code %lld\n",
__func__, events[0].res); __FILE__, __LINE__, events[0].res);
return 0; return 0;
} }
} }
/* Operation successful. */ /* Operation successful. */
done = 1; done = 1;
} else if (r < 0) { } else if (r < 0) {
ALG_PERR("%s: io_getevents failed : ", __func__); ALG_PERR("%s(%d): io_getevents failed : ", __FILE__, __LINE__);
return 0; return 0;
} else { } else {
ALG_WARN("%s: io_geteventd read 0 bytes\n", __func__); ALG_WARN("%s(%d): io_geteventd read 0 bytes\n", __FILE__,
__LINE__);
} }
} }
} while (!done); } while (!done);
@@ -352,7 +354,7 @@ static ossl_inline int afalg_set_key(afalg_ctx *actx, const unsigned char *key,
int ret; int ret;
ret = setsockopt(actx->bfd, SOL_ALG, ALG_SET_KEY, key, klen); ret = setsockopt(actx->bfd, SOL_ALG, ALG_SET_KEY, key, klen);
if (ret < 0) { if (ret < 0) {
ALG_PERR("%s: Failed to set socket option : ", __func__); ALG_PERR("%s(%d): Failed to set socket option : ", __FILE__, __LINE__);
AFALGerr(AFALG_F_AFALG_SET_KEY, AFALG_R_SOCKET_SET_KEY_FAILED); AFALGerr(AFALG_F_AFALG_SET_KEY, AFALG_R_SOCKET_SET_KEY_FAILED);
return 0; return 0;
} }
@@ -376,21 +378,21 @@ static int afalg_create_sk(afalg_ctx *actx, const char *ciphertype,
actx->bfd = socket(AF_ALG, SOCK_SEQPACKET, 0); actx->bfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
if (actx->bfd == -1) { if (actx->bfd == -1) {
ALG_PERR("%s: Failed to open socket : ", __func__); ALG_PERR("%s(%d): Failed to open socket : ", __FILE__, __LINE__);
AFALGerr(AFALG_F_AFALG_CREATE_SK, AFALG_R_SOCKET_CREATE_FAILED); AFALGerr(AFALG_F_AFALG_CREATE_SK, AFALG_R_SOCKET_CREATE_FAILED);
goto err; goto err;
} }
r = bind(actx->bfd, (struct sockaddr *)&sa, sizeof(sa)); r = bind(actx->bfd, (struct sockaddr *)&sa, sizeof(sa));
if (r < 0) { if (r < 0) {
ALG_PERR("%s: Failed to bind socket : ", __func__); ALG_PERR("%s(%d): Failed to bind socket : ", __FILE__, __LINE__);
AFALGerr(AFALG_F_AFALG_CREATE_SK, AFALG_R_SOCKET_BIND_FAILED); AFALGerr(AFALG_F_AFALG_CREATE_SK, AFALG_R_SOCKET_BIND_FAILED);
goto err; goto err;
} }
actx->sfd = accept(actx->bfd, NULL, 0); actx->sfd = accept(actx->bfd, NULL, 0);
if (actx->sfd < 0) { if (actx->sfd < 0) {
ALG_PERR("%s: Socket Accept Failed : ", __func__); ALG_PERR("%s(%d): Socket Accept Failed : ", __FILE__, __LINE__);
AFALGerr(AFALG_F_AFALG_CREATE_SK, AFALG_R_SOCKET_ACCEPT_FAILED); AFALGerr(AFALG_F_AFALG_CREATE_SK, AFALG_R_SOCKET_ACCEPT_FAILED);
goto err; goto err;
} }
@@ -452,8 +454,8 @@ static int afalg_start_cipher_sk(afalg_ctx *actx, const unsigned char *in,
/* Sendmsg() sends iv and cipher direction to the kernel */ /* Sendmsg() sends iv and cipher direction to the kernel */
sbytes = sendmsg(actx->sfd, &msg, 0); sbytes = sendmsg(actx->sfd, &msg, 0);
if (sbytes < 0) { if (sbytes < 0) {
ALG_PERR("%s: sendmsg failed for zero copy cipher operation : ", ALG_PERR("%s(%d): sendmsg failed for zero copy cipher operation : ",
__func__); __FILE__, __LINE__);
return 0; return 0;
} }
@@ -463,13 +465,13 @@ static int afalg_start_cipher_sk(afalg_ctx *actx, const unsigned char *in,
*/ */
ret = vmsplice(actx->zc_pipe[1], &iov, 1, SPLICE_F_GIFT); ret = vmsplice(actx->zc_pipe[1], &iov, 1, SPLICE_F_GIFT);
if (ret < 0) { if (ret < 0) {
ALG_PERR("%s: vmsplice failed : ", __func__); ALG_PERR("%s(%d): vmsplice failed : ", __FILE__, __LINE__);
return 0; return 0;
} }
ret = splice(actx->zc_pipe[0], NULL, actx->sfd, NULL, inl, 0); ret = splice(actx->zc_pipe[0], NULL, actx->sfd, NULL, inl, 0);
if (ret < 0) { if (ret < 0) {
ALG_PERR("%s: splice failed : ", __func__); ALG_PERR("%s(%d): splice failed : ", __FILE__, __LINE__);
return 0; return 0;
} }
# else # else
@@ -479,7 +481,8 @@ static int afalg_start_cipher_sk(afalg_ctx *actx, const unsigned char *in,
/* Sendmsg() sends iv, cipher direction and input data to the kernel */ /* Sendmsg() sends iv, cipher direction and input data to the kernel */
sbytes = sendmsg(actx->sfd, &msg, 0); sbytes = sendmsg(actx->sfd, &msg, 0);
if (sbytes < 0) { if (sbytes < 0) {
ALG_PERR("%s: sendmsg failed for cipher operation : ", __func__); ALG_PERR("%s(%d): sendmsg failed for cipher operation : ", __FILE__,
__LINE__);
return 0; return 0;
} }
@@ -502,18 +505,18 @@ static int afalg_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
char ciphername[ALG_MAX_SALG_NAME]; char ciphername[ALG_MAX_SALG_NAME];
if (ctx == NULL || key == NULL) { if (ctx == NULL || key == NULL) {
ALG_WARN("%s: Null Parameter\n", __func__); ALG_WARN("%s(%d): Null Parameter\n", __FILE__, __LINE__);
return 0; return 0;
} }
if (EVP_CIPHER_CTX_cipher(ctx) == NULL) { if (EVP_CIPHER_CTX_cipher(ctx) == NULL) {
ALG_WARN("%s: Cipher object NULL\n", __func__); ALG_WARN("%s(%d): Cipher object NULL\n", __FILE__, __LINE__);
return 0; return 0;
} }
actx = EVP_CIPHER_CTX_get_cipher_data(ctx); actx = EVP_CIPHER_CTX_get_cipher_data(ctx);
if (actx == NULL) { if (actx == NULL) {
ALG_WARN("%s: Cipher data NULL\n", __func__); ALG_WARN("%s(%d): Cipher data NULL\n", __FILE__, __LINE__);
return 0; return 0;
} }
@@ -525,14 +528,15 @@ static int afalg_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
strncpy(ciphername, "cbc(aes)", ALG_MAX_SALG_NAME); strncpy(ciphername, "cbc(aes)", ALG_MAX_SALG_NAME);
break; break;
default: default:
ALG_WARN("%s: Unsupported Cipher type %d\n", __func__, ciphertype); ALG_WARN("%s(%d): Unsupported Cipher type %d\n", __FILE__, __LINE__,
ciphertype);
return 0; return 0;
} }
ciphername[ALG_MAX_SALG_NAME-1]='\0'; ciphername[ALG_MAX_SALG_NAME-1]='\0';
if (ALG_AES_IV_LEN != EVP_CIPHER_CTX_iv_length(ctx)) { if (ALG_AES_IV_LEN != EVP_CIPHER_CTX_iv_length(ctx)) {
ALG_WARN("%s: Unsupported IV length :%d\n", __func__, ALG_WARN("%s(%d): Unsupported IV length :%d\n", __FILE__, __LINE__,
EVP_CIPHER_CTX_iv_length(ctx)); EVP_CIPHER_CTX_iv_length(ctx));
return 0; return 0;
} }
@@ -572,7 +576,8 @@ static int afalg_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
char nxtiv[ALG_AES_IV_LEN] = { 0 }; char nxtiv[ALG_AES_IV_LEN] = { 0 };
if (ctx == NULL || out == NULL || in == NULL) { if (ctx == NULL || out == NULL || in == NULL) {
ALG_WARN("NULL parameter passed to function %s\n", __func__); ALG_WARN("NULL parameter passed to function %s(%d)\n", __FILE__,
__LINE__);
return 0; return 0;
} }
@@ -619,7 +624,8 @@ static int afalg_cipher_cleanup(EVP_CIPHER_CTX *ctx)
afalg_ctx *actx; afalg_ctx *actx;
if (ctx == NULL) { if (ctx == NULL) {
ALG_WARN("NULL parameter passed to function %s\n", __func__); ALG_WARN("NULL parameter passed to function %s(%d)\n", __FILE__,
__LINE__);
return 0; return 0;
} }
+2 -2
View File
@@ -199,10 +199,10 @@ struct padlock_cipher_data {
}; };
/* Interface to assembler module */ /* Interface to assembler module */
unsigned int padlock_capability(); unsigned int padlock_capability(void);
void padlock_key_bswap(AES_KEY *key); void padlock_key_bswap(AES_KEY *key);
void padlock_verify_context(struct padlock_cipher_data *ctx); void padlock_verify_context(struct padlock_cipher_data *ctx);
void padlock_reload_key(); void padlock_reload_key(void);
void padlock_aes_block(void *out, const void *inp, void padlock_aes_block(void *out, const void *inp,
struct padlock_cipher_data *ctx); struct padlock_cipher_data *ctx);
int padlock_ecb_encrypt(void *out, const void *inp, int padlock_ecb_encrypt(void *out, const void *inp,
-9
View File
@@ -12,11 +12,6 @@
#include <openssl/conf.h> #include <openssl/conf.h>
#ifdef __cplusplus
extern "C" {
#endif
struct ossl_init_settings_st { struct ossl_init_settings_st {
char *appname; char *appname;
}; };
@@ -25,8 +20,4 @@ void openssl_config_int(const char *appname);
void openssl_no_config_int(void); void openssl_no_config_int(void);
void conf_modules_free_int(void); void conf_modules_free_int(void);
#ifdef __cplusplus
}
#endif
#endif #endif
-8
View File
@@ -14,10 +14,6 @@
# include <string.h> # include <string.h>
# include <openssl/e_os2.h> /* For 'ossl_inline' */ # include <openssl/e_os2.h> /* For 'ossl_inline' */
#ifdef __cplusplus
extern "C" {
#endif
/*- /*-
* The boolean methods return a bitmask of all ones (0xff...f) for true * The boolean methods return a bitmask of all ones (0xff...f) for true
* and 0 for false. This is useful for choosing a value based on the result * and 0 for false. This is useful for choosing a value based on the result
@@ -328,8 +324,4 @@ static ossl_inline void constant_time_lookup(void *out,
} }
} }
#ifdef __cplusplus
}
#endif
#endif /* HEADER_CONSTANT_TIME_LOCL_H */ #endif /* HEADER_CONSTANT_TIME_LOCL_H */
-8
View File
@@ -25,10 +25,6 @@
# include <openssl/err.h> # include <openssl/err.h>
# include "internal/nelem.h" # include "internal/nelem.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef NDEBUG #ifdef NDEBUG
# define ossl_assert(x) ((x) != 0) # define ossl_assert(x) ((x) != 0)
#else #else
@@ -96,8 +92,4 @@ void *openssl_fopen(const char *filename, const char *mode);
uint32_t OPENSSL_rdtsc(void); uint32_t OPENSSL_rdtsc(void);
#ifdef __cplusplus
}
#endif
#endif #endif
-7
View File
@@ -13,10 +13,6 @@
# include <openssl/crypto.h> # include <openssl/crypto.h>
# include "internal/dsoerr.h" # include "internal/dsoerr.h"
#ifdef __cplusplus
extern "C" {
#endif
/* These values are used as commands to DSO_ctrl() */ /* These values are used as commands to DSO_ctrl() */
# define DSO_CTRL_GET_FLAGS 1 # define DSO_CTRL_GET_FLAGS 1
# define DSO_CTRL_SET_FLAGS 2 # define DSO_CTRL_SET_FLAGS 2
@@ -166,7 +162,4 @@ void *DSO_global_lookup(const char *name);
int ERR_load_DSO_strings(void); int ERR_load_DSO_strings(void);
# ifdef __cplusplus
}
# endif
#endif #endif
-3
View File
@@ -15,9 +15,6 @@
# ifndef OPENSSL_NO_DSO # ifndef OPENSSL_NO_DSO
# ifdef __cplusplus
extern "C"
# endif
int ERR_load_DSO_strings(void); int ERR_load_DSO_strings(void);
/* /*
-8
View File
@@ -39,10 +39,6 @@
#ifndef O_DIR_H #ifndef O_DIR_H
# define O_DIR_H # define O_DIR_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OPENSSL_dir_context_st OPENSSL_DIR_CTX; typedef struct OPENSSL_dir_context_st OPENSSL_DIR_CTX;
/* /*
@@ -53,8 +49,4 @@ const char *OPENSSL_DIR_read(OPENSSL_DIR_CTX **ctx, const char *directory);
/* returns 1 on success, 0 on error */ /* returns 1 on success, 0 on error */
int OPENSSL_DIR_end(OPENSSL_DIR_CTX **ctx); int OPENSSL_DIR_end(OPENSSL_DIR_CTX **ctx);
#ifdef __cplusplus
}
#endif
#endif /* LPDIR_H */ #endif /* LPDIR_H */
-8
View File
@@ -18,10 +18,6 @@
# include "internal/numbers.h" # include "internal/numbers.h"
# ifdef __cplusplus
extern "C" {
# endif
typedef struct { typedef struct {
/* Pointer to where we are currently reading from */ /* Pointer to where we are currently reading from */
const unsigned char *curr; const unsigned char *curr;
@@ -875,8 +871,4 @@ unsigned char *WPACKET_get_curr(WPACKET *pkt);
/* Release resources in a WPACKET if a failure has occurred. */ /* Release resources in a WPACKET if a failure has occurred. */
void WPACKET_cleanup(WPACKET *pkt); void WPACKET_cleanup(WPACKET *pkt);
# ifdef __cplusplus
}
# endif
#endif /* HEADER_PACKET_LOCL_H */ #endif /* HEADER_PACKET_LOCL_H */
+37 -13
View File
@@ -2128,25 +2128,48 @@ err:
return st; return st;
} }
static int test_3_is_prime(void) static int primes[] = { 2, 3, 5, 7, 17863 };
static int test_is_prime(int i)
{ {
int ret = 0; int ret = 0;
BIGNUM *r = NULL; BIGNUM *r = NULL;
int trial;
/* if (!TEST_ptr(r = BN_new()))
* For a long time, small primes were not considered prime when
* do_trial_division was set.
*/
if (!TEST_ptr(r = BN_new())
|| !TEST_true(BN_set_word(r, 3))
|| !TEST_int_eq(BN_is_prime_fasttest_ex(r, 3 /* nchecks */, ctx,
0 /* do_trial_division */, NULL), 1)
|| !TEST_int_eq(BN_is_prime_fasttest_ex(r, 3 /* nchecks */, ctx,
1 /* do_trial_division */, NULL), 1))
goto err; goto err;
ret = 1; for (trial = 0; trial <= 1; ++trial) {
if (!TEST_true(BN_set_word(r, primes[i]))
|| !TEST_int_eq(BN_is_prime_fasttest_ex(r, 1, ctx, trial, NULL),
1))
goto err;
}
ret = 1;
err:
BN_free(r);
return ret;
}
static int not_primes[] = { -1, 0, 1, 4 };
static int test_not_prime(int i)
{
int ret = 0;
BIGNUM *r = NULL;
int trial;
if (!TEST_ptr(r = BN_new()))
goto err;
for (trial = 0; trial <= 1; ++trial) {
if (!TEST_true(BN_set_word(r, not_primes[i]))
|| !TEST_false(BN_is_prime_fasttest_ex(r, 1, ctx, trial, NULL)))
goto err;
}
ret = 1;
err: err:
BN_free(r); BN_free(r);
return ret; return ret;
@@ -2250,7 +2273,8 @@ int setup_tests(void)
ADD_TEST(test_gf2m_modsqrt); ADD_TEST(test_gf2m_modsqrt);
ADD_TEST(test_gf2m_modsolvequad); ADD_TEST(test_gf2m_modsolvequad);
#endif #endif
ADD_TEST(test_3_is_prime); ADD_ALL_TESTS(test_is_prime, (int)OSSL_NELEM(primes));
ADD_ALL_TESTS(test_not_prime, (int)OSSL_NELEM(not_primes));
} else { } else {
ADD_ALL_TESTS(run_file_tests, n); ADD_ALL_TESTS(run_file_tests, n);
} }
+1 -1
View File
@@ -1167,7 +1167,7 @@ static int internal_curve_test_method(int n)
* implementations of several NIST curves with characteristic > 3. * implementations of several NIST curves with characteristic > 3.
*/ */
struct nistp_test_params { struct nistp_test_params {
const EC_METHOD *(*meth) (); const EC_METHOD *(*meth) (void);
int degree; int degree;
/* /*
* Qx, Qy and D are taken from * Qx, Qy and D are taken from
+1
View File
@@ -19,6 +19,7 @@ use lib bldtop_dir('.');
use configdata; use configdata;
plan skip_all => "Test only supported in a shared build" if disabled("shared"); plan skip_all => "Test only supported in a shared build" if disabled("shared");
plan skip_all => "Test is disabled on AIX" if config('target') =~ m|^aix|;
plan tests => 4; plan tests => 4;
+1 -1
View File
@@ -209,7 +209,7 @@ static int test_sm2_crypt(const EC_GROUP *group,
static int sm2_crypt_test(void) static int sm2_crypt_test(void)
{ {
int testresult = 1; int testresult = 0;
EC_GROUP *test_group = EC_GROUP *test_group =
create_EC_group create_EC_group
("8542D69E4C044F18E8B92435BF6FF7DE457283915C45517D722EDB8B08F1DFC3", ("8542D69E4C044F18E8B92435BF6FF7DE457283915C45517D722EDB8B08F1DFC3",
+2 -2
View File
@@ -26,7 +26,7 @@
*/ */
typedef struct test_info { typedef struct test_info {
const char *test_case_name; const char *test_case_name;
int (*test_fn) (); int (*test_fn) (void);
int (*param_test_fn)(int idx); int (*param_test_fn)(int idx);
int num; int num;
@@ -74,7 +74,7 @@ int subtest_level(void)
} }
#ifndef OPENSSL_NO_CRYPTO_MDEBUG #ifndef OPENSSL_NO_CRYPTO_MDEBUG
static int should_report_leaks() static int should_report_leaks(void)
{ {
/* /*
* When compiled with enable-crypto-mdebug, OPENSSL_DEBUG_MEMORY=0 * When compiled with enable-crypto-mdebug, OPENSSL_DEBUG_MEMORY=0
+2 -2
View File
@@ -101,7 +101,7 @@ SunOS|IRIX*)
;; ;;
esac esac
{- output_off() if $config{ex_libs} !~ /,-rpath,/; ""; -} {- output_off() unless grep (/-rpath\b/, @{$config{LDFLAGS}}); ""; -}
if [ -f "$LIBCRYPTOSO" -a -z "$preload_var" ]; then if [ -f "$LIBCRYPTOSO" -a -z "$preload_var" ]; then
# Following three lines are major excuse for isolating them into # Following three lines are major excuse for isolating them into
# this wrapper script. Original reason for setting LD_PRELOAD # this wrapper script. Original reason for setting LD_PRELOAD
@@ -117,7 +117,7 @@ if [ -f "$LIBCRYPTOSO" -a -z "$preload_var" ]; then
DYLD_INSERT_LIBRARIES="$LIBCRYPTOSO:$LIBSSLSO" # MacOS X DYLD_INSERT_LIBRARIES="$LIBCRYPTOSO:$LIBSSLSO" # MacOS X
export LD_PRELOAD _RLD_LIST DYLD_INSERT_LIBRARIES export LD_PRELOAD _RLD_LIST DYLD_INSERT_LIBRARIES
fi fi
{- output_on() if $config{ex_libs} !~ /,-rpath,/; ""; -} {- output_on() unless grep (/-rpath\b/, @{$config{LDFLAGS}}); ""; -}
cmd="$1"; [ -x "$cmd" ] || cmd="$cmd${EXE_EXT}" cmd="$1"; [ -x "$cmd" ] || cmd="$cmd${EXE_EXT}"
shift shift