openssl.git
5 months agoCMP lib and app: add optional certProfile request message header and respective ...
Dr. David von Oheimb [Tue, 13 Jun 2023 19:56:57 +0000 (21:56 +0200)]
CMP lib and app: add optional certProfile request message header and respective -profile option

Also add missing getter functionss OSSL_CMP_{CTX,HDR}_get0_geninfo_ITAVs() to CMP API.

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/21281)

5 months agoConsolidate raising errors in SSL_CONF_cmd()
Tomas Mraz [Thu, 14 Dec 2023 17:33:57 +0000 (18:33 +0100)]
Consolidate raising errors in SSL_CONF_cmd()

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/23048)

5 months agoTest that incorrect entry in the ssl section is not fatal
Tomas Mraz [Thu, 14 Dec 2023 15:37:58 +0000 (16:37 +0100)]
Test that incorrect entry in the ssl section is not fatal

The following entries should be still applied.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/23048)

5 months agoAlways apply all configuration settings from the ssl section
Tomas Mraz [Thu, 14 Dec 2023 15:26:21 +0000 (16:26 +0100)]
Always apply all configuration settings from the ssl section

Even if some configuration entry is incorrect, do not
skip the remaining ones.

Fixes #20789

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/23048)

5 months agoAdd a daily test for an alternative value for SSL3_ALIGN_PAYLOAD
Matt Caswell [Tue, 12 Dec 2023 13:47:11 +0000 (13:47 +0000)]
Add a daily test for an alternative value for SSL3_ALIGN_PAYLOAD

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23021)

5 months agoEnsure the default length calculation includes the content type byte
Matt Caswell [Tue, 12 Dec 2023 13:17:51 +0000 (13:17 +0000)]
Ensure the default length calculation includes the content type byte

TLSv1.3 includes an extra byte after the payload for the content type.
We should incorporate that in the calculation of the default buffer length.

Fixes #23015

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23021)

5 months agorun Windows GitHub CI workflow on self-hosted runners
Dmitry Misharov [Thu, 14 Dec 2023 12:36:04 +0000 (13:36 +0100)]
run Windows GitHub CI workflow on self-hosted runners

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23042)

5 months agorun GitHub CI workflow on self-hosted runners
Dmitry Misharov [Thu, 14 Dec 2023 11:29:23 +0000 (12:29 +0100)]
run GitHub CI workflow on self-hosted runners

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23042)

5 months agorun Cross Compiles workflow on self-hosted runner
Dmitry Misharov [Thu, 14 Dec 2023 10:09:15 +0000 (11:09 +0100)]
run Cross Compiles workflow on self-hosted runner

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23042)

5 months agocms: avoid intermittent test failure
James Muir [Thu, 14 Dec 2023 19:14:37 +0000 (14:14 -0500)]
cms: avoid intermittent test failure

If you decrypt a random input using RSAES-PKCS-v1_5, then there is a
non-negligible chance that the result will look like a valid plaintext
(that is why RSAES-PKCS-v1_5 shouldn't be used anymore).  This was the
cause of an intermittent failure in a test that did a cms-encrypt
operation targetting multiple recipients.

The failure happened during key-only decrypt.  The recipient decrypts
every RSA ciphertext -- only one is supposed to decrypt successfully,
which would reveal the right content-key.  Occassionally, more than
one decrypted successfully.

Update the test by specifying the recipient cert in the decrypt op
(this avoids looping over all RSA ciphertexts).

Add a new test to get coverage for key-only decrypt, but use RSA-OAEP
during the encrypt op.

Fixes https://github.com/openssl/project/issues/380

Testing:

  $ make TESTS='test_cms' test

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23055)

5 months agoDefine L_ENDIAN for linux64-loongarch64
Xi Ruoyao [Tue, 12 Dec 2023 19:36:48 +0000 (03:36 +0800)]
Define L_ENDIAN for linux64-loongarch64

In commit d7c0fc5b1a7b5cb2219f8d89a861f3879582fc16 we removed L_ENDIAN
definition for guessed linux64-loongarch64 as it had caused an
inconsistency between configurations with and without explicit
specifying linux64-loongarch64.  Now add it back to the proper location.

Unlike MIPS or RISC-V, LoongArch is always little-endian [1].

By the way, change "LOONGARCH" to "LoongArch" in a comment as LOONGARCH
should only appear in the identifiers of macros, constants, etc.

[1]:https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#endian

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

5 months agoBump actions/download-artifact from 3 to 4
dependabot[bot] [Mon, 18 Dec 2023 10:05:05 +0000 (10:05 +0000)]
Bump actions/download-artifact from 3 to 4

Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
CLA: trivial

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

5 months agoBump actions/upload-artifact from 3 to 4
dependabot[bot] [Mon, 18 Dec 2023 09:58:53 +0000 (09:58 +0000)]
Bump actions/upload-artifact from 3 to 4

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
CLA: trivial

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

