]> git.ipfire.org Git - thirdparty/openssl.git/log
thirdparty/openssl.git
2 years agoFix Coverity 1503325 use after free
Pauli [Fri, 1 Apr 2022 01:20:26 +0000 (12:20 +1100)] 
Fix Coverity 1503325 use after free

Another reference counting false positive, now negated.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/18014)

2 years agoFix Coverity 1503329 use after free
Pauli [Fri, 1 Apr 2022 01:18:44 +0000 (12:18 +1100)] 
Fix Coverity 1503329 use after free

Another false positive tagged as such

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/18014)

2 years agoFix coverity 1503330 use after free
Pauli [Fri, 1 Apr 2022 01:12:07 +0000 (12:12 +1100)] 
Fix coverity 1503330 use after free

This is a false positive resulting from confusion over up_ref/free.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/18014)

2 years agofix for sslecho in demos echoing garbage #18165
philippe lhardy [Mon, 25 Apr 2022 17:42:16 +0000 (19:42 +0200)] 
fix for sslecho in demos echoing garbage #18165

- getline does set &txbufp content at return, make sure it can be done.
  - fixes warning 'passing argument 1 of ‘getline’ from incompatible pointer type'
- remove OPENSSL_free on non allocated fixed size array
  - fixes 'free(): invalid pointer'

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18177)

2 years agoCorrect NEWS entry about required security level for old versions of TLS, DTLS and SSL
Pauli [Wed, 4 May 2022 01:26:02 +0000 (11:26 +1000)] 
Correct NEWS entry about required security level for old versions of TLS, DTLS and SSL

The entry was incorrect because suites using RSA key exchange without SHA1
were permitted at security level 1.

Partial fix for #18194

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/18234)

(cherry picked from commit 3226a37a4875567f2bf49aa44a727bcb67bb7dcd)

2 years agoRemove the _fetch_by_number functions
Pauli [Wed, 4 May 2022 04:54:13 +0000 (14:54 +1000)] 
Remove the _fetch_by_number functions

These functions are unused and untested.  They are also implemented rather
inefficiently.  If we ever needed them in the future, they'd almost surely
need to be rewritten more efficiently.

Fixes #18227

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18237)

2 years agoAdd method store cache flush and method removal to non-EVP operations
Richard Levitte [Wed, 4 May 2022 07:15:29 +0000 (09:15 +0200)] 
Add method store cache flush and method removal to non-EVP operations

evp_method_store_flush() and evp_method_store_remove_all_provided()
only cover EVP operations, but not encoders, decoders and store loaders.
This adds corresponding methods for those as well.  Without this, their
method stores are never cleaned up when the corresponding providers are
deactivated or otherwise modified.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18151)

2 years agoFor child libctx / provider, don't count self-references in parent
Richard Levitte [Fri, 29 Apr 2022 06:08:06 +0000 (08:08 +0200)] 
For child libctx / provider, don't count self-references in parent

In child library contexts, which contain child "clones" of the
providers the application has in store, one of these children will
always be the provider that creates the child library context; let's
call them self-refering child providers.

For these self-refering child providers, we don't increment the parent
provider reference count, nor do we free the parent provider, as those
become self defeating and hinder the teardown and unloading process
when the application cleans up.

For non self-refering child providers, we must retain this propagation
of reference count to the parent, so that aren't torn down too early,
i.e. when there's still a "foreign" reference (fetched algorithm).

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18151)

2 years agoComplete the cleanup of an algorithm in OSSL_METHOD_STORE
Richard Levitte [Mon, 25 Apr 2022 05:22:27 +0000 (07:22 +0200)] 
Complete the cleanup of an algorithm in OSSL_METHOD_STORE

The `alg_cleanup` didn't properly clear the OPENSSL_SA leaf that it
had just freed the contents of.  Fortunately, `ossl_sa_ALGORITHM_doall_arg()`
allows us to pass the store pointer itself as an extra argument, which
allows a modified `alg_cleanup` to complete the job.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18151)

2 years agoMake it possible to remove methods by the provider that provides them
Richard Levitte [Fri, 22 Apr 2022 14:44:51 +0000 (16:44 +0200)] 
Make it possible to remove methods by the provider that provides them

This adds ossl_method_store_remove_all_provided(), which selectively
removes methods from the given store that are provided by the given
provider.

This also adds the EVP specific evp_method_store_remove_all_provided(),
which matches ossl_method_store_remove_all_provided() but can also
retrieve the correct store to manipulate for EVP functions.

This allows us to modify ossl_provider_self_test() to do the job it's
supposed to do, but through clearly defined functions instead of a
cache flushing call that previously did more than that.

ossl_provider_deactivate() is also modified to remove methods associated
with the deactivated provider, and not just clearing the cache.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18151)

2 years agoDon't empty the method store when flushing the query cache
Richard Levitte [Fri, 22 Apr 2022 09:00:36 +0000 (11:00 +0200)] 
Don't empty the method store when flushing the query cache

