Commit Graph

33576 Commits

Author SHA1 Message Date
Tomas Mraz
4c50610bda endecode_test.c: Add tests for decoding with 0 selection
Reviewed-by: Matt Caswell <matt@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/21519)
2023-08-04 10:09:44 -04:00
Tomas Mraz
2acb0d363c When exporting/importing decoded keys do not use 0 as selection
When decoding 0 as the selection means to decode anything
you get.

However when exporting and then importing the key data 0 as
selection is not meaningful.
So we set it to OSSL_KEYMGMT_SELECT_ALL to make the export/import
function export/import everything that we have decoded.

Fixes #21493

Reviewed-by: Matt Caswell <matt@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/21519)
2023-08-04 10:09:44 -04:00
Tomas Mraz
1ae4678ceb Avoid exporting bogus (empty) data if empty selection is used
This is already correct in the rsa_kmgmt.c but other
implementations are wrong.

Reviewed-by: Matt Caswell <matt@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/21519)
2023-08-04 10:09:43 -04:00
Pauli
cb8e64131e no_autoload: make the no-autoload-config option work again.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/21621)
2023-08-04 11:57:27 +10:00
Pauli
9a255aa2bd test: skip FIPS config auto loading based tests if feature is disabled
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/21621)
2023-08-04 11:57:27 +10:00
Pauli
a9dde74950 provider test: don't run configuration based tests if configuration isn't loaded
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/21621)
2023-08-04 11:57:27 +10:00
Pauli
52ea255d9d PBE test: load providers if auto config load is turned off
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/21621)
2023-08-04 11:57:27 +10:00
Pauli
badf3c162d testutil: allow a failure return from setup_tests that doesn't print help
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/21621)
2023-08-04 11:57:27 +10:00
Pauli
029ddd1ead quic: using #defined constant rather than a magic number
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21429)
2023-08-04 11:55:45 +10:00
Pauli
bed2087487 quic compliance: 10.2.3 dropping instead of closing
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21429)
2023-08-04 11:55:45 +10:00
Pauli
6861f5a703 Fix type/legacy name
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21429)
2023-08-04 11:55:45 +10:00
Pauli
d15d5ea6a6 quic conformance: add comment about section 10.2.3 conformance
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21429)
2023-08-04 11:55:45 +10:00
Pauli
d11b901b0b trivial code nit
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21429)
2023-08-04 11:55:45 +10:00
Pauli
50e76846bf quic conformance: 10.2.1 rate limiting
Implement the two requirements about limiting closing transmission size to
no more than thrice the received size.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21429)
2023-08-04 11:55:45 +10:00
Pauli
afe4a7978d quic conformance: section 10.2.2 requirements
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21429)
2023-08-04 11:55:34 +10:00
Pauli
6b3b5f9d28 quic conformance: section 10.2.1 requirements
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21429)
2023-08-04 11:55:34 +10:00
Pauli
24ae2d79d5 quic: use the safe fused multiply divide instead of a safe multiply then a normal division
This should extend the range of possible results.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21429)
2023-08-04 11:55:34 +10:00
Pauli
a441d08b1b Add note about RFC 9000 10.2 persist time
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21429)
2023-08-04 11:55:34 +10:00
Pauli
b056e9fcf5 document RRFC9000 10.1 MUST requirement
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21429)
2023-08-04 11:55:34 +10:00
Pauli
73ef6e6f0f Note RFC 9000 19.19 requirement
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21429)
2023-08-04 11:55:34 +10:00
Frederik Wedel-Heinen
5ac7ee4d5a Resolves some magic values that has a hello_retry_request enum type.
CLA: trivial

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21636)
2023-08-04 11:40:37 +10:00
Hugo Landau
1e7cc86b75 QUIC: Fix incompatible merges causing CI breakage
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/21641)
2023-08-03 13:31:53 +02:00
Dr. David von Oheimb
2c8d9f19e3 crypto/cmp: fix clash of OSSL_CMP_CERTREQID_NONE with error result of ossl_cmp_asn1_get_int()
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/21579)
2023-08-03 09:29:41 +02:00
Wo'O Ideafarm
bdb1f6b744 formatting: shift one space to right
per request.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21595)
2023-08-02 20:31:44 +01:00
Wo'O Ideafarm
fafb7d3003 trivial change: optionally suppress include lines
CLA: trivial