5 months agoRemove redundant logic for DTLS server version selection
Frederik Wedel-Heinen [Tue, 12 Dec 2023 11:58:01 +0000 (12:58 +0100)]
Remove redundant logic for DTLS server version selection

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

5 months agoHandle tls and dtls server version selection similarly
Frederik Wedel-Heinen [Fri, 8 Dec 2023 20:00:43 +0000 (21:00 +0100)]
Handle tls and dtls server version selection similarly

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

5 months agoFix instructions for running tests on Windows
Dmitry Kobets [Fri, 15 Dec 2023 04:12:43 +0000 (20:12 -0800)]
Fix instructions for running tests on Windows

In the command `nmake TEST='foo' test`, on Windows the runner
will look for test `'foo'` and complain about the test not being found
(due to the extraneous single quotes), whereas with `nmake TEST="foo" test`,
the test `foo` will be correctly found.

CLA: trivial

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
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/23059)

5 months agoFix provider compatibility check crash in evp_test
Tomas Mraz [Mon, 11 Dec 2023 14:19:47 +0000 (15:19 +0100)]
Fix provider compatibility check crash in evp_test

EVP_MAC_CTX_get_mac_size() cannot be called on older
unfixed versions before EVP_MAC_init().

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/23006)

5 months agoAvoid setting gen_type to -1 in dsa_gen_set_params
Neil Horman [Fri, 8 Dec 2023 20:41:51 +0000 (15:41 -0500)]
Avoid setting gen_type to -1 in dsa_gen_set_params

gh_gen_type_common_set_params looks up a dsa contexts gen_type using
name2id, but if it returns error, we inadvertently set gctx->gen_type to
-1, which is an invalid value, which may lead to improper behavior in
future calls, in the event that said future calls preform an operation
of the form;
if (gen_type == <VALID VALUE>) {
        do_stuff
else {
        do_other_stuff
}

Technically it is not correct to continue with the operations on the
gen context after failed parameters setting but this makes it more
predictable.

Fix it by assigning the result of a lookup to a stack variable, and only
update gctx->gen_value if the lookup returns a non-failing value

In leiu of testing this specific case, also add an ossl_assert in dsa_gen
to validate the gen_val input prior to continuing, should other code
points attempt to do the same thing

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22991)

5 months agoAvoid setting gen_type to -1 in dh_gen_common_set_params
Neil Horman [Fri, 8 Dec 2023 19:59:23 +0000 (14:59 -0500)]
Avoid setting gen_type to -1 in dh_gen_common_set_params

gh_gen_type_common_set_params looks up a dh contexts gen_type using
name2id, but if it returns error, we set gctx->gen_type to -1, which
is an invalid value, which may lead to undefined behavior in
future calls, in the event that said future calls preform an operation
of the form;
if (gen_type == <VALID VALUE>) {
        do_stuff
else {
        do_other_stuff
}

Technically it is not correct to continue with the operations on the
gen context after failed parameters setting but this makes it more
predictable.

Fix it by assigning the result of a lookup to a stack variable, and only
update gctx->gen_value if the lookup returns a non-failing value

In leiu of testing this specific case, also add an ossl_assert in dh_gen
to validate the gen_val input prior to continuing, should other code
points attempt to do the same thing

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22991)

5 months agoCONTRIBUTING.md: add reference to util/check-format.pl and fix several nits
Dr. David von Oheimb [Sat, 2 Dec 2023 14:54:27 +0000 (15:54 +0100)]
CONTRIBUTING.md: add reference to util/check-format.pl and fix several nits

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

5 months agoHarden asn1 oid loader to invalid inputs
Neil Horman [Tue, 5 Dec 2023 20:24:20 +0000 (15:24 -0500)]
Harden asn1 oid loader to invalid inputs

In the event that a config file contains this sequence:
=======
openssl_conf = openssl_init

config_diagnostics = 1

[openssl_init]
oid_section = oids

[oids]
testoid1 = 1.2.3.4.1
testoid2 = A Very Long OID Name, 1.2.3.4.2
testoid3 = ,1.2.3.4.3
======

The leading comma in testoid3 can cause a heap buffer overflow, as the
parsing code will move the string pointer back 1 character, thereby
pointing to an invalid memory space

correct the parser to detect this condition and handle it by treating it
as if the comma doesn't exist (i.e. an empty long oid name)

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22957)

5 months agoFix genstr/genconf option in asn1parse
Neil Horman [Tue, 5 Dec 2023 19:50:01 +0000 (14:50 -0500)]
Fix genstr/genconf option in asn1parse

At some point the asn1parse applet was changed to default the inform to
PEM, and defalt input file to stdin.  Doing so broke the -genstr|conf options,
in that, before we attempt to generate an ASN1 block from the provided
genstr string, we attempt to read a PEM input from stdin.  As a result,
this command:
openssl asn1parse -genstr OID:1.2.3.4
hangs because we are attempting a blocking read on stdin, waiting for
data that never arrives