When evp_method_store_flush() flushed the query cache, it also freed
all methods in the EVP method store, through an unfortunate call of
ossl_method_store_flush_cache() with an argument saying that all
methods should indeed be dropped.

To undo some of the confusion, ossl_method_store_flush_cache() is
renamed to ossl_method_store_cache_flush_all(), and limited to do
only that.  Some if the items in the internal ALGORITHM structure are
also renamed and commented to clarify what they are for.

Fixes #18150

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18151)

2 years agoRefactor method construction pre- and post-condition
Richard Levitte [Wed, 20 Apr 2022 16:34:09 +0000 (18:34 +0200)] 
Refactor method construction pre- and post-condition

The existing pre- and post-condition functions are supposed to check if
methods have already been created and stored, using provider operation
bits.  This is supposed to only be done for "permanent" method stores.

However, the way the pre-condition was called, it could not know if the
set of implementations to be stored is likely to end up in a "permanent"
or a temporary store.  It needs access to the |no_store| flag returned
by the provider's operation query function, because that call was done
after the pre-condition was called.

This requires a bit of refactoring, primarly of |algorithm_do_this()|,
but also of |ossl_method_construct_precondition()|.

Fixes #18150

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18151)

2 years agoDrop ossl_provider_clear_all_operation_bits() and all uses of it
Richard Levitte [Wed, 20 Apr 2022 14:43:13 +0000 (16:43 +0200)] 
Drop ossl_provider_clear_all_operation_bits() and all uses of it

This is a misused function, as it was called during query cache flush,
when the provider operation bits were meant to record if methods for a
certain operation has already been added to the method store.

Fixes #18150

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18151)

2 years agos_client -proxy / -starttls shouldn't be mutually exclusive
Vita Batrla [Fri, 18 Mar 2022 21:02:50 +0000 (22:02 +0100)] 
s_client -proxy / -starttls shouldn't be mutually exclusive

The option -proxy of openssl s_client works fine. The option
-starttls also works fine. However, try putting both of them
on command line. It breaks, these options don't work together.

The problem is that -proxy option is implemented using starttls_proto
(the option parsing code sets it to PROTO_CONNECT) and -starttls option
overwrites the same variable again based on argument value.

The suggested fix is to independently handle -proxy option before
-starttls so the s_client can connect through HTTP proxy server and
then use STARTTLS command.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17925)

2 years agocrmf_lib.c: Make sure Ed signature for POPO is called without digest
Dr. David von Oheimb [Wed, 27 Apr 2022 17:07:46 +0000 (19:07 +0200)] 
crmf_lib.c: Make sure Ed signature for POPO is called without digest

Fixes #18184

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/18230)

2 years agoX509{,_LOOKUP}: Improve distinction between not found and fatal/internal error
Dr. David von Oheimb [Wed, 3 Mar 2021 19:10:34 +0000 (20:10 +0100)] 
X509{,_LOOKUP}: Improve distinction between not found and fatal/internal error

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/14417)

2 years agoobjects.txt: Add newly registered OIDs according to CMP Updates, for use in extended...
Dr. David von Oheimb [Tue, 15 Jun 2021 20:06:48 +0000 (22:06 +0200)] 
objects.txt: Add newly registered OIDs according to CMP Updates, for use in extended CMPv2

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/15778)

2 years agoopenssl: dhparam: Print warning if -in argument is ignored
Daniel Fiala [Fri, 29 Apr 2022 07:33:49 +0000 (09:33 +0200)] 
openssl: dhparam: Print warning if -in argument is ignored

Fixes: openssl#18146
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18206)

2 years agoFix Coverity 1503314 unchecked return value
Pauli [Thu, 31 Mar 2022 22:59:49 +0000 (09:59 +1100)] 
Fix Coverity 1503314 unchecked return value

Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18013)

2 years agoRemove duplicated #include headers
JHH20 [Mon, 2 May 2022 10:50:04 +0000 (19:50 +0900)] 
Remove duplicated #include headers

CLA: trivial

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18220)

2 years agoCHANGES.md: Attribute the OPENSSL_LH_flush() fix properly
Tomas Mraz [Tue, 3 May 2022 12:57:08 +0000 (14:57 +0200)] 
CHANGES.md: Attribute the OPENSSL_LH_flush() fix properly

Reviewed-by: Matt Caswell <matt@openssl.org>
Release: yes

2 years agoUpdate copyright year
Matt Caswell [Tue, 3 May 2022 10:52:38 +0000 (11:52 +0100)] 
Update copyright year

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Release: yes

2 years agoUpdate CHANGES and NEWS for new release
Matt Caswell [Tue, 26 Apr 2022 13:39:34 +0000 (14:39 +0100)] 
Update CHANGES and NEWS for new release

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Release: yes