Code that includes applink.c can now define APPLINK_NO_INCLUDES to suppress the include preprocessor lines in that file.  This might be needed if, for example, applink.c is being included into a source file that will be compiled to reference a C library built using different calling conventions.  (Example: Open Watcom.)

This pull request is intended to replace an identical pull request that I screwed up.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21595)
2023-08-02 20:31:44 +01:00
Tianjia Zhang
38c70a161c Fix typo in function name
Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21608)
2023-08-02 20:28:39 +01:00
Matt Caswell
c9fb65b8c8 Add support into qtest_shutdown for blocking mode
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21591)
2023-08-02 20:27:07 +01:00
Matt Caswell
cf355bd6e5 Extend the test_quic_write_read() test to include resumption
We add an additional loop around test_quic_write_read() to repeat the
test but using a session obtained from the initial iteration to confirm
that we can successfully resume the session.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21591)
2023-08-02 20:27:07 +01:00
Matt Caswell
f219abef51 Ensure the QUIC TLS SSL object is marked as shutdown
If we shutdown the QUIC connection then we should mark the underlying
TLS SSL object as shutdown as well. Otherwise any sessions are considered
unusable for resumption.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21591)
2023-08-02 20:27:07 +01:00
Matt Caswell
829eec9f86 Add the ability for tserver to use a pre-existing SSL_CTX
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21591)
2023-08-02 20:27:07 +01:00
Matt Caswell
f85d343208 Keep doing ossl_quic_tls_tick() even after handshake completion
There may be post-handshake messages to process so make sure we keep
ticking things even if the handshake has finished. We do this simply by
calling SSL_read(). There should never be app data to read but we will
process any handshake records we encounter.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21591)
2023-08-02 20:26:54 +01:00
Matt Caswell
747b51f483 Correctly keep track of where we are in the quicserver request buffer
If the request comes in in multiple chunks properly keep tract of where
we are.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21578)
2023-08-02 15:07:07 +01:00
Matt Caswell
c31f06120f Ensure SSL_has_pending() always works even before a connection
s_client calls SSL_has_pending() even before the connection has been
established. We expect it to return 0 in this case and not put any errors
on the stack.

We change things so that SSL_has_pending() always returns 0 if there is
no stream available.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21578)
2023-08-02 15:07:07 +01:00
Matt Caswell
33f6ad1724 Still advance handshake even on an empty write
A call to SSL_write() with a zero length buffer should still advance the
handshake. Applications (including s_client) may rely on this.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21578)
2023-08-02 15:07:07 +01:00
Matt Caswell
a1c87f64dd Add a QUIC test for back pressure
Check that if one endpoint is sending data faster than its peer can handle
then we eventually see back pressure.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21368)
2023-08-01 20:11:14 +02:00
Matt Caswell
df3d609030 Add a test for PEM_read_bio_Parameters()
We must not ask for a password when attempting to read parameters.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21603)
2023-08-01 20:08:36 +02:00
Matt Caswell
0d0791eedf The PEM_read_bio_Parameters() function should not ask for a password
The PEM_read_bio_Parameters[_ex] function does not have the capability
of specifying a password callback. We should not use the fallback password
callback in this case because it will attempt to send a prompt for the
password which might not be the correct thing to do. We should just not
use a password in that case.