Fix it by giving priority to genstr|genconf, such that, if set, will just run
do_generate on that string and exit

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22957)

5 months agoLHASH: Document down_load functions
Hugo Landau [Mon, 11 Dec 2023 07:57:54 +0000 (07:57 +0000)]
LHASH: Document down_load functions

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

5 months agoLHASH: Fix documentation for doall-delete hazards
Hugo Landau [Fri, 8 Dec 2023 10:14:27 +0000 (10:14 +0000)]
LHASH: Fix documentation for doall-delete hazards

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

5 months agoQUIC LCIDM: Fix usage of LHASH
Hugo Landau [Fri, 8 Dec 2023 09:58:21 +0000 (09:58 +0000)]
QUIC LCIDM: Fix usage of LHASH

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

5 months agopkcs12: Do not forcibly load the config file
Tomas Mraz [Mon, 11 Dec 2023 14:03:08 +0000 (15:03 +0100)]
pkcs12: Do not forcibly load the config file

This was added as part of commit e869c86 but later it
was made unnecessary by commit 21f7a09.

Fixes #22994

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23005)

5 months agodoc: fix list display in man page
James Muir [Thu, 7 Dec 2023 15:23:49 +0000 (10:23 -0500)]
doc: fix list display in man page

"=over 1" is too small.  Use "=over 2" so that list items are
displayed correctly in the generated man-page.

You can check the man-page using the following command:

  cd doc && pod2man man3/OSSL_PARAM_int.pod | man /dev/stdin

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/22974)

5 months agoEnable BTI feature for md5 on aarch64
fangming.fang [Thu, 7 Dec 2023 06:17:51 +0000 (06:17 +0000)]
Enable BTI feature for md5 on aarch64

Fixes: #22959
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22971)

5 months agoremove duplicated typedef for u64
Max Bachmann [Thu, 7 Dec 2023 02:48:58 +0000 (03:48 +0100)]
remove duplicated typedef for u64

This typedef is already created in aes_local.h as `typedef uint64_t u64;`.

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

5 months agoRemoved extra spaces in documentation
slontis [Thu, 7 Dec 2023 00:54:34 +0000 (10:54 +1000)]
Removed extra spaces in documentation

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22968)

5 months agoossl-params: check length returned by strlen()
James Muir [Wed, 6 Dec 2023 21:49:11 +0000 (16:49 -0500)]
ossl-params: check length returned by strlen()

In param_build.c, the functions OSSL_PARAM_BLD_push_utf8_string() and
OSSL_PARAM_BLD_push_utf8_ptr() use strlen() to compute the length of
the string when bsize is zero.  However, the size_t returned by
strlen() might be too large (it is stored in an intermediate "int"),
so check for that.

There are analogous functions in params.c, but they do not use an
intermediate "int" to store the size_t returned by strlen().  So there
is some inconsistency between the implementations.

Credit to Viktor D and Tomas M for spotting these missing checks.

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

5 months agoprovider-storemgmt.pod: fix nits (unclosed '<' around name)
Dr. David von Oheimb [Fri, 27 Oct 2023 06:58:48 +0000 (08:58 +0200)]
provider-storemgmt.pod: fix nits (unclosed '<' around name)

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22942)

5 months agoFix a possible memleak in opt_verify
Bernd Edlinger [Sun, 3 Dec 2023 10:41:51 +0000 (11:41 +0100)]
Fix a possible memleak in opt_verify

The ASN1_OBJECT otmp was leaked if X509_VERIFY_PARAM_add0_policy fails.

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

5 months agoFix a possible memleak in apps/rehash.c
Bernd Edlinger [Sun, 3 Dec 2023 10:29:52 +0000 (11:29 +0100)]
Fix a possible memleak in apps/rehash.c

The OPENSSL_DIR_end was missing in case of error.

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

5 months agoFix a possible memleak in smime_main
Bernd Edlinger [Sun, 3 Dec 2023 10:34:37 +0000 (11:34 +0100)]
Fix a possible memleak in smime_main

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

5 months agoFix a possible memleak in cms_main
Bernd Edlinger [Sun, 3 Dec 2023 10:24:18 +0000 (11:24 +0100)]
Fix a possible memleak in cms_main

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

5 months agoAdd a test case for OSSL_HTTP_parse_url
Matt Caswell [Wed, 6 Dec 2023 12:51:34 +0000 (12:51 +0000)]
Add a test case for OSSL_HTTP_parse_url

Ensure we test the case where the port value is empty in the URL.

Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/22961)

5 months agoFix some invalid use of sscanf
Matt Caswell [Wed, 6 Dec 2023 11:51:01 +0000 (11:51 +0000)]
Fix some invalid use of sscanf