2 years agoUpdate Paul's pgp key signature
Pauli [Mon, 2 May 2022 08:16:09 +0000 (18:16 +1000)] 
Update Paul's pgp key signature

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18219)

2 years agoc_rehash: Do not use shell to invoke openssl
Tomas Mraz [Tue, 26 Apr 2022 10:40:24 +0000 (12:40 +0200)] 
c_rehash: Do not use shell to invoke openssl

Except on VMS where it is safe.

This fixes CVE-2022-1292.

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
2 years agoFix the RC4-MD5 cipher
Matt Caswell [Fri, 15 Apr 2022 09:22:59 +0000 (10:22 +0100)] 
Fix the RC4-MD5 cipher

A copy&paste error meant that the RC4-MD5 cipher (used in TLS) used the TLS
AAD data as the MAC key.

CVE-2022-1434

Fixes #18112

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
2 years agoTest ocsp with invalid responses and the "-no_cert_checks" option
Matt Caswell [Wed, 13 Apr 2022 15:47:35 +0000 (16:47 +0100)] 
Test ocsp with invalid responses and the "-no_cert_checks" option

The "-no_cert_checks" option causes the flag OCSP_NOCHECKS to be set.
The bug fixed in the previous commit will cause the ocsp app to respond with
a success result in the case when the OCSP response signing certificate
fails to verify and -no_cert_checks is used - so we test that it fails in
this case.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
2 years agoFix OCSP_basic_verify signer certificate validation
Matt Caswell [Wed, 13 Apr 2022 15:36:54 +0000 (16:36 +0100)] 
Fix OCSP_basic_verify signer certificate validation

The function `OCSP_basic_verify` validates the signer certificate on an OCSP
response. The internal function, ocsp_verify_signer, is responsible for this
and is expected to return a 0 value in the event of a failure to verify.
Unfortunately, due to a bug, it actually returns with a postive success
response in this case. In the normal course of events OCSP_basic_verify
will then continue and will fail anyway in the ocsp_check_issuer function
because the supplied "chain" value will be empty in the case that
ocsp_verify_signer failed to verify the chain. This will cause
OCSP_basic_verify to return with a negative result (fatal error). Normally
in the event of a failure to verify it should return with 0.

However, in the case of the OCSP_NOCHECKS flag being used, OCSP_basic_verify
will return with a positvie result. This could lead to callers trusting an
OCSP Basic response when it should not be.

CVE-2022-1343

Fixes #18053

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
2 years agoAcceleration of chacha20 on aarch64 by SVE
Daniel Hu [Mon, 7 Feb 2022 10:17:06 +0000 (10:17 +0000)] 
Acceleration of chacha20 on aarch64 by SVE

This patch accelerates chacha20 on aarch64 when Scalable Vector Extension
(SVE) is supported by CPU. Tested on modern micro-architecture with
256-bit SVE, it has the potential to improve performance up to 20%

The solution takes a hybrid approach. SVE will handle multi-blocks that fit
the SVE vector length, with Neon/Scalar to process any tail data

Test result:
With SVE
type            1024 bytes   8192 bytes  16384 bytes
ChaCha20        1596208.13k  1650010.79k  1653151.06k

Without SVE (by Neon/Scalar)
type            1024 bytes   8192 bytes  16384 bytes
chacha20        1355487.91k  1372678.83k  1372662.44k

The assembly code has been reviewed internally by
ARM engineer Fangming.Fang@arm.com

Signed-off-by: Daniel Hu <Daniel.Hu@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17916)

2 years agomd5: add assembly implementation for aarch64
Jonathan Swinney [Wed, 27 Oct 2021 16:50:30 +0000 (16:50 +0000)] 
md5: add assembly implementation for aarch64

This change improves md5 performance significantly by using a hand-optimized
assembly implementation of the inner loop of md5 calculation. The instructions
are carefully ordered to separate data dependencies as much as possible.

Test with:
$ openssl speed md5

AWS Graviton 2
type             16 bytes    64 bytes     256 bytes    1024 bytes   8192 bytes   16384 bytes
md5              46990.60k   132778.65k   270376.96k   364718.08k   405962.75k   409201.32k
md5-modified     51725.23k   152236.22k   323469.14k   453869.57k   514102.61k   519056.04k
                 +10%        +15%         +20%         +24%         +27%         +27%

Apple M1
type             16 bytes    64 bytes     256 bytes    1024 bytes   8192 bytes   16384 bytes
md5              74634.39k   195561.25k   375434.45k   491004.23k   532361.40k   536636.48k
md5-modified     84637.11k   229017.09k   444609.62k   588069.50k   655114.24k   660850.56k
                 +13%        +17%         +18%         +20%         +23%         +23%

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16928)

2 years agoImproving locale test
Dmitry Belyavskiy [Fri, 29 Apr 2022 12:22:24 +0000 (14:22 +0200)] 
Improving locale test

Fixes #18205

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18211)