Fixes #21588

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21603)
2023-08-01 20:08:28 +02:00
Matt Caswell
564e5b754a Always add a suitable error if we fail to decode
We're always supposed to add the fallback "unsupported" error if we don't
have anything better. However in some cases this wasn't happening because
we were incorrectly setting "flag_construct_called" - even though the
construct function had failed.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21603)
2023-08-01 20:08:28 +02:00
Matt Caswell
6207f2b657 Don't add the msblob/pvk decoders if they're not suitable
msblob only decodes public/private keys (not just params).
pvk only decodes private keys.

If the requested selection doesn't intersect with the above then don't
consider those decoders.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21603)
2023-08-01 20:08:28 +02:00
zhuchen
780ce3849f Fixed incorrect usage of vshuf.b instruction
In the definition of the latest revised LoongArch64 vector instruction manual,
it is clearly pointed out that the undefined upper three bits of each byte in
the control register of the vshuf.b instruction should not be used, otherwise
uncertain results may be obtained. Therefore, it is necessary to correct the
use of the vshuf.b instruction in the existing vpaes-loongarch64.pl code to
avoid erroneous calculation results in future LoongArch64 processors.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21530)
2023-08-01 19:42:58 +02:00
Xi Ruoyao
160f48941d Add system guessing for linux64-loongarch64 target
Now the default is linux-generic32, it's not good for loongarch64.

We can also test if the assembler supports vector instructions here and
disable asm if not.

Closes #21340.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21510)
2023-08-01 19:41:46 +02:00
Ingo Franzki
eb2ff04cc7 speed: Unify output messages regarding number of ops per time
Always report "<algo> ops in <time>", instead of "<algo>'s in <time>" or
similar. Avoid the use of apostrophes and/or plural with algorithm names.

Signed-off-by: Ingo Franzki <ifranzki@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/21383)
2023-08-01 19:10:39 +02:00
Ingo Franzki
0195df8baa speed: Also measure RSA encrypt/decrypt, not only RSA sign/verify
While RSA encrypt/decrypt and sign/verify are basically the same mod-expo
operations, the speed of the operation may still differ, due to different
padding, as well as the use of implicit rejection for RSA decrypt.

Signed-off-by: Ingo Franzki <ifranzki@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/21383)
2023-08-01 19:10:39 +02:00
Matt Caswell
e3d897d3fa Fix a regression in X509_VERIFY_PARAM_add0_policy()
Also fixes a similar regression in X509_VERIFY_PARAM_add0_table().

Commit 38ebfc3 introduced a regression in 3.0.6 that changed the return
value of the two functions above from 1 on success to the number of entries
in the stack. If there are more than one entry then this is a change in
behaviour which should not have been introduced into a stable release.

This reverts the behaviour back to what it was prior to the change. The code
is slightly different to the original code in that we also handle a possible
-1 return value from the stack push function. This should never happen in
reality because we never pass a NULL stack as a parameter - but for the sake
of robustness we handle it anyway.

Note that the changed behaviour exists in all versions of 3.1 (it never had
the original version). But 3.1 should be fully backwards compatible with 3.0
so we should change it there too.

Fixes #21570

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/21576)
2023-07-31 14:11:03 +01:00
Hugo Landau
63fac76c24 QUIC: Automatically drain non-concluded streams, bugfixes
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21484)
2023-07-31 14:03:42 +01:00
Hugo Landau
6d6b3a032d QUIC APL: Mask API operations when in shutdown flush
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21484)
2023-07-31 14:03:42 +01:00
Hugo Landau
cd5e438065 QUIC MULTISTREAM TEST: Shutdown flush test
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21484)
2023-07-31 14:03:42 +01:00
Hugo Landau
0786483adf QUIC MULTISTREAM TEST: Better failure logging with failing script ID
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21484)
2023-07-31 14:03:25 +01:00
Hugo Landau
8a2e9abac8 QUIC APL: Shutdown Stream Flush Functionality
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21484)
2023-07-31 14:03:25 +01:00
Hugo Landau
553122cd7c QUIC TXP: Fix bug relating to STREAM FIN generation
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21484)
2023-07-31 14:03:25 +01:00