sscanf can return -1 on an empty input string. We need to appropriately
handle such an invalid case.

The instance in OSSL_HTTP_parse_url could cause an uninitialised read of
sizeof(unsigned int) bytes (typically 4). In many cases this uninit read
will immediately fail on the following check (i.e. if the read value
>65535).

If the top 2 bytes of a 4 byte unsigned int are zero then the value will
be <=65535 and the uninitialised value will be returned to the caller and
could represent arbitrary data on the application stack.

The OpenSSL security team has assessed this issue and consider it to be
a bug only (i.e. not a CVE).

Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/22961)

5 months agoExtend the test of BN_GF2m_mod_inv
Matt Caswell [Wed, 6 Dec 2023 11:19:24 +0000 (11:19 +0000)]
Extend the test of BN_GF2m_mod_inv

Test that input value of 1 for p is treated as an error

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

5 months agoAvoid an infinite loop in BN_GF2m_mod_inv
Matt Caswell [Wed, 6 Dec 2023 11:09:53 +0000 (11:09 +0000)]
Avoid an infinite loop in BN_GF2m_mod_inv

If p is set to 1 when calling BN_GF2m_mod_inv then an infinite loop will
result. Calling this function set 1 when applications call this directly
is a non-sensical value - so this would be considered a bug in the caller.

It does not seem possible to cause OpenSSL internal callers of
BN_GF2m_mod_inv to call it with a value of 1.

So, for the above reasons, this is not considered a security issue.
Reported by Bing Shi.

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

5 months agoFix detection for riscv64/riscv32
Matt Caswell [Thu, 30 Nov 2023 09:24:26 +0000 (09:24 +0000)]
Fix detection for riscv64/riscv32

Fixes #22871

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

5 months agoRemove some redundant code
Matt Caswell [Wed, 29 Nov 2023 11:55:17 +0000 (11:55 +0000)]
Remove some redundant code

We remove a function that was left behind and is no longer called after the
record layer refactor

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

5 months agoDon't attempt to set provider params on an ENGINE based cipher
Matt Caswell [Wed, 29 Nov 2023 11:45:12 +0000 (11:45 +0000)]
Don't attempt to set provider params on an ENGINE based cipher

If an ENGINE has been loaded after the SSL_CTX has been created then
the cipher we have cached might be provider based, but the cipher we
actually end up using might not be. Don't try to set provider params on
a cipher that is actually ENGINE based.

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

5 months agoAdd a test for late loading of an ENGINE in TLS
Matt Caswell [Wed, 29 Nov 2023 11:30:07 +0000 (11:30 +0000)]
Add a test for late loading of an ENGINE in TLS

Confirm that using an ENGINE works as expected with TLS even if it is
loaded late (after construction of the SSL_CTX).

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

5 months agoDeprecate SPT threading support on NonStop.
Randall S. Becker [Wed, 22 Nov 2023 20:45:24 +0000 (20:45 +0000)]
Deprecate SPT threading support on NonStop.

This fix removes explicit support for the SPT threading model in configurations.
This also reverts commit f63e1b48ac893dd6110452e70ed08f191547cd89 that were
required for SPT but broke other models.

Fixes: #22798
Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22807)

5 months agoFix a possible memory leak in do_othername
Bernd Edlinger [Sun, 10 Dec 2023 09:18:19 +0000 (10:18 +0100)]
Fix a possible memory leak in do_othername

Since the gen->type will not be set in a2i_GENERAL_NAME
the gen->d.otherName will not be automatically
cleaned up by GENERAL_NAME_free.
Also fixed a similar leak in a2i_GENERAL_NAME,
where ASN1_STRING_set may fail but gen->d.ia5
will not be automatically cleaned up.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22996)

5 months agodoc: improve documentation of EVP in-place encryption
Matthias St. Pierre [Wed, 29 Nov 2023 21:12:45 +0000 (22:12 +0100)]
doc: improve documentation of EVP in-place encryption

The EVP interface explicitly allows in-place encryption/decryption,
but this fact is just 'partially' documented in `EVP_EncryptUpdate(3)`
(pun intended): the manual page mentions only operation failure in
case of 'partial' overlaps. This is not even correct, because
the check for partially overlapping buffers is only implemented
in legacy code paths.

Currently, in-place encryption/decryption is only documented for
RSA (`RSA_public_encrypt(3)`) and DES (`DES_ecb_encrypt(3)`), as
well as in the provider interface (`provider-cipher(7)`).

This commit amends `EVP_EncryptUpdate(3)` and `provider-cipher(7)`
to make the front-end and back-end documentation consistent.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/22875)

5 months agoAdd overflow checks to parse_number/parse_hex/parse_oct
Neil Horman [Tue, 28 Nov 2023 18:54:37 +0000 (13:54 -0500)]
Add overflow checks to parse_number/parse_hex/parse_oct