2 years agofix_dh_paramgen_type: Avoid crash with invalid paramgen type
Tomas Mraz [Thu, 28 Apr 2022 15:04:05 +0000 (17:04 +0200)] 
fix_dh_paramgen_type: Avoid crash with invalid paramgen type

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18202)

2 years agoevp_md_init_internal: Avoid reallocating algctx if digest unchanged
Tomas Mraz [Wed, 13 Apr 2022 14:26:18 +0000 (16:26 +0200)] 
evp_md_init_internal: Avoid reallocating algctx if digest unchanged

Fixes #16947

Also refactor out algctx freeing into a separate function.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18105)

2 years agohttp_client.c: check expected content type only if HTTP status code is 200 (OK)
Dr. David von Oheimb [Thu, 28 Apr 2022 13:35:13 +0000 (15:35 +0200)] 
http_client.c: check expected content type only if HTTP status code is 200 (OK)

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/18204)

2 years agoTesting the EVP_PKEY_CTX_new_from_name without preliminary init
Dmitry Belyavskiy [Fri, 22 Apr 2022 17:26:08 +0000 (19:26 +0200)] 
Testing the EVP_PKEY_CTX_new_from_name without preliminary init

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18199)

2 years agoEnsure we initialized the locale before evp_pkey_name2type
Dmitry Belyavskiy [Fri, 22 Apr 2022 16:16:56 +0000 (18:16 +0200)] 
Ensure we initialized the locale before evp_pkey_name2type

Fixes #18158

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18199)

2 years agoFix memleak in test/provider_test.c
Richard Levitte [Tue, 26 Apr 2022 09:04:49 +0000 (11:04 +0200)] 
Fix memleak in test/provider_test.c

This memory leak is triggered when configuring with 'no-legacy'

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/18179)

2 years agoPrefer .inst rather than .long for probe instructions in arm64cpuid.pl
yavtuk [Mon, 11 Apr 2022 20:40:59 +0000 (23:40 +0300)] 
Prefer .inst rather than .long for probe instructions in arm64cpuid.pl

Fixes an issue disassembling the functions because the symtab contains
an attribute indicating the presence of data within them.

CLA: trivial

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18086)

2 years agopoly1305: Properly copy the whole context on dup
Tomas Mraz [Thu, 21 Apr 2022 15:33:26 +0000 (17:33 +0200)] 
poly1305: Properly copy the whole context on dup

Also reset the updated flag when Poly1305_Init is called.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18143)

2 years agodoc: replace "symmetric cipher" phrase in EVP_MD manpages
Jan Engelhardt [Mon, 25 Apr 2022 08:51:00 +0000 (10:51 +0200)] 
doc: replace "symmetric cipher" phrase in EVP_MD manpages

CLA: trivial

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18169)

2 years agoPrefer GNU library initialization mechanism over platform one
Jon Spillett [Thu, 21 Apr 2022 06:49:04 +0000 (16:49 +1000)] 
Prefer GNU library initialization mechanism over platform one

If GNU toolchain is used, use the __attribute__((constructor))

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18147)

2 years agoTest that SipHash_Final() fails on uninited context
Tomas Mraz [Thu, 21 Apr 2022 15:13:44 +0000 (17:13 +0200)] 
Test that SipHash_Final() fails on uninited context

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18142)

2 years agosiphash: Properly set mac size in sipcopy
Tomas Mraz [Thu, 21 Apr 2022 15:09:14 +0000 (17:09 +0200)] 
siphash: Properly set mac size in sipcopy

Also fully duplicate the context on dup

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18142)

2 years agosiphash: Fail finalization on uninitialized siphash context
Tomas Mraz [Thu, 21 Apr 2022 15:07:40 +0000 (17:07 +0200)] 
siphash: Fail finalization on uninitialized siphash context

Fixes #18140

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18142)

2 years agoMove ossl_deinit_casecmp to the end of OPENSSL_cleanup()
Mathias Berchtold [Sat, 23 Apr 2022 00:26:18 +0000 (19:26 -0500)] 
Move ossl_deinit_casecmp to the end of OPENSSL_cleanup()

Calls like evp_cleanup_int() depend on OPENSSL_strcasecmp().

Fixes https://github.com/openssl/openssl/issues/18160

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18161)

2 years agopem_password_cb(3): References to other man pages
EasySec [Sun, 24 Apr 2022 16:57:39 +0000 (18:57 +0200)] 
pem_password_cb(3): References to other man pages

Refer to OSSL_ENCODER_to_bio and OSSL_DECODER_from_bio man pages.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18164)

2 years agoClear unused variables in X509_print_ex()
zhouzilong [Mon, 25 Apr 2022 06:40:24 +0000 (14:40 +0800)] 
Clear unused variables in X509_print_ex()

CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18167)

2 years agoUse .s extension for ia64 assembler
Jon Spillett [Thu, 21 Apr 2022 02:08:16 +0000 (12:08 +1000)] 
Use .s extension for ia64 assembler

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18136)