Test the next arithmetic operation to safely determine if adding the
next digit in the passed property string will overflow

Also, noted a bug in the parse_hex code.  When parsing non-digit
characters (i.e. a-f and A-F), we do a tolower conversion (which is
fine), and then subtract 'a' to get the hex value from the ascii (which
is definately wrong).  We should subtract 'W' to convert tolower
converted hex digits in the range a-f to their hex value counterparts

Add tests to test_property_parse_error to ensure overflow checks work

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/22874)

5 months agoConfigure: Refuse to make directories in the source tree
Richard Levitte [Tue, 28 Nov 2023 22:41:32 +0000 (23:41 +0100)]
Configure: Refuse to make directories in the source tree

Fixes #22907

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

5 months agoModify 'out-of-source-and-install' to work with a read-only source tree
Richard Levitte [Tue, 28 Nov 2023 14:55:43 +0000 (15:55 +0100)]
Modify 'out-of-source-and-install' to work with a read-only source tree

This also adds the configuration options 'enable-quic'.

Fixes #22907

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

5 months agoAdd the 'run_tests' target to the Windows build file template as well
Richard Levitte [Tue, 5 Dec 2023 08:26:36 +0000 (09:26 +0100)]
Add the 'run_tests' target to the Windows build file template as well

For some reason, it was added to the Unix and VMS build templates, but
Windows was forgotten.

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

5 months agoMake sure that the test / tests build target run 'run_tests' last
Richard Levitte [Tue, 5 Dec 2023 08:21:35 +0000 (09:21 +0100)]
Make sure that the test / tests build target run 'run_tests' last

Fixes #22943

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

5 months agoStatically link legacy provider to evp_extra_test
Neil Horman [Thu, 30 Nov 2023 16:20:34 +0000 (11:20 -0500)]
Statically link legacy provider to evp_extra_test

Like in #17345, evp_extra_test links libcrypto statically, but also has
a dynamic/shared load via the legacy provider, which leads to ambiguous
behavior in evp_extra_test on some platforms, usually a crash (SIGSEGV)
on exit via the atexit handlers.  Statically link the legacy provider to
avoid this.

Fixes #22819

Helped-by: Neil Horman <nhorman@openssl.org>
Helped-by: Tomas Mraz <tomas@openssl.org>
Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22905)

5 months agoossl_decoder_cache_flush(): Do not raise an error if there is no cache
Tomas Mraz [Mon, 4 Dec 2023 17:01:28 +0000 (18:01 +0100)]
ossl_decoder_cache_flush(): Do not raise an error if there is no cache

This function can be called during OPENSSL_cleanup() when
the cache was already flushed and deallocated.

Fixes #22939

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22941)

5 months agoQUIC LCIDM: Minor updates in response to feedback
Hugo Landau [Mon, 4 Dec 2023 17:02:39 +0000 (17:02 +0000)]
QUIC LCIDM: Minor updates in response to feedback

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22673)

5 months agoQUIC LCIDM: Make robust against LHASH failures
Hugo Landau [Tue, 28 Nov 2023 07:44:43 +0000 (07:44 +0000)]
QUIC LCIDM: Make robust against LHASH failures

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22673)

5 months agoQUIC LCIDM: Always use lcid_obj to refer to QUIC_LCID
Hugo Landau [Tue, 28 Nov 2023 07:39:41 +0000 (07:39 +0000)]
QUIC LCIDM: Always use lcid_obj to refer to QUIC_LCID

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22673)

5 months agoQUIC GLOSSARY: Add ODCID
Hugo Landau [Tue, 28 Nov 2023 07:32:57 +0000 (07:32 +0000)]
QUIC GLOSSARY: Add ODCID

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22673)

5 months agoQUIC LCIDM: Minor fixes
Hugo Landau [Thu, 9 Nov 2023 11:11:17 +0000 (11:11 +0000)]
QUIC LCIDM: Minor fixes

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22673)

5 months agoQUIC LCIDM: Add debug calls
Hugo Landau [Wed, 8 Nov 2023 16:57:55 +0000 (16:57 +0000)]
QUIC LCIDM: Add debug calls

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22673)

5 months agoQUIC LCIDM: Correct documentation
Hugo Landau [Wed, 8 Nov 2023 16:57:41 +0000 (16:57 +0000)]
QUIC LCIDM: Correct documentation

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22673)

5 months agoQUIC LCIDM: Enforce and document ODCID peculiarities
Hugo Landau [Mon, 6 Nov 2023 08:43:03 +0000 (08:43 +0000)]
QUIC LCIDM: Enforce and document ODCID peculiarities

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22673)

5 months agoQUIC: Update glossary to add LCID/RCID concepts
Hugo Landau [Fri, 3 Nov 2023 17:47:49 +0000 (17:47 +0000)]
QUIC: Update glossary to add LCID/RCID concepts

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22673)

5 months agoQUIC LCIDM: Add test
Hugo Landau [Fri, 3 Nov 2023 17:46:12 +0000 (17:46 +0000)]
QUIC LCIDM: Add test

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22673)

5 months agoQUIC LCIDM: Add fuzzer
Hugo Landau [Fri, 3 Nov 2023 17:16:23 +0000 (17:16 +0000)]
QUIC LCIDM: Add fuzzer

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22673)

5 months agoQUIC LCIDM: Add LCIDM
Hugo Landau [Fri, 3 Nov 2023 16:27:35 +0000 (16:27 +0000)]
QUIC LCIDM: Add LCIDM

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22673)

5 months agorehash.c: Do not use NAME_MAX limit
Tomas Mraz [Thu, 30 Nov 2023 14:55:57 +0000 (15:55 +0100)]
rehash.c: Do not use NAME_MAX limit

On some systems it is too small although the system allows longer
filenames.

Fixes #22886

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22889)

5 months agofips-label.yml: Cleanup the FIPS artifact before downloading and unzipping ABIDIFF one
Tomas Mraz [Tue, 5 Dec 2023 14:02:52 +0000 (15:02 +0100)]
fips-label.yml: Cleanup the FIPS artifact before downloading and unzipping ABIDIFF one

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22952)

5 months agoUse severity: ABI changed label instead of CI failure for ABIDIFF
Tomas Mraz [Fri, 1 Dec 2023 15:02:35 +0000 (16:02 +0100)]
Use severity: ABI changed label instead of CI failure for ABIDIFF

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22901)

5 months agoMake 'openssl list' less sensitive for providers without params
Richard Levitte [Wed, 29 Nov 2023 13:32:10 +0000 (14:32 +0100)]
Make 'openssl list' less sensitive for providers without params

When a provider can't return parameters, make that a warning instead of an
error, and continue to list further providers.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/22866)

5 months agoAdd a minimal test provider
Richard Levitte [Wed, 29 Nov 2023 13:24:18 +0000 (14:24 +0100)]
Add a minimal test provider

We test its validity by trying to load it.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/22866)

5 months agoAfter initializing a provider, check if its output dispatch table is NULL
Richard Levitte [Wed, 29 Nov 2023 13:06:51 +0000 (14:06 +0100)]
After initializing a provider, check if its output dispatch table is NULL

If the provider's output dispatch table is NULL, trying to parse it causes a
crash.  Let's not do that.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/22866)

5 months agotest/recipes/01-test_symbol_presence.t: Treat common symbols specially
Richard Levitte [Thu, 30 Nov 2023 08:02:25 +0000 (09:02 +0100)]
test/recipes/01-test_symbol_presence.t: Treat common symbols specially

Common symbols (type 'C' in the 'nm' output) are allowed to be defined more
than once.  This makes test/recipes/01-test_symbol_presence.t reflect that.

Fixes #22869 (partially)
Fixes #22837

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

5 months agotest/recipes/01-test_symbol_presence.t: Ignore symbols starting with '__'
Richard Levitte [Thu, 30 Nov 2023 07:48:33 +0000 (08:48 +0100)]
test/recipes/01-test_symbol_presence.t: Ignore symbols starting with '__'

On some platforms, the compiler may add symbols that aren't ours and that we
should ignore.

They are generally expected to start with a double underscore, and thereby
easy to detect.

Fixes #22869 (partially)

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

5 months agoAdd a test for X509_load_cert_file()
olszomal [Thu, 30 Nov 2023 16:57:45 +0000 (17:57 +0100)]
Add a test for X509_load_cert_file()

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

5 months agoFix loading more than one certificate in PEM format in X509_load_cert_file_ex()
olszomal [Thu, 30 Nov 2023 11:53:40 +0000 (12:53 +0100)]
Fix loading more than one certificate in PEM format in X509_load_cert_file_ex()

Fixes #22895

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

5 months agoTest various combinations of `SSL_OP_ALLOW_NO_DHE_KEX` and `SSL_OP_PREFER_NO_DHE_KEX`
Markus Minichmayr [Thu, 30 Nov 2023 08:46:28 +0000 (09:46 +0100)]
Test various combinations of `SSL_OP_ALLOW_NO_DHE_KEX` and `SSL_OP_PREFER_NO_DHE_KEX`

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

5 months agoFix detection on HP-UX (IA64)
Michael Osipov [Thu, 30 Nov 2023 16:07:03 +0000 (17:07 +0100)]
Fix detection on HP-UX (IA64)

HPE has a weird preference to prefix letters and zero-padding. Properly trim
them before processing.

CLA: trivial

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