2 years agoFix bug in OPENSSL_LH_flush
Hugo Landau [Thu, 21 Apr 2022 15:10:33 +0000 (16:10 +0100)] 
Fix bug in OPENSSL_LH_flush

Fixes #18139.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18141)

2 years agoAdd support for new release commit review requirement bypass
Hugo Landau [Fri, 22 Apr 2022 13:17:44 +0000 (14:17 +0100)] 
Add support for new release commit review requirement bypass

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18155)

2 years agoAdd Tomas Mraz key to release key fingerprints
Tomas Mraz [Thu, 21 Apr 2022 10:44:18 +0000 (12:44 +0200)] 
Add Tomas Mraz key to release key fingerprints

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18138)

2 years agoNever use `__atomic_*` on macOS 10.7 and 10.8
Kirill A. Korinsky [Thu, 7 Apr 2022 13:07:37 +0000 (15:07 +0200)] 
Never use `__atomic_*` on macOS 10.7 and 10.8

macOS 10.7 and 10.8 had a bit wired clang which is detected as
`__GNUC__` which has `__ATOMIC_ACQ_REL` but it excepts one option at
`__atomic_is_lock_free` instead of 2.

This prevents OpenSSL to be compiled on such systems.

Fixes: #18055
Signed-off-by: Kirill A. Korinsky <kirill@korins.ky>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18056)

2 years agoMinimal test checking we can get public key in Turkish locale
Dmitry Belyavskiy [Tue, 12 Apr 2022 10:35:25 +0000 (12:35 +0200)] 
Minimal test checking we can get public key in Turkish locale

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18069)

2 years agoFIPS provider modifications
Dmitry Belyavskiy [Wed, 13 Apr 2022 10:33:21 +0000 (12:33 +0200)] 
FIPS provider modifications

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18069)

2 years agostr[n]casecmp => OPENSSL_strncasecmp
Dmitry Belyavskiy [Tue, 12 Apr 2022 10:30:08 +0000 (12:30 +0200)] 
str[n]casecmp => OPENSSL_strncasecmp

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18069)

2 years agoPublic API functions OPENSSL_str[n]casecmp
Dmitry Belyavskiy [Wed, 13 Apr 2022 10:32:14 +0000 (12:32 +0200)] 
Public API functions OPENSSL_str[n]casecmp

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18069)

2 years agoFix gcc 6.3 builds of aarch64 BSAES
Tom Cosgrove [Fri, 15 Apr 2022 17:43:49 +0000 (18:43 +0100)] 
Fix gcc 6.3 builds of aarch64 BSAES

gcc6.3 doesn't seem to support the register aliases fp and lr for x29 and x30,
so use the x names.

Fixes #18114

Change-Id: I077edda42af4c7cdb7b24f28ac82d1603f550108

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18127)

2 years agoClear incorrectly reported errors in cms_io.
Daniel Fiala [Mon, 28 Mar 2022 12:53:08 +0000 (12:53 +0000)] 
Clear incorrectly reported errors in cms_io.

Fixes openssl#17841.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18109)

2 years agoFix a possible NULL pointer dereference in create_cert_store()
Zhou Qingyang [Wed, 6 Apr 2022 16:48:09 +0000 (00:48 +0800)] 
Fix a possible NULL pointer dereference in create_cert_store()

In create_cert_store(), X509_STORE_new() is called and there is a
dereference of it in following function X509_STORE_add_lookup()
without check, which could lead to NULL pointer dereference.

Fix this by adding a NULL check of X509_STORE_new()

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18057)

2 years agoFix wild pointer dereference in make_ocsp_response()
Zhou Qingyang [Mon, 11 Apr 2022 16:25:26 +0000 (00:25 +0800)] 
Fix wild pointer dereference in make_ocsp_response()

The function OCSP_basic_add1_status() will return NULL on malloc failure.
However the return value is not checked before being passed to
OCSP_SINGLERESP_add1_ext_i2d(), and there is a wild field pointer,
which could lead to wild pointer dereference.

Fix this by adding return value check

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18081)

2 years agoFix small typo in X509v3_get_ext_by_NID() man page
EasySec [Sat, 16 Apr 2022 21:39:38 +0000 (23:39 +0200)] 
Fix small typo in X509v3_get_ext_by_NID() man page

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18124)

2 years agoDo a prelimary check for numbers in openssl prime command.
Daniel Fiala [Mon, 11 Apr 2022 19:58:31 +0000 (21:58 +0200)] 
Do a prelimary check for numbers in openssl prime command.

Fixes openssl#16241.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18092)

2 years agoAvoid undefined behavior of provided macs on EVP_MAC reinitialization
Tomas Mraz [Tue, 12 Apr 2022 15:58:23 +0000 (17:58 +0200)] 
Avoid undefined behavior of provided macs on EVP_MAC reinitialization

When the context is reinitialized, i.e. the same key should be used
we must properly reinitialize the underlying implementation.

However in POLY1305 case it does not make sense as this special MAC
should not reuse keys. We fail with this provided implementation
when reinitialization happens.

Fixes #17811

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18100)

2 years agoevp_test: Try computing MACs twice with reinitialization of EVP_MAC_CTX
Tomas Mraz [Tue, 12 Apr 2022 14:35:56 +0000 (16:35 +0200)] 
evp_test: Try computing MACs twice with reinitialization of EVP_MAC_CTX

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18100)

2 years agodoc: Clarify that calling SSL_set_session(ssl, NULL) is a correct use case.
EasySec [Wed, 13 Apr 2022 11:02:44 +0000 (13:02 +0200)] 
doc: Clarify that calling SSL_set_session(ssl, NULL) is a correct use case.

Reviewed-by: Ben Kaduk <kaduk@mit.edu>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18101)

2 years agofix some typos
cuishuang [Sat, 2 Apr 2022 09:49:54 +0000 (17:49 +0800)] 
fix some typos

CLA: trivial

Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18023)

2 years agoFix an assertion in the DTLS server code
Bernd Edlinger [Mon, 11 Apr 2022 08:12:48 +0000 (10:12 +0200)] 
Fix an assertion in the DTLS server code

This fixes an internal error alert from the server and
an unexpected connection failure in the release version,
but a failed assertion and a server crash in the
debug version.

Reproduce this issue with a DTLS server/client like that:

./openssl s_server -dtls -mtu 1500
./openssl s_client -dtls -maxfraglen 512

In the debug version a crash happens in the Server now:

./openssl s_server -dtls -mtu 1500
Using default temp DH parameters
ACCEPT
ssl/statem/statem_dtls.c:269: OpenSSL internal error: Assertion failed: len == written
Aborted (core dumped)

While in the release version the handshake exceeds the
negotiated max fragment size, and fails because of this:

$ ./openssl s_server -dtls -mtu 1500
Using default temp DH parameters
ACCEPT
ERROR
4057152ADA7F0000:error:0A0000C2:SSL routines:do_dtls1_write:exceeds max fragment size:ssl/record/rec_layer_d1.c:826:
shutting down SSL
CONNECTION CLOSED

From the client's point of view the connection fails
with an Internal Error Alert:

$ ./openssl s_client -dtls -maxfraglen 512
Connecting to ::1
CONNECTED(00000003)
40B76343377F0000:error:0A000438:SSL routines:dtls1_read_bytes:tlsv1 alert internal error:ssl/record/rec_layer_d1.c:613:SSL alert number 80

and now the connection attempt fails unexpectedly.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18093)

2 years agoAdd error code for unsupported explicit parameters
Tomas Mraz [Thu, 31 Mar 2022 09:01:33 +0000 (11:01 +0200)] 
Add error code for unsupported explicit parameters

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17998)

2 years agoendecode_test: Handle expected failures for non-fips ec keys
Tomas Mraz [Wed, 30 Mar 2022 15:00:01 +0000 (17:00 +0200)] 
endecode_test: Handle expected failures for non-fips ec keys

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17998)

2 years agoImport only named params into FIPS module
Tomas Mraz [Mon, 28 Mar 2022 16:14:47 +0000 (18:14 +0200)] 
Import only named params into FIPS module

Fixes #17978

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17998)

2 years agoCheck the return of EVP_KDF_fetch()
tangyiqun [Tue, 12 Apr 2022 08:07:17 +0000 (16:07 +0800)] 
Check the return of EVP_KDF_fetch()

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18096)

2 years agoAdded Simple SSL Echo Client/Server to demos.
bobwirka [Sun, 12 Dec 2021 19:53:13 +0000 (14:53 -0500)] 
Added Simple SSL Echo Client/Server to demos.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17260)

2 years agoAdd an initial QUIC Technical requirements document
Matt Caswell [Mon, 24 Jan 2022 16:59:30 +0000 (16:59 +0000)] 
Add an initial QUIC Technical requirements document

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17577)

2 years agoAdd return value check of X509V3_add_value() in X509V3_parse_list()
Zhou Qingyang [Sun, 10 Apr 2022 18:05:19 +0000 (02:05 +0800)] 
Add return value check of X509V3_add_value() in X509V3_parse_list()

X509V3_add_value() will return 0 on malloc failure, which could lead to
err logic in X509V3_parse_list().

Fix this by adding return value check of X509V3_add_value().

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18077)

2 years agos390: Add new machine generation
Juergen Christ [Wed, 26 Jan 2022 10:48:44 +0000 (11:48 +0100)] 
s390: Add new machine generation

Allow to specify "z16" as machine generation in environment variable
OPENSSL_s390xcap.  It is an alias for "z15".

Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18054)

2 years agoSSL_conf_cmd: Allow DH Parameters at any position.
Daniel Fiala [Mon, 4 Apr 2022 17:41:32 +0000 (19:41 +0200)] 
SSL_conf_cmd: Allow DH Parameters at any position.