5 months agodoc: improve display of KECCAK-KMAC128, KECCAK-KMAC256 defs
James Muir [Fri, 24 Nov 2023 17:37:36 +0000 (12:37 -0500)]
doc: improve display of KECCAK-KMAC128, KECCAK-KMAC256 defs

Do not allow mid-expression line breaks.

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

5 months agoexporters/cmake/OpenSSLConfig.cmake.in: Detect missing `platform->sharedlib_import`
Richard Levitte [Tue, 21 Nov 2023 12:45:13 +0000 (13:45 +0100)]
exporters/cmake/OpenSSLConfig.cmake.in: Detect missing `platform->sharedlib_import`

Some platform implementations are without `sharedlib_import()`, so we need
to check that it exists before using it.

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

5 months agoRemove the source directory .num targets
Richard Levitte [Thu, 30 Nov 2023 15:38:43 +0000 (16:38 +0100)]
Remove the source directory .num targets

$(SRCDIR)/util/libcrypto.num and $(SRCDIR)/util/libssl.num were made their
own targets to have 'make ordinals' reproduce them (run mknum.pl) only if
needed.

Unfortunately, because the shared library linker scripts depend on these
.num files, we suddenly have mknum.pl run at random times when building.
Furthermore, this created a diamond dependency, which disturbs parallell
building because multiple mknum.pl on the same file could run at the same
time.

This reverts commit 0e55c3ab8d702ffc897c9beb51d19b14b7896182.

Fixes #21999
Partially fixes #22841

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

5 months agoDon't free aliased pointers in ctx cmp_ctx tests
Neil Horman [Wed, 22 Nov 2023 17:16:54 +0000 (12:16 -0500)]
Don't free aliased pointers in ctx cmp_ctx tests

Coverity recorded issues 1551739 and 1551737, a potential double free in the
tests.  It occurs when the DUP operation fails in such a way val3_read is
returned as the same pointer as val2_read.  Ideally it should never
happen, but resetting val3_read to 0 should satisfy coverity that there
is no issue here

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

5 months agoAdd locking to CRYPTO_secure_used
Neil Horman [Wed, 22 Nov 2023 19:20:39 +0000 (14:20 -0500)]
Add locking to CRYPTO_secure_used

Coverity issue 1551719 noted CRYPTO_secure_used referenced a shared
variable without taking the appropriate read lock.  Add that.

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

5 months agoevp-cmac: do not seg-fault when getting mac-size before init
James Muir [Wed, 29 Nov 2023 03:43:52 +0000 (22:43 -0500)]
evp-cmac: do not seg-fault when getting mac-size before init

Add null check to cmac_size().  This avoids a seg-fault encountered
with cmac when EVP_MAC_CTX_get_mac_size() is called before init.

Extend mac testing in evp_test.c to check that the sizes returned by
EVP_MAC_CTX_get_mac_size() before and after init make sense (this also
ensures that we no longer seg-fault).

Fixes #22842

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

5 months agoFix a possible memory leak in make_receipt_request
Bernd Edlinger [Wed, 15 Nov 2023 18:31:28 +0000 (19:31 +0100)]
Fix a possible memory leak in make_receipt_request

When the CMS_ReceiptRequest cannot be created,
the rct_to and rct_from may be leaked.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22742)

5 months agoFix a possible use after free in X509v3_asid_add_id_or_range
Bernd Edlinger [Wed, 15 Nov 2023 19:49:51 +0000 (20:49 +0100)]
Fix a possible use after free in X509v3_asid_add_id_or_range

And clean up partially created choice objects, which have
still the default type = -1 from ASIdentifierChoice_new().

Fixes #22700

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

5 months agorsa-doc: fix typo
James Muir [Wed, 29 Nov 2023 17:37:44 +0000 (12:37 -0500)]
rsa-doc: fix typo

"d_i in RFC8017" -> "d_i" in RFC8017

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

5 months agodoc: Minor typo in SSL_CTX_set_tmp_dh_callback docs.
Sean Bright [Mon, 20 Nov 2023 20:08:19 +0000 (15:08 -0500)]
doc: Minor typo in SSL_CTX_set_tmp_dh_callback docs.

well know -> well known

CLA: trivial

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

5 months agoInitialize dstctx->mgf1_md to NULL in rsa_dupctx function
lan1120 [Wed, 22 Nov 2023 01:45:25 +0000 (09:45 +0800)]
Initialize dstctx->mgf1_md to NULL in rsa_dupctx function

Signed-off-by: lan1120 <lanming@huawei.com>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22795)

5 months agobn_nist: Fix strict-aliasing violations in little-endian optimizations
Xi Ruoyao [Sat, 25 Nov 2023 08:14:35 +0000 (16:14 +0800)]
bn_nist: Fix strict-aliasing violations in little-endian optimizations