Fixes openssl#17326.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18041)

2 years agoSM4 optimization for ARM by ASIMD
Daniel Hu [Mon, 14 Feb 2022 14:36:34 +0000 (14:36 +0000)] 
SM4 optimization for ARM by ASIMD

This patch optimizes SM4 for ARM processor using ASIMD instruction

It will improve performance if both of following conditions are met:
1) Input data equal to or more than 4 blocks
2) Cipher mode allows parallelism, including ECB,CTR,GCM or CBC decryption

This patch implements SM4 SBOX lookup in vector registers, with the
benefit of constant processing time over existing C implementation.

It is only enabled for micro-architecture N1/V1. In the ideal scenario,
performance can reach up to 2.7X

When either of above two conditions is not met, e.g. single block input
or CFB/OFB mode, CBC encryption, performance could drop about 50%.

The assembly code has been reviewed internally by ARM engineer
Fangming.Fang@arm.com

Signed-off-by: Daniel Hu <Daniel.Hu@arm.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17951)

2 years agoFix -no-tls1_2 in tests
Todd Short [Fri, 1 Apr 2022 14:54:45 +0000 (10:54 -0400)] 
Fix -no-tls1_2 in tests

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/18019)

2 years agoAdd test for openssl ecparam with fips and base providers
Tomas Mraz [Wed, 30 Mar 2022 14:04:55 +0000 (16:04 +0200)] 
Add test for openssl ecparam with fips and base providers

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17981)

2 years agoec_export: Other parameters are exportable with domain parameters
Tomas Mraz [Mon, 28 Mar 2022 16:09:18 +0000 (18:09 +0200)] 
ec_export: Other parameters are exportable with domain parameters

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17981)

2 years agoAdd test for resetting SM2 dist ID
Tomas Mraz [Wed, 6 Apr 2022 08:29:54 +0000 (10:29 +0200)] 
Add test for resetting SM2 dist ID

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18052)

2 years agosm2: Allow setting 0 length SM2 dist ID param
Tomas Mraz [Wed, 6 Apr 2022 08:03:22 +0000 (10:03 +0200)] 
sm2: Allow setting 0 length SM2 dist ID param

Fixes #18022

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18052)

2 years agoCrypto/evp: Fix null pointer dereference
yuanjungong [Thu, 7 Apr 2022 04:35:59 +0000 (12:35 +0800)] 
Crypto/evp: Fix null pointer dereference

Check the return value of EVP_KDF_fetch to avoid a potential
null pointer dereference.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18062)

2 years agokdf: avoid NULL dereference on malloc failure in sshkdf
Pauli [Thu, 31 Mar 2022 21:06:17 +0000 (08:06 +1100)] 
kdf: avoid NULL dereference on malloc failure in sshkdf

Fixes #18009

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/18011)

2 years agoDocument {SSL|SSL_CTX}_set_{purpose|trust}()
Hugo Landau [Mon, 4 Apr 2022 12:45:44 +0000 (13:45 +0100)] 
Document {SSL|SSL_CTX}_set_{purpose|trust}()

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18037)

2 years agoDocument SSL_CTX_get_ssl_method
Hugo Landau [Mon, 4 Apr 2022 12:44:31 +0000 (13:44 +0100)] 
Document SSL_CTX_get_ssl_method

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18037)

2 years agotest_fipsinstall: Fallback to config(FIPSKEY) for the FIPSKEY
Tomas Mraz [Tue, 5 Apr 2022 14:43:45 +0000 (16:43 +0200)] 
test_fipsinstall: Fallback to config(FIPSKEY) for the FIPSKEY

Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18048)

2 years agoFix failure to check result of bn_rshift_fixed_top
Hugo Landau [Mon, 4 Apr 2022 11:25:16 +0000 (12:25 +0100)] 
Fix failure to check result of bn_rshift_fixed_top

Fixes #18010.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18034)

2 years agoAdd SSL_(CTX_)?get0_(verify|chain)_cert_store functions
Hugo Landau [Mon, 4 Apr 2022 13:36:20 +0000 (14:36 +0100)] 
Add SSL_(CTX_)?get0_(verify|chain)_cert_store functions

Currently we do not have any way to retrieve these values once set.

Fixes #18035.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18038)

2 years agoRemove unused libctx functions (runonce, onfree)
Hugo Landau [Mon, 4 Apr 2022 08:23:18 +0000 (09:23 +0100)] 
Remove unused libctx functions (runonce, onfree)

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18031)

2 years agoKTLS: Enable KTLS for receiving as well in TLS 1.3
Daiki Ueno [Sun, 10 Oct 2021 07:14:06 +0000 (09:14 +0200)] 
KTLS: Enable KTLS for receiving as well in TLS 1.3

This removes a guard condition that prevents KTLS being enabled for
receiving in TLS 1.3.  Use the correct sequence number and BIO for
receive vs transmit offload.

Co-authored-by: John Baldwin <jhb@FreeBSD.org>
Signed-off-by: Daiki Ueno <dueno@redhat.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17942)

2 years agoKTLS: Handle TLS 1.3 in ssl3_get_record.
Daiki Ueno [Sun, 10 Oct 2021 06:54:07 +0000 (08:54 +0200)] 
KTLS: Handle TLS 1.3 in ssl3_get_record.

- Don't unpad records, check the outer record type, or extract the
  inner record type from TLS 1.3 records handled by the kernel.  KTLS
  performs all of these steps and returns the inner record type in the
  TLS header.

- When checking the length of a received TLS 1.3 record don't allow
  for the extra byte for the nested record type when KTLS is used.

- Pass a pointer to the record type in the TLS header to the
  SSL3_RT_INNER_CONTENT_TYPE message callback.  For KTLS, the old
  pointer pointed to the last byte of payload rather than the record
  type.  For the non-KTLS case, the TLS header has been updated with
  the inner type before this callback is invoked.

Co-authored-by: John Baldwin <jhb@FreeBSD.org>
Signed-off-by: Daiki Ueno <dueno@redhat.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17942)

2 years agoKTLS: Add using_ktls helper variable in ssl3_get_record().
John Baldwin [Tue, 8 Mar 2022 00:55:18 +0000 (16:55 -0800)] 
KTLS: Add using_ktls helper variable in ssl3_get_record().

When KTLS receive is enabled, pending data may still be present due to
read ahead.  This data must still be processed the same as records
received without KTLS.  To ease readability (especially in
consideration of additional checks which will be added for TLS 1.3),
add a helper variable 'using_ktls' that is true when the KTLS receive
path is being used to receive a record.

Co-authored-by: Dmitry Podgorny <pasis.ua@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17942)

2 years agoKTLS: Check for unprocessed receive records in ktls_configure_crypto.
John Baldwin [Thu, 24 Feb 2022 18:12:07 +0000 (10:12 -0800)] 
KTLS: Check for unprocessed receive records in ktls_configure_crypto.

KTLS implementations currently assume that the start of the in-kernel
socket buffer is aligned with the start of a TLS record for the
receive side.  The socket option to enable KTLS specifies the TLS
sequence number of this initial record.

When read ahead is enabled, data can be pending in the SSL read buffer
after negotiating session keys.  This pending data must be examined to
ensurs that the kernel's socket buffer does not contain a partial TLS
record as well as to determine the correct sequence number of the
first TLS record to be processed by the kernel.

In preparation for enabling receive kernel offload for TLS 1.3, move
the existing logic to handle read ahead from t1_enc.c into ktls.c and
invoke it from ktls_configure_crypto().

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17942)

2 years agoDocument the fact that setting a BIO create function means the BIO will no longer...
Arran Cudbard-Bell [Mon, 28 Mar 2022 19:13:39 +0000 (13:13 -0600)] 
Document the fact that setting a BIO create function means the BIO will no longer be marked as initialised

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/17983)

2 years agoAdd -static-libgcc to solaris-sparcv7-gcc shared_ldflag
Todd C. Miller [Fri, 12 Mar 2021 20:44:54 +0000 (13:44 -0700)] 
Add -static-libgcc to solaris-sparcv7-gcc shared_ldflag

This avoids a run-time dependency on libgcc_s.so which may not be
present on all systems.  OpenSSL already uses -static-libgcc for
the solaris-x86-gcc and solaris64-x86_64-gcc configurations.

CLA: trivial

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14538)

2 years agoFix AIX build when no-shared is passed to Configure.
Todd C. Miller [Thu, 31 Mar 2022 16:32:29 +0000 (10:32 -0600)] 
Fix AIX build when no-shared is passed to Configure.

AIX shared libs are also .a files so the AIX platform staticname()
appends a '_a' to the name to avoid a collision.  However, this
must not be done when no-shared is passed to Configure or the
binaries that link with -lcrypto and -lssl be unable to link as
those libraries won't exist without the '_a' suffix.

CLA: trivial

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18006)

2 years agoRedefine macro X509_http_nbio to avoid using ocsp.h
Daniel Fiala [Tue, 29 Mar 2022 18:32:42 +0000 (20:32 +0200)] 
Redefine macro X509_http_nbio to avoid using ocsp.h

The functions used from ocsp.h are actually just aliases
for functions from http.h. Use them directly to avoid
including ocsp.h.

Fixes openssl#17148

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17980)

2 years agoAdd loongarch64 target
Shi Pujin [Wed, 16 Feb 2022 02:53:56 +0000 (10:53 +0800)] 
Add loongarch64 target

Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17712)

2 years agoFix broken link to coding-style.html
Viktor Söderqvist [Fri, 1 Apr 2022 09:27:25 +0000 (11:27 +0200)] 
Fix broken link to coding-style.html

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18015)