The little-endian optimization is doing some type-punning in a way
violating the C standard aliasing rule by loading or storing through a
lvalue with type "unsigned int" but the memory location has effective
type "unsigned long" or "unsigned long long" (BN_ULONG).  Convert these
accesses to use memcpy instead, as memcpy is defined as-is "accessing
through the lvalues with type char" and char is aliasing with all types.

GCC does a good job to optimize away the temporary copies introduced
with the change.  Ideally copying to a temporary unsigned int array,
doing the calculation, and then copying back to `r_d` will make the code
look better, but unfortunately GCC would fail to optimize away this
temporary array then.

I've not touched the LE optimization in BN_nist_mod_224 because it's
guarded by BN_BITS2!=64, then BN_BITS2 must be 32 and BN_ULONG must be
unsigned int, thus there is no aliasing issue in BN_nist_mod_224.

Fixes #12247.

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22816)

5 months agoFix implementation of `PreferNoDHEKEX` option.
Markus Minichmayr [Mon, 27 Nov 2023 17:26:51 +0000 (18:26 +0100)]
Fix implementation of `PreferNoDHEKEX` option.

`tls_parse_ctos_key_share()` didn't properly handle the option.
Avoid the need to deal with the option in multiple places by properly
handling it in `tls_parse_ctos_psk_kex_modes()`.

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

5 months agoFix EVP_RAND-SEED-SRC documentation example
Jamie Cui [Wed, 29 Nov 2023 01:28:58 +0000 (01:28 +0000)]
Fix EVP_RAND-SEED-SRC documentation example

Fixes #22810

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

5 months agoAdd self-hosted runners
Dmitry Misharov [Thu, 23 Nov 2023 13:22:35 +0000 (14:22 +0100)]
Add self-hosted runners

Added self-hosted runners for freebsd-x86_64 and ubuntu-aarch64.

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Anton Arapov <anton@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22804)

5 months agoOptimize AES-CTR for ARM Neoverse V1 and V2.
fisher.yu [Tue, 17 Oct 2023 08:10:34 +0000 (08:10 +0000)]
Optimize AES-CTR for ARM Neoverse V1 and V2.

    Unroll AES-CTR loops to a maximum 12 blocks for ARM Neoverse V1 and
    V2, to fully utilize their AES pipeline resources.

    Improvement on ARM Neoverse V1.

    Package Size(Bytes) 16 32 64 128 256 1024
    Improvement(%) 3.93 -0.45 11.30 4.31 12.48 37.66
    Package Size(Bytes) 1500 8192 16384 61440 65536
    Improvement(%) 37.16 38.90 39.89 40.55 40.41

Change-Id: Ifb8fad9af22476259b9ba75132bc3d8010a7fdbd

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22733)

5 months agoAdd last missing TLSA usage/selector/mtype test case
Viktor Dukhovni [Mon, 27 Nov 2023 16:23:54 +0000 (11:23 -0500)]
Add last missing TLSA usage/selector/mtype test case

There were no PKIX-TA(0) SPKI(1) Full(0) (i.e. "0 1 0") test cases in
"danetest.in".

There is now at least a success case, which will exercise freeing the public
key after it is sanity checked, since with PKIX-TA(0) there's nothing we can do
with just the raw public key, a full chain to a local trust anchor is in any
case required.

The failure (to match) code path is already well oiled, but failure to decode
while adding malfored TLSA records could still use some additional tests...

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22821)

5 months agoFix freshly introduced double-free.
Viktor Dukhovni [Sat, 25 Nov 2023 18:26:20 +0000 (13:26 -0500)]
Fix freshly introduced double-free.

We don't need the decoded X.509 Full(0) certificate for the EE usages 1 and 3,
because the leaf certificate is always part of the presented chain, so the
certificate is only validated as well-formed, and then discarded, but the
TLSA record is of course still used after the validation step.

Added DANE test cases for: 3 0 0, 3 1 0, 1 0 0, and 1 1 0

Reported by Claus Assmann.

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22821)

5 months agoRemove mention of NEWS.md in CONTRIBUTING.md
Hugo Landau [Tue, 21 Nov 2023 12:53:12 +0000 (12:53 +0000)]
Remove mention of NEWS.md in CONTRIBUTING.md

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

5 months agoAdd known issues section
Hugo Landau [Tue, 21 Nov 2023 12:52:56 +0000 (12:52 +0000)]
Add known issues section

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

5 months agoAdd proposed editorial conventions for NEWS.md
Hugo Landau [Mon, 20 Nov 2023 14:54:10 +0000 (14:54 +0000)]
Add proposed editorial conventions for NEWS.md

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

5 months agoFix a possible memory leak in ct_move_scts
Bernd Edlinger [Fri, 17 Nov 2023 13:47:36 +0000 (14:47 +0100)]
Fix a possible memory leak in ct_move_scts

Instead of trying to move the doomed sct back
to the src stack, which may fail as well, simply
free the sct object, as the src list will be
deleted anyway.

Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22762)