diff --git a/openssl/.github/workflows/ci.yml b/openssl/.github/workflows/ci.yml index 737995b8f..1c21998ec 100644 --- a/openssl/.github/workflows/ci.yml +++ b/openssl/.github/workflows/ci.yml @@ -608,7 +608,7 @@ jobs: - name: make run: make -s -j4 - name: Setup Python - uses: actions/setup-python@v5.1.0 + uses: actions/setup-python@v5.1.1 with: python-version: ${{ matrix.PYTHON }} - uses: dtolnay/rust-toolchain@master diff --git a/openssl/.github/workflows/deploy-docs-openssl-org.yml b/openssl/.github/workflows/deploy-docs-openssl-org.yml new file mode 100644 index 000000000..7b8e6838a --- /dev/null +++ b/openssl/.github/workflows/deploy-docs-openssl-org.yml @@ -0,0 +1,23 @@ +name: "Trigger docs.openssl.org deployment" + +on: + push: + branches: + - "openssl-3.[0-9]+" + - "master" + paths: + - "doc/man*/**" + +jobs: + trigger: + runs-on: ubuntu-latest + steps: + - name: "Trigger deployment workflow" + run: | + gh workflow run -f branch=${{ github.ref_name }} deploy-site.yaml + sleep 3 + RUN_ID=$(gh run list -w deploy-site.yaml -L 1 --json databaseId -q ".[0].databaseId") + gh run watch ${RUN_ID} --exit-status + env: + GH_REPO: "openssl/openssl-docs" + GH_TOKEN: ${{ secrets.OPENSSL_MACHINE_TOKEN }} diff --git a/openssl/.github/workflows/prov-compat-label.yml b/openssl/.github/workflows/prov-compat-label.yml new file mode 100644 index 000000000..f12d31593 --- /dev/null +++ b/openssl/.github/workflows/prov-compat-label.yml @@ -0,0 +1,266 @@ +# Copyright 2023-2024 The OpenSSL Project Authors. All Rights Reserved. +# +# Licensed under the Apache License 2.0 (the "License"). You may not use +# this file except in compliance with the License. You can obtain a copy +# in the file LICENSE in the source distribution or at +# https://www.openssl.org/source/license.html + +# This verifies that FIPS and legacy providers built against some earlier +# released versions continue to run against the current branch. + +name: Provider compatibility for PRs + +on: [pull_request] + +permissions: + contents: read + +env: + opts: enable-rc5 enable-md2 enable-ssl3 enable-weak-ssl-ciphers enable-zlib + +jobs: + fips-releases: + if: ${{ contains(github.event.pull_request.labels.*.name,'extended tests') }} + strategy: + matrix: + release: [ + # Formally released versions should be added here. + # `dir' it the directory inside the tarball. + # `tgz' is the name of the tarball. + # `url' is the download URL. + { + dir: openssl-3.0.0, + tgz: openssl-3.0.0.tar.gz, + url: "https://www.openssl.org/source/old/3.0/openssl-3.0.0.tar.gz", + }, + { + dir: openssl-3.0.8, + tgz: openssl-3.0.8.tar.gz, + url: "https://www.openssl.org/source/openssl-3.0.8.tar.gz", + }, + { + dir: openssl-3.0.9, + tgz: openssl-3.0.9.tar.gz, + url: "https://www.openssl.org/source/openssl-3.0.9.tar.gz", + }, + { + dir: openssl-3.1.2, + tgz: openssl-3.1.2.tar.gz, + url: "https://www.openssl.org/source/openssl-3.1.2.tar.gz", + }, + ] + + runs-on: ubuntu-latest + steps: + - name: create download directory + run: mkdir downloads + - name: download release source + run: wget --no-verbose ${{ matrix.release.url }} + working-directory: downloads + - name: unpack release source + run: tar xzf downloads/${{ matrix.release.tgz }} + + - name: localegen + run: sudo locale-gen tr_TR.UTF-8 + + - name: config release + run: | + ./config --banner=Configured enable-shared enable-fips ${{ env.opts }} + working-directory: ${{ matrix.release.dir }} + - name: config dump release + run: ./configdata.pm --dump + working-directory: ${{ matrix.release.dir }} + + - name: make release + run: make -s -j4 + working-directory: ${{ matrix.release.dir }} + + - name: create release artifacts + run: | + tar cz -H posix -f ${{ matrix.release.tgz }} ${{ matrix.release.dir }} + + - name: show module versions from release + run: | + ./util/wrap.pl -fips apps/openssl list -provider-path providers \ + -provider base \ + -provider default \ + -provider fips \ + -provider legacy \ + -providers + working-directory: ${{ matrix.release.dir }} + + - uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.release.tgz }} + path: ${{ matrix.release.tgz }} + retention-days: 7 + + development-branches: + if: ${{ contains(github.event.pull_request.labels.*.name,'extended tests') }} + strategy: + matrix: + branch: [ + # Currently supported FIPS capable branches should be added here. + # `name' is the branch name used to checkout out. + # `dir' directory that will be used to build and test in. + # `tgz' is the name of the tarball use to keep the artifacts of + # the build. + { + name: '', + dir: PR, + tgz: PR.tar.gz, + }, { + name: openssl-3.0, + dir: branch-3.0, + tgz: branch-3.0.tar.gz, + }, { + name: openssl-3.1, + dir: branch-3.1, + tgz: branch-3.1.tar.gz, + }, { + name: openssl-3.2, + dir: branch-3.2, + tgz: branch-3.2.tar.gz, + }, { + name: openssl-3.3, + dir: branch-3.3, + tgz: branch-3.3.tar.gz, + }, { + name: master, + dir: branch-master, + tgz: branch-master.tar.gz, + }, + ] + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + path: ${{ matrix.branch.dir }} + repository: openssl/openssl + ref: ${{ matrix.branch.name }} + - name: localegen + run: sudo locale-gen tr_TR.UTF-8 + + - name: config branch + run: | + ./config --banner=Configured enable-shared enable-fips ${{ env.opts }} + working-directory: ${{ matrix.branch.dir }} + - name: config dump current + run: ./configdata.pm --dump + working-directory: ${{ matrix.branch.dir }} + + - name: make branch + run: make -s -j4 + working-directory: ${{ matrix.branch.dir }} + + - name: create branch artifacts + run: | + tar cz -H posix -f ${{ matrix.branch.tgz }} ${{ matrix.branch.dir }} + + - name: show module versions from branch + run: | + ./util/wrap.pl -fips apps/openssl list -provider-path providers \ + -provider base \ + -provider default \ + -provider fips \ + -provider legacy \ + -providers + working-directory: ${{ matrix.branch.dir }} + + - name: get cpu info + run: | + cat /proc/cpuinfo + ./util/opensslwrap.sh version -c + working-directory: ${{ matrix.branch.dir }} + + - uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.branch.tgz }} + path: ${{ matrix.branch.tgz }} + retention-days: 7 + + cross-testing: + if: ${{ contains(github.event.pull_request.labels.*.name,'extended tests') }} + needs: [fips-releases, development-branches] + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + # These can't be figured out earlier and included here as a variable + # substitution. + # + # Note that releases are not used as a test environment for + # later providers. Problems in these situations ought to be + # caught by cross branch testing before the release. + tree_a: [ branch-master, branch-3.3, branch-3.2, branch-3.1, branch-3.0, + openssl-3.0.0, openssl-3.0.8, openssl-3.0.9, openssl-3.1.2 ] + tree_b: [ PR ] + include: + - tree_a: PR + tree_b: branch-master + - tree_a: PR + tree_b: branch-3.3 + - tree_a: PR + tree_b: branch-3.2 + - tree_a: PR + tree_b: branch-3.1 + - tree_a: PR + tree_b: branch-3.0 + steps: + - name: early exit checks + id: early_exit + run: | + if [ "${{ matrix.tree_a }}" = "${{ matrix.tree_b }}" ]; \ + then \ + echo "Skipping because both are the same version"; \ + exit 1; \ + fi + continue-on-error: true + + - uses: actions/download-artifact@v3 + if: steps.early_exit.outcome == 'success' + with: + name: ${{ matrix.tree_a }}.tar.gz + - name: unpack first build + if: steps.early_exit.outcome == 'success' + run: tar xzf "${{ matrix.tree_a }}.tar.gz" + + - uses: actions/download-artifact@v3 + if: steps.early_exit.outcome == 'success' + with: + name: ${{ matrix.tree_b }}.tar.gz + - name: unpack second build + if: steps.early_exit.outcome == 'success' + run: tar xzf "${{ matrix.tree_b }}.tar.gz" + + - name: set up cross validation of FIPS from A with tree from B + if: steps.early_exit.outcome == 'success' + run: | + cp providers/fips.so ../${{ matrix.tree_b }}/providers/ + cp providers/fipsmodule.cnf ../${{ matrix.tree_b }}/providers/ + working-directory: ${{ matrix.tree_a }} + + - name: show module versions from cross validation + if: steps.early_exit.outcome == 'success' + run: | + ./util/wrap.pl -fips apps/openssl list -provider-path providers \ + -provider base \ + -provider default \ + -provider fips \ + -provider legacy \ + -providers + working-directory: ${{ matrix.tree_b }} + + - name: get cpu info + if: steps.early_exit.outcome == 'success' + run: | + cat /proc/cpuinfo + ./util/opensslwrap.sh version -c + working-directory: ${{ matrix.tree_b }} + + - name: run cross validation tests of FIPS from A with tree from B + if: steps.early_exit.outcome == 'success' + run: | + make test HARNESS_JOBS=${HARNESS_JOBS:-4} + working-directory: ${{ matrix.tree_b }} diff --git a/openssl/.github/workflows/style-checks.yml b/openssl/.github/workflows/style-checks.yml new file mode 100644 index 000000000..7ed843f3b --- /dev/null +++ b/openssl/.github/workflows/style-checks.yml @@ -0,0 +1,55 @@ +# Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved. +# +# Licensed under the Apache License 2.0 (the "License"). You may not use +# this file except in compliance with the License. You can obtain a copy +# in the file LICENSE in the source distribution or at +# https://www.openssl.org/source/license.html + +name: Coding style validation + +on: [pull_request] + +env: + PR_NUMBER: ${{ github.event.number }} + GH_TOKEN: ${{ github.token }} + +permissions: + contents: read + +jobs: + check-style: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + path: openssl + - name: check style for each commit + working-directory: openssl + shell: bash + run: | + ERRORS_FOUND=0 + git fetch origin $GITHUB_BASE_REF:$GITHUB_BASE_REF + REFSTART=$(git rev-parse $GITHUB_BASE_REF) + REFEND=$(git rev-parse HEAD) + echo "Checking from $REFSTART to $REFEND" + for i in $(git log --no-merges --format=%H $REFSTART..$REFEND) + do + echo "::group::Style report for commit $i" + set +e + ./util/check-format-commit.sh $i + if [ $? -ne 0 ] + then + ERRORS_FOUND=1 + fi + set -e + echo "::endgroup::" + done + SKIP_TEST=$(gh pr view $PR_NUMBER --json labels --jq '.labels[] | select(.name == "style: waived") | .name') + if [ -z "$SKIP_TEST" ] + then + exit $ERRORS_FOUND + else + echo "PR $PR_NUMBER is marked with style: waived, waiving style check errors" + exit 0 + fi diff --git a/openssl/.gitignore b/openssl/.gitignore index 98184721f..d4ee22c47 100644 --- a/openssl/.gitignore +++ b/openssl/.gitignore @@ -147,6 +147,9 @@ providers/common/include/prov/der_sm2.h /apps/progs.c /apps/progs.h +# macOS +.DS_Store + # Windows (legacy) /tmp32 /tmp32.dbg diff --git a/openssl/CHANGES.md b/openssl/CHANGES.md index adc2b2fa2..e19bd4fee 100644 --- a/openssl/CHANGES.md +++ b/openssl/CHANGES.md @@ -26,6 +26,30 @@ OpenSSL Releases OpenSSL 3.3 ----------- +### Changes between 3.3.1 and 3.3.2 [3 Sep 2024] + + * Fixed possible denial of service in X.509 name checks. + + Applications performing certificate name checks (e.g., TLS clients checking + server certificates) may attempt to read an invalid memory address when + comparing the expected name with an `otherName` subject alternative name of + an X.509 certificate. This may result in an exception that terminates the + application program. + + ([CVE-2024-6119]) + + *Viktor Dukhovni* + + * Fixed possible buffer overread in SSL_select_next_proto(). + + Calling the OpenSSL API function SSL_select_next_proto with an empty + supported client protocols buffer may cause a crash or memory contents + to be sent to the peer. + + ([CVE-2024-5535]) + + *Matt Caswell* + ### Changes between 3.3.0 and 3.3.1 [4 Jun 2024] * Fixed potential use after free after SSL_free_buffers() is called. @@ -68,6 +92,14 @@ OpenSSL 3.3 *Tomáš Mráz* + * Improved EC/DSA nonce generation routines to avoid bias and timing + side channel leaks. + + Thanks to Florian Sieck from Universität zu Lübeck and George Pantelakis + and Hubert Kario from Red Hat for reporting the issues. + + *Tomáš Mráz and Paul Dale* + ### Changes between 3.2 and 3.3.0 [9 Apr 2024] * The `-verify` option to the `openssl crl` and `openssl req` will make @@ -20653,6 +20685,8 @@ ndif +[CVE-2024-6119]: https://www.openssl.org/news/vulnerabilities.html#CVE-2024-6119 +[CVE-2024-5535]: https://www.openssl.org/news/vulnerabilities.html#CVE-2024-5535 [CVE-2024-4741]: https://www.openssl.org/news/vulnerabilities.html#CVE-2024-4741 [CVE-2024-4603]: https://www.openssl.org/news/vulnerabilities.html#CVE-2024-4603 [CVE-2024-2511]: https://www.openssl.org/news/vulnerabilities.html#CVE-2024-2511 diff --git a/openssl/CONTRIBUTING.md b/openssl/CONTRIBUTING.md index 83b496478..35c45a319 100644 --- a/openssl/CONTRIBUTING.md +++ b/openssl/CONTRIBUTING.md @@ -3,7 +3,7 @@ HOW TO CONTRIBUTE TO OpenSSL Please visit our [Getting Started] page for other ideas about how to contribute. - [Getting Started]: + [Getting Started]: Development is done on GitHub in the [openssl/openssl] repository. @@ -77,8 +77,8 @@ guidelines: Clean builds via GitHub Actions are required. They are started automatically whenever a PR is created or updated by committers. - [coding style]: https://www.openssl.org/policies/technical/coding-style.html - [documentation policy]: https://openssl.org/policies/technical/documentation-policy.html + [coding style]: https://openssl-library.org/policies/technical/coding-style/ + [documentation policy]: https://openssl-library.org/policies/technical/documentation-policy/ 5. When at all possible, code contributions should include tests. These can either be added to an existing test, or completely new. Please see diff --git a/openssl/Configurations/10-main.conf b/openssl/Configurations/10-main.conf index ca70d58e1..cba57b412 100644 --- a/openssl/Configurations/10-main.conf +++ b/openssl/Configurations/10-main.conf @@ -1414,6 +1414,25 @@ my %targets = ( AR => add("-X32"), RANLIB => add("-X32"), }, + # To enable openxl compiler for aix + # If 17.1 openxl runtime is available, -latomic can be used + # instead of -DBROKEN_CLANG_ATOMICS + "aix-clang" => { + inherit_from => [ "aix-common" ], + CC => "ibm-clang", + CFLAGS => picker(debug => "-O0 -g", + release => "-O"), + cflags => combine("-Wno-implicit-function-declaration -mcmodel=large -DBROKEN_CLANG_ATOMICS", + threads("-pthread")), + ex_libs => add(threads("-pthread")), + bn_ops => "BN_LLONG RC4_CHAR", + asm_arch => 'ppc32', + perlasm_scheme => "aix32", + shared_cflag => "-fpic", + shared_ldflag => add("-shared"), + AR => add("-X32"), + RANLIB => add("-X32"), + }, # shared_target of "aix-solib" builds shared libraries packaged # without archives. This improves the behavior of inter-library # references (libssl depending on libcrypto) when building with @@ -1445,6 +1464,23 @@ my %targets = ( AR => add("-X64"), RANLIB => add("-X64"), }, + "aix64-clang" => { + inherit_from => [ "aix-common" ], + CC => "ibm-clang", + CFLAGS => picker(debug => "-O0 -g", + release => "-O"), + cflags => combine("-maix64 -Wno-implicit-function-declaration -mcmodel=large", + threads("-pthread")), + ex_libs => add(threads("-pthread")), + bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR", + asm_arch => 'ppc64', + perlasm_scheme => "aix64", + shared_cflag => "-fpic", + shared_ldflag => add("-shared"), + shared_extension => "64.so.\$(SHLIB_VERSION_NUMBER)", + AR => add("-X64"), + RANLIB => add("-X64"), + }, "aix64-cc-solib" => { inherit_from => [ "aix64-cc" ], shared_target => "aix-solib", diff --git a/openssl/Configurations/15-ios.conf b/openssl/Configurations/15-ios.conf index 478f30f47..6f33df381 100644 --- a/openssl/Configurations/15-ios.conf +++ b/openssl/Configurations/15-ios.conf @@ -11,7 +11,7 @@ my %targets = ( template => 1, inherit_from => [ "darwin-common" ], sys_id => "iOS", - disable => [ "shared", "async" ], + disable => [ "async" ], }, "ios-xcrun" => { inherit_from => [ "ios-common" ], diff --git a/openssl/Configure b/openssl/Configure index 3b6617c17..238152b29 100755 --- a/openssl/Configure +++ b/openssl/Configure @@ -167,7 +167,6 @@ my @gcc_devteam_warn = qw( -Wshadow -Wformat -Wno-type-limits - -Wno-tautological-constant-out-of-range-compare -Wundef -Werror -Wmissing-prototypes @@ -184,11 +183,11 @@ my @gcc_devteam_warn = qw( # -Wextended-offsetof -- no, needed in CMS ASN1 code my @clang_devteam_warn = qw( -Wno-unknown-warning-option - -Wswitch-default -Wno-parentheses-equality -Wno-language-extension-token -Wno-extended-offsetof -Wno-missing-braces + -Wno-tautological-constant-out-of-range-compare -Wconditional-uninitialized -Wincompatible-pointer-types-discards-qualifiers -Wmissing-variable-declarations @@ -1658,7 +1657,7 @@ if (!$disabled{makedepend}) { disable('unavailable', 'makedepend') unless $config{makedep_scheme}; } -if (!$disabled{asm} && !$predefined_C{__MACH__} && $^O ne 'VMS') { +if (!$disabled{asm} && !$predefined_C{__MACH__} && $^O ne 'VMS' && !$predefined_C{_AIX}) { # probe for -Wa,--noexecstack option... if ($predefined_C{__clang__}) { # clang has builtin assembler, which doesn't recognize --help, @@ -3507,6 +3506,13 @@ sub absolutedir { return rel2abs($dir); } + # realpath() on Windows seems to check if the directory actually exists, + # which isn't what is wanted here. All we want to know is if a directory + # spec is absolute, not if it exists. + if ($^O eq "MSWin32") { + return rel2abs($dir); + } + # We use realpath() on Unix, since no other will properly clean out # a directory spec. use Cwd qw/realpath/; diff --git a/openssl/INSTALL.md b/openssl/INSTALL.md index b486ee155..50a8baac4 100644 --- a/openssl/INSTALL.md +++ b/openssl/INSTALL.md @@ -1291,7 +1291,7 @@ Configure OpenSSL ### Automatic Configuration In previous version, the `config` script determined the platform type and -compiler and then called `Configure`. Starting with this release, they are +compiler and then called `Configure`. Starting with version 3.0, they are the same. #### Unix / Linux / macOS @@ -1746,7 +1746,7 @@ More about our support resources can be found in the [SUPPORT] file. ### Configuration Errors -If the `./Configure` or `./Configure` command fails with an error message, +If the `./config` or `./Configure` command fails with an error message, read the error message carefully and try to figure out whether you made a mistake (e.g., by providing a wrong option), or whether the script is working incorrectly. If you think you encountered a bug, please diff --git a/openssl/NEWS.md b/openssl/NEWS.md index ec5090956..fcd00deb9 100644 --- a/openssl/NEWS.md +++ b/openssl/NEWS.md @@ -21,6 +21,19 @@ OpenSSL Releases OpenSSL 3.3 ----------- +### Major changes between OpenSSL 3.3.1 and OpenSSL 3.3.2 [3 Sep 2024] + +OpenSSL 3.3.2 is a security patch release. The most severe CVE fixed in this +release is Moderate. + +This release incorporates the following bug fixes and mitigations: + + * Fixed possible denial of service in X.509 name checks + ([CVE-2024-6119]) + + * Fixed possible buffer overread in SSL_select_next_proto() + ([CVE-2024-5535]) + ### Major changes between OpenSSL 3.3.0 and OpenSSL 3.3.1 [4 Jun 2024] OpenSSL 3.3.1 is a security patch release. The most severe CVE fixed in this @@ -1729,6 +1742,8 @@ OpenSSL 0.9.x +[CVE-2024-6119]: https://www.openssl.org/news/vulnerabilities.html#CVE-2024-6119 +[CVE-2024-5535]: https://www.openssl.org/news/vulnerabilities.html#CVE-2024-5535 [CVE-2024-4741]: https://www.openssl.org/news/vulnerabilities.html#CVE-2024-4741 [CVE-2024-4603]: https://www.openssl.org/news/vulnerabilities.html#CVE-2024-4603 [CVE-2024-2511]: https://www.openssl.org/news/vulnerabilities.html#CVE-2024-2511 diff --git a/openssl/VERSION.dat b/openssl/VERSION.dat index aaa93910d..856313357 100644 --- a/openssl/VERSION.dat +++ b/openssl/VERSION.dat @@ -1,7 +1,7 @@ MAJOR=3 MINOR=3 -PATCH=1 +PATCH=2 PRE_RELEASE_TAG= BUILD_METADATA= -RELEASE_DATE="4 Jun 2024" +RELEASE_DATE="3 Sep 2024" SHLIB_VERSION=3 diff --git a/openssl/apps/cmp.c b/openssl/apps/cmp.c index 213596f72..10a477dac 100644 --- a/openssl/apps/cmp.c +++ b/openssl/apps/cmp.c @@ -3435,13 +3435,28 @@ int cmp_main(int argc, char **argv) opt_extracertsout, "extra") < 0) goto err; if (newcert != NULL && (opt_cmd == CMP_IR || opt_cmd == CMP_CR - || opt_cmd == CMP_KUR || opt_cmd == CMP_P10CR)) - if (!save_cert_or_delete(newcert, opt_certout, "newly enrolled") - || save_free_certs(OSSL_CMP_CTX_get1_newChain(cmp_ctx), - opt_chainout, "chain") < 0 - || save_free_certs(OSSL_CMP_CTX_get1_caPubs(cmp_ctx), - opt_cacertsout, "CA") < 0) + || opt_cmd == CMP_KUR || opt_cmd == CMP_P10CR)) { + STACK_OF(X509) *newchain = OSSL_CMP_CTX_get1_newChain(cmp_ctx); + + if (newcert != NULL && newchain != NULL /* NULL is on error only */ + && opt_certout != NULL && opt_chainout != NULL + && strcmp(opt_certout, opt_chainout) == 0) { + if (!X509_add_cert(newchain, newcert, X509_ADD_FLAG_PREPEND + | X509_ADD_FLAG_UP_REF)) { + sk_X509_pop_free(newchain, X509_free); + goto err; + } + if (!save_free_certs(newchain, opt_chainout, "newly enrolled cert and chain")) + goto err; + } else { + if (save_free_certs(newchain, opt_chainout, "chain") < 0 + || !save_cert_or_delete(newcert, opt_certout, "newly enrolled")) + goto err; + } + if (save_free_certs(OSSL_CMP_CTX_get1_caPubs(cmp_ctx), + opt_cacertsout, "CA") < 0) goto err; + } if (!OSSL_CMP_CTX_reinit(cmp_ctx)) goto err; } diff --git a/openssl/apps/cms.c b/openssl/apps/cms.c index f93c98ac9..ac5f78ecc 100644 --- a/openssl/apps/cms.c +++ b/openssl/apps/cms.c @@ -1,5 +1,5 @@ /* - * Copyright 2008-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2008-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -133,7 +133,7 @@ const OPTIONS cms_options[] = { {"binary", OPT_BINARY, '-', "Treat input as binary: do not translate to canonical form"}, {"crlfeol", OPT_CRLFEOL, '-', - "Use CRLF as EOL termination instead of CR only" }, + "Use CRLF as EOL termination instead of LF only" }, {"asciicrlf", OPT_ASCIICRLF, '-', "Perform CRLF canonicalisation when signing"}, diff --git a/openssl/apps/dgst.c b/openssl/apps/dgst.c index 28123f813..2511a2ffc 100644 --- a/openssl/apps/dgst.c +++ b/openssl/apps/dgst.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -479,7 +479,7 @@ int dgst_main(int argc, char **argv) static void show_digests(const OBJ_NAME *name, void *arg) { struct doall_dgst_digests *dec = (struct doall_dgst_digests *)arg; - const EVP_MD *md = NULL; + EVP_MD *md = NULL; /* Filter out signed digests (a.k.a signature algorithms) */ if (strstr(name->name, "rsa") != NULL || strstr(name->name, "RSA") != NULL) @@ -491,8 +491,7 @@ static void show_digests(const OBJ_NAME *name, void *arg) /* Filter out message digests that we cannot use */ md = EVP_MD_fetch(app_get0_libctx(), name->name, app_get0_propq()); if (md == NULL) { - md = EVP_get_digestbyname(name->name); - if (md == NULL) + if (EVP_get_digestbyname(name->name) == NULL) return; } @@ -503,6 +502,8 @@ static void show_digests(const OBJ_NAME *name, void *arg) } else { BIO_printf(dec->bio, " "); } + + EVP_MD_free(md); } /* diff --git a/openssl/apps/lib/opt.c b/openssl/apps/lib/opt.c index 0490c39c2..0018c268c 100644 --- a/openssl/apps/lib/opt.c +++ b/openssl/apps/lib/opt.c @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2015-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -646,7 +646,7 @@ int opt_uintmax(const char *value, ossl_uintmax_t *result) opt_number_error(value); return 0; } - *result = (ossl_intmax_t)m; + *result = (ossl_uintmax_t)m; errno = oerrno; return 1; } diff --git a/openssl/apps/lib/s_cb.c b/openssl/apps/lib/s_cb.c index 5f14e532d..4ae8d8a1b 100644 --- a/openssl/apps/lib/s_cb.c +++ b/openssl/apps/lib/s_cb.c @@ -704,7 +704,7 @@ void msg_cb(int write_p, int version, int content_type, const void *buf, (void)BIO_flush(bio); } -static STRINT_PAIR tlsext_types[] = { +static const STRINT_PAIR tlsext_types[] = { {"server name", TLSEXT_TYPE_server_name}, {"max fragment length", TLSEXT_TYPE_max_fragment_length}, {"client certificate URL", TLSEXT_TYPE_client_certificate_url}, @@ -746,6 +746,7 @@ static STRINT_PAIR tlsext_types[] = { {"psk kex modes", TLSEXT_TYPE_psk_kex_modes}, {"certificate authorities", TLSEXT_TYPE_certificate_authorities}, {"post handshake auth", TLSEXT_TYPE_post_handshake_auth}, + {"early_data", TLSEXT_TYPE_early_data}, {NULL} }; diff --git a/openssl/apps/lib/s_socket.c b/openssl/apps/lib/s_socket.c index 67839f616..5dd3143ab 100644 --- a/openssl/apps/lib/s_socket.c +++ b/openssl/apps/lib/s_socket.c @@ -88,9 +88,6 @@ int init_client(int *sock, const char *host, const char *port, int ret; int options = 0; - if (tfo && ba_ret != NULL) - *ba_ret = NULL; - if (BIO_sock_init() != 1) return 0; diff --git a/openssl/apps/s_client.c b/openssl/apps/s_client.c index 57a12fd35..9f51cbf3b 100644 --- a/openssl/apps/s_client.c +++ b/openssl/apps/s_client.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. * Copyright 2005 Nokia. All rights reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use @@ -2167,6 +2167,9 @@ int s_client_main(int argc, char **argv) if (tfo) BIO_printf(bio_c_out, "Connecting via TFO\n"); re_start: + /* peer_addr might be set from previous connections */ + BIO_ADDR_free(peer_addr); + peer_addr = NULL; if (init_client(&sock, host, port, bindhost, bindport, socket_family, socket_type, protocol, tfo, !isquic, &peer_addr) == 0) { BIO_printf(bio_err, "connect:errno=%d\n", get_last_socket_error()); diff --git a/openssl/apps/smime.c b/openssl/apps/smime.c index b59e14b0b..c6c300c0b 100644 --- a/openssl/apps/smime.c +++ b/openssl/apps/smime.c @@ -1,5 +1,5 @@ /* - * Copyright 1999-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1999-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -118,7 +118,7 @@ const OPTIONS smime_options[] = { "Do not load certificates from the default certificates store"}, {"nochain", OPT_NOCHAIN, '-', "set PKCS7_NOCHAIN so certificates contained in the message are not used as untrusted CAs" }, - {"crlfeol", OPT_CRLFEOL, '-', "Use CRLF as EOL termination instead of CR only"}, + {"crlfeol", OPT_CRLFEOL, '-', "Use CRLF as EOL termination instead of LF only"}, OPT_R_OPTIONS, OPT_V_OPTIONS, diff --git a/openssl/apps/speed.c b/openssl/apps/speed.c index 84a8d8877..f2ae2e3a1 100644 --- a/openssl/apps/speed.c +++ b/openssl/apps/speed.c @@ -3056,7 +3056,7 @@ int speed_main(int argc, char **argv) ERR_print_errors(bio_err); op_count = 1; } else { - pkey_print_message("private", "rsa encrypt", + pkey_print_message("public", "rsa encrypt", rsa_keys[testnum].bits, seconds.rsa); /* RSA_blinding_on(rsa_key[testnum],NULL); */ Time_F(START); @@ -3124,7 +3124,6 @@ int speed_main(int argc, char **argv) loopargs[i].sigsize = loopargs[i].buflen; if (loopargs[i].dsa_sign_ctx[testnum] == NULL || EVP_PKEY_sign_init(loopargs[i].dsa_sign_ctx[testnum]) <= 0 - || EVP_PKEY_sign(loopargs[i].dsa_sign_ctx[testnum], loopargs[i].buf2, &loopargs[i].sigsize, @@ -3201,7 +3200,6 @@ int speed_main(int argc, char **argv) loopargs[i].sigsize = loopargs[i].buflen; if (loopargs[i].ecdsa_sign_ctx[testnum] == NULL || EVP_PKEY_sign_init(loopargs[i].ecdsa_sign_ctx[testnum]) <= 0 - || EVP_PKEY_sign(loopargs[i].ecdsa_sign_ctx[testnum], loopargs[i].buf2, &loopargs[i].sigsize, diff --git a/openssl/build.info b/openssl/build.info index 790f2421e..930a0a940 100644 --- a/openssl/build.info +++ b/openssl/build.info @@ -102,6 +102,11 @@ IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-|BC-)/ -}] ENDIF # This file sets the build directory up for CMake inclusion +# Note: This generation of OpenSSLConfig[Version].cmake is used +# for building openssl locally, and so the build variables are +# taken from builddata.pm rather than installdata.pm. For exportable +# versions of these generated files, you'll find them in the exporters +# directory GENERATE[OpenSSLConfig.cmake]=exporters/cmake/OpenSSLConfig.cmake.in DEPEND[OpenSSLConfig.cmake]=builddata.pm GENERATE[OpenSSLConfigVersion.cmake]=exporters/cmake/OpenSSLConfigVersion.cmake.in @@ -119,7 +124,8 @@ DEPEND[openssl.pc]=builddata.pm DEPEND[openssl.pc]=libcrypto.pc libssl.pc GENERATE[builddata.pm]=util/mkinstallvars.pl \ - PREFIX=. BINDIR=apps LIBDIR= INCLUDEDIR=include APPLINKDIR=ms \ + PREFIX=. BINDIR=apps APPLINKDIR=ms \ + LIBDIR= INCLUDEDIR=include "INCLUDEDIR=$(SRCDIR)/include" \ ENGINESDIR=engines MODULESDIR=providers \ "VERSION=$(VERSION)" "LDLIBS=$(LIB_EX_LIBS)" diff --git a/openssl/crypto/aes/build.info b/openssl/crypto/aes/build.info index a428f6c5f..60f04801c 100644 --- a/openssl/crypto/aes/build.info +++ b/openssl/crypto/aes/build.info @@ -38,7 +38,7 @@ IF[{- !$disabled{asm} -}] $AESASM_parisc20_64=$AESASM_parisc11 $AESDEF_parisc20_64=$AESDEF_parisc11 - IF[{- $target{sys_id} ne "AIX" && $target{sys_id} ne "MACOSX" && $target{sys_id} ne "AMIGA" -}] + IF[{- $target{sys_id} ne "MACOSX" && $target{sys_id} ne "AMIGA" -}] $AESASM_ppc32=aes_core.c aes_cbc.c aes-ppc.s vpaes-ppc.s aesp8-ppc.s ELSE $AESASM_ppc32=aes_core.c aes_cbc.c aes-ppc.s vpaes-ppc.s diff --git a/openssl/crypto/asn1/a_d2i_fp.c b/openssl/crypto/asn1/a_d2i_fp.c index 4af2276a8..4999ac1f6 100644 --- a/openssl/crypto/asn1/a_d2i_fp.c +++ b/openssl/crypto/asn1/a_d2i_fp.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -148,6 +148,9 @@ int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb) goto err; } len += i; + if ((size_t)i < want) + continue; + } } /* else data already loaded */ diff --git a/openssl/crypto/asn1/a_strex.c b/openssl/crypto/asn1/a_strex.c index 29ea60596..f64e3520f 100644 --- a/openssl/crypto/asn1/a_strex.c +++ b/openssl/crypto/asn1/a_strex.c @@ -1,5 +1,5 @@ /* - * Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -10,6 +10,7 @@ #include #include #include "internal/cryptlib.h" +#include "internal/sizes.h" #include "crypto/asn1.h" #include #include @@ -343,8 +344,10 @@ static int do_print_ex(char_io *io_ch, void *arg, unsigned long lflags, if (lflags & ASN1_STRFLGS_SHOW_TYPE) { const char *tagname; + tagname = ASN1_tag2str(type); - outlen += strlen(tagname); + /* We can directly cast here as tagname will never be too large. */ + outlen += (int)strlen(tagname); if (!io_ch(arg, tagname, outlen) || !io_ch(arg, ":", 1)) return -1; outlen++; @@ -370,7 +373,7 @@ static int do_print_ex(char_io *io_ch, void *arg, unsigned long lflags, if (type == -1) { len = do_dump(lflags, io_ch, arg, str); - if (len < 0) + if (len < 0 || len > INT_MAX - outlen) return -1; outlen += len; return outlen; @@ -389,7 +392,7 @@ static int do_print_ex(char_io *io_ch, void *arg, unsigned long lflags, } len = do_buf(str->data, str->length, type, flags, "es, io_ch, NULL); - if (len < 0) + if (len < 0 || len > INT_MAX - 2 - outlen) return -1; outlen += len; if (quotes) diff --git a/openssl/crypto/asn1/a_verify.c b/openssl/crypto/asn1/a_verify.c index 94d29e7c2..f6cac8096 100644 --- a/openssl/crypto/asn1/a_verify.c +++ b/openssl/crypto/asn1/a_verify.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -202,10 +202,12 @@ int ASN1_item_verify_ctx(const ASN1_ITEM *it, const X509_ALGOR *alg, inl = ASN1_item_i2d(data, &buf_in, it); if (inl <= 0) { ERR_raise(ERR_LIB_ASN1, ERR_R_INTERNAL_ERROR); + ret = -1; goto err; } if (buf_in == NULL) { ERR_raise(ERR_LIB_ASN1, ERR_R_ASN1_LIB); + ret = -1; goto err; } inll = inl; diff --git a/openssl/crypto/asn1/tasn_fre.c b/openssl/crypto/asn1/tasn_fre.c index 13aa6a728..f8068832a 100644 --- a/openssl/crypto/asn1/tasn_fre.c +++ b/openssl/crypto/asn1/tasn_fre.c @@ -1,5 +1,5 @@ /* - * Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -85,8 +85,12 @@ void ossl_asn1_item_embed_free(ASN1_VALUE **pval, const ASN1_ITEM *it, int embed case ASN1_ITYPE_NDEF_SEQUENCE: case ASN1_ITYPE_SEQUENCE: - if (ossl_asn1_do_lock(pval, -1, it) != 0) /* if error or ref-counter > 0 */ + if (ossl_asn1_do_lock(pval, -1, it) != 0) { + /* if error or ref-counter > 0 */ + OPENSSL_assert(embed == 0); + *pval = NULL; return; + } if (asn1_cb) { i = asn1_cb(ASN1_OP_FREE_PRE, pval, it, NULL); if (i == 2) diff --git a/openssl/crypto/bio/bf_readbuff.c b/openssl/crypto/bio/bf_readbuff.c index 135ccef83..2409c9db9 100644 --- a/openssl/crypto/bio/bf_readbuff.c +++ b/openssl/crypto/bio/bf_readbuff.c @@ -1,5 +1,5 @@ /* - * Copyright 2021 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -222,10 +222,13 @@ static int readbuffer_gets(BIO *b, char *buf, int size) char *p; int i, j; - if (size == 0) + if (buf == NULL || size == 0) return 0; --size; /* the passed in size includes the terminator - so remove it here */ ctx = (BIO_F_BUFFER_CTX *)b->ptr; + + if (ctx == NULL || b->next_bio == NULL) + return 0; BIO_clear_retry_flags(b); /* If data is already buffered then use this first */ diff --git a/openssl/crypto/bio/bio_addr.c b/openssl/crypto/bio/bio_addr.c index 32cf19938..83099c14a 100644 --- a/openssl/crypto/bio/bio_addr.c +++ b/openssl/crypto/bio/bio_addr.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -799,14 +799,12 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type, if (!RUN_ONCE(&bio_lookup_init, do_bio_lookup_init)) { /* Should this be raised inside do_bio_lookup_init()? */ ERR_raise(ERR_LIB_BIO, ERR_R_CRYPTO_LIB); - ret = 0; - goto err; + return 0; } - if (!CRYPTO_THREAD_write_lock(bio_lookup_lock)) { - ret = 0; - goto err; - } + if (!CRYPTO_THREAD_write_lock(bio_lookup_lock)) + return 0; + he_fallback_address = INADDR_ANY; if (host == NULL) { he = &he_fallback; diff --git a/openssl/crypto/cmp/cmp_vfy.c b/openssl/crypto/cmp/cmp_vfy.c index ec99ab7fe..47bf38b2a 100644 --- a/openssl/crypto/cmp/cmp_vfy.c +++ b/openssl/crypto/cmp/cmp_vfy.c @@ -632,7 +632,7 @@ int OSSL_CMP_validate_msg(OSSL_CMP_CTX *ctx, const OSSL_CMP_MSG *msg) default: scrt = ctx->srvCert; if (scrt == NULL) { - if (ctx->trusted == NULL) { + if (ctx->trusted == NULL && ctx->secretValue != NULL) { ossl_cmp_info(ctx, "no trust store nor pinned server cert available for verifying signature-based CMP message protection"); ERR_raise(ERR_LIB_CMP, CMP_R_MISSING_TRUST_ANCHOR); return 0; diff --git a/openssl/crypto/conf/conf_def.c b/openssl/crypto/conf/conf_def.c index e047746f6..399aefb19 100644 --- a/openssl/crypto/conf/conf_def.c +++ b/openssl/crypto/conf/conf_def.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -330,7 +330,7 @@ static int def_load_bio(CONF *conf, BIO *in, long *line) v = NULL; /* check for line continuation */ - if (bufnum >= 1) { + if (!again && bufnum >= 1) { /* * If we have bytes and the last char '\\' and second last char * is not '\\' diff --git a/openssl/crypto/conf/conf_lib.c b/openssl/crypto/conf/conf_lib.c index 601f49430..2a1c992eb 100644 --- a/openssl/crypto/conf/conf_lib.c +++ b/openssl/crypto/conf/conf_lib.c @@ -476,6 +476,9 @@ int OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *settings, void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings) { + if (settings == NULL) + return; + free(settings->filename); free(settings->appname); free(settings); diff --git a/openssl/crypto/conf/conf_mod.c b/openssl/crypto/conf/conf_mod.c index ab839278f..649817d7f 100644 --- a/openssl/crypto/conf/conf_mod.c +++ b/openssl/crypto/conf/conf_mod.c @@ -99,7 +99,7 @@ static void module_lists_free(void) DEFINE_RUN_ONCE_STATIC(do_init_module_list_lock) { - module_list_lock = ossl_rcu_lock_new(1); + module_list_lock = ossl_rcu_lock_new(1, NULL); if (module_list_lock == NULL) { ERR_raise(ERR_LIB_CONF, ERR_R_CRYPTO_LIB); return 0; @@ -518,13 +518,14 @@ void CONF_modules_unload(int all) old_modules = ossl_rcu_deref(&supported_modules); new_modules = sk_CONF_MODULE_dup(old_modules); - to_delete = sk_CONF_MODULE_new_null(); if (new_modules == NULL) { ossl_rcu_write_unlock(module_list_lock); return; } + to_delete = sk_CONF_MODULE_new_null(); + /* unload modules in reverse order */ for (i = sk_CONF_MODULE_num(new_modules) - 1; i >= 0; i--) { md = sk_CONF_MODULE_value(new_modules, i); diff --git a/openssl/crypto/conf/conf_sap.c b/openssl/crypto/conf/conf_sap.c index 6b3defe0f..106434dcb 100644 --- a/openssl/crypto/conf/conf_sap.c +++ b/openssl/crypto/conf/conf_sap.c @@ -38,6 +38,8 @@ void OPENSSL_config(const char *appname) settings.appname = strdup(appname); settings.flags = DEFAULT_CONF_MFLAGS; OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, &settings); + + free(settings.appname); } #endif diff --git a/openssl/crypto/context.c b/openssl/crypto/context.c index 33d52a964..e6edaac51 100644 --- a/openssl/crypto/context.c +++ b/openssl/crypto/context.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -29,6 +29,7 @@ struct ossl_lib_ctx_st { void *global_properties; void *drbg; void *drbg_nonce; + CRYPTO_THREAD_LOCAL rcu_local_key; #ifndef FIPS_MODULE void *provider_conf; void *bio_core; @@ -81,9 +82,12 @@ static int context_init(OSSL_LIB_CTX *ctx) { int exdata_done = 0; + if (!CRYPTO_THREAD_init_local(&ctx->rcu_local_key, NULL)) + return 0; + ctx->lock = CRYPTO_THREAD_lock_new(); if (ctx->lock == NULL) - return 0; + goto err; ctx->rand_crngt_lock = CRYPTO_THREAD_lock_new(); if (ctx->rand_crngt_lock == NULL) @@ -209,6 +213,7 @@ static int context_init(OSSL_LIB_CTX *ctx) CRYPTO_THREAD_lock_free(ctx->rand_crngt_lock); CRYPTO_THREAD_lock_free(ctx->lock); + CRYPTO_THREAD_cleanup_local(&ctx->rcu_local_key); memset(ctx, '\0', sizeof(*ctx)); return 0; } @@ -355,6 +360,7 @@ static int context_deinit(OSSL_LIB_CTX *ctx) CRYPTO_THREAD_lock_free(ctx->lock); ctx->rand_crngt_lock = NULL; ctx->lock = NULL; + CRYPTO_THREAD_cleanup_local(&ctx->rcu_local_key); return 1; } @@ -471,7 +477,7 @@ int OSSL_LIB_CTX_load_config(OSSL_LIB_CTX *ctx, const char *config_file) void OSSL_LIB_CTX_free(OSSL_LIB_CTX *ctx) { - if (ossl_lib_ctx_is_default(ctx)) + if (ctx == NULL || ossl_lib_ctx_is_default(ctx)) return; #ifndef FIPS_MODULE @@ -652,3 +658,11 @@ const char *ossl_lib_ctx_get_descriptor(OSSL_LIB_CTX *libctx) return "Non-default library context"; #endif } + +CRYPTO_THREAD_LOCAL *ossl_lib_ctx_get_rcukey(OSSL_LIB_CTX *libctx) +{ + libctx = ossl_lib_ctx_get_concrete(libctx); + if (libctx == NULL) + return NULL; + return &libctx->rcu_local_key; +} diff --git a/openssl/crypto/ec/ecdsa_ossl.c b/openssl/crypto/ec/ecdsa_ossl.c index 8b4d25d59..402a55424 100644 --- a/openssl/crypto/ec/ecdsa_ossl.c +++ b/openssl/crypto/ec/ecdsa_ossl.c @@ -172,7 +172,11 @@ static int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB); goto err; } - order = EC_GROUP_get0_order(group); + + if ((order = EC_GROUP_get0_order(group)) == NULL) { + ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB); + goto err; + } /* Preallocate space */ order_bits = BN_num_bits(order); @@ -308,7 +312,11 @@ ECDSA_SIG *ossl_ecdsa_simple_sign_sig(const unsigned char *dgst, int dgst_len, goto err; } - order = EC_GROUP_get0_order(group); + if ((order = EC_GROUP_get0_order(group)) == NULL) { + ERR_raise(ERR_LIB_EC, ERR_R_EC_LIB); + goto err; + } + i = BN_num_bits(order); /* * Need to truncate digest if it is too long: first truncate whole bytes. diff --git a/openssl/crypto/engine/eng_list.c b/openssl/crypto/engine/eng_list.c index a2c151d64..ee9471a1f 100644 --- a/openssl/crypto/engine/eng_list.c +++ b/openssl/crypto/engine/eng_list.c @@ -1,5 +1,5 @@ /* - * Copyright 2001-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2001-2024 The OpenSSL Project Authors. All Rights Reserved. * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved * * Licensed under the Apache License 2.0 (the "License"). You may not use @@ -243,6 +243,7 @@ ENGINE *ENGINE_get_first(void) int ref; if (!CRYPTO_UP_REF(&ret->struct_ref, &ref)) { + CRYPTO_THREAD_unlock(global_engine_lock); ERR_raise(ERR_LIB_ENGINE, ERR_R_CRYPTO_LIB); return NULL; } @@ -269,6 +270,7 @@ ENGINE *ENGINE_get_last(void) int ref; if (!CRYPTO_UP_REF(&ret->struct_ref, &ref)) { + CRYPTO_THREAD_unlock(global_engine_lock); ERR_raise(ERR_LIB_ENGINE, ERR_R_CRYPTO_LIB); return NULL; } @@ -294,6 +296,7 @@ ENGINE *ENGINE_get_next(ENGINE *e) /* Return a valid structural reference to the next ENGINE */ if (!CRYPTO_UP_REF(&ret->struct_ref, &ref)) { + CRYPTO_THREAD_unlock(global_engine_lock); ERR_raise(ERR_LIB_ENGINE, ERR_R_CRYPTO_LIB); return NULL; } @@ -320,6 +323,7 @@ ENGINE *ENGINE_get_prev(ENGINE *e) /* Return a valid structural reference to the next ENGINE */ if (!CRYPTO_UP_REF(&ret->struct_ref, &ref)) { + CRYPTO_THREAD_unlock(global_engine_lock); ERR_raise(ERR_LIB_ENGINE, ERR_R_CRYPTO_LIB); return NULL; } diff --git a/openssl/crypto/engine/eng_table.c b/openssl/crypto/engine/eng_table.c index 9dc3144bb..6280965cc 100644 --- a/openssl/crypto/engine/eng_table.c +++ b/openssl/crypto/engine/eng_table.c @@ -1,5 +1,5 @@ /* - * Copyright 2001-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2001-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -215,9 +215,11 @@ ENGINE *ossl_engine_table_select(ENGINE_TABLE **table, int nid, f, l, nid); return NULL; } - ERR_set_mark(); + if (!CRYPTO_THREAD_write_lock(global_engine_lock)) - goto end; + return NULL; + + ERR_set_mark(); /* * Check again inside the lock otherwise we could race against cleanup * operations. But don't worry about a debug printout diff --git a/openssl/crypto/evp/ctrl_params_translate.c b/openssl/crypto/evp/ctrl_params_translate.c index 54e589054..406343f0a 100644 --- a/openssl/crypto/evp/ctrl_params_translate.c +++ b/openssl/crypto/evp/ctrl_params_translate.c @@ -1,5 +1,5 @@ /* - * Copyright 2021-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -2845,7 +2845,7 @@ static int evp_pkey_ctx_setget_params_to_ctrl(EVP_PKEY_CTX *pctx, fixup_args_fn *fixup = default_fixup_args; int ret; - tmpl.action_type = action_type; + ctx.action_type = tmpl.action_type = action_type; tmpl.keytype1 = tmpl.keytype2 = keytype; tmpl.optype = optype; tmpl.param_key = params->key; @@ -2854,7 +2854,6 @@ static int evp_pkey_ctx_setget_params_to_ctrl(EVP_PKEY_CTX *pctx, if (translation != NULL) { if (translation->fixup_args != NULL) fixup = translation->fixup_args; - ctx.action_type = translation->action_type; ctx.ctrl_cmd = translation->ctrl_num; } ctx.pctx = pctx; diff --git a/openssl/crypto/evp/digest.c b/openssl/crypto/evp/digest.c index ab670a8f4..3e835c9a7 100644 --- a/openssl/crypto/evp/digest.c +++ b/openssl/crypto/evp/digest.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -425,7 +425,7 @@ int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, size_t count) /* Code below to be removed when legacy support is dropped. */ legacy: - return ctx->update(ctx, data, count); + return ctx->update != NULL ? ctx->update(ctx, data, count) : 0; } /* The caller can assume that this removes any secret data from the context */ diff --git a/openssl/crypto/evp/names.c b/openssl/crypto/evp/names.c index 19c03a308..7ff850f99 100644 --- a/openssl/crypto/evp/names.c +++ b/openssl/crypto/evp/names.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -78,6 +78,7 @@ const EVP_CIPHER *evp_get_cipherbyname_ex(OSSL_LIB_CTX *libctx, const EVP_CIPHER *cp; OSSL_NAMEMAP *namemap; int id; + int do_retry = 1; if (!OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS, NULL)) return NULL; @@ -94,9 +95,21 @@ const EVP_CIPHER *evp_get_cipherbyname_ex(OSSL_LIB_CTX *libctx, */ namemap = ossl_namemap_stored(libctx); + retry: id = ossl_namemap_name2num(namemap, name); - if (id == 0) - return NULL; + if (id == 0) { + EVP_CIPHER *fetched_cipher; + + /* Try to fetch it because the name might not be known yet. */ + if (!do_retry) + return NULL; + do_retry = 0; + ERR_set_mark(); + fetched_cipher = EVP_CIPHER_fetch(libctx, name, NULL); + EVP_CIPHER_free(fetched_cipher); + ERR_pop_to_mark(); + goto retry; + } if (!ossl_namemap_doall_names(namemap, id, cipher_from_name, &cp)) return NULL; @@ -124,6 +137,7 @@ const EVP_MD *evp_get_digestbyname_ex(OSSL_LIB_CTX *libctx, const char *name) const EVP_MD *dp; OSSL_NAMEMAP *namemap; int id; + int do_retry = 1; if (!OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_DIGESTS, NULL)) return NULL; @@ -140,9 +154,21 @@ const EVP_MD *evp_get_digestbyname_ex(OSSL_LIB_CTX *libctx, const char *name) */ namemap = ossl_namemap_stored(libctx); + retry: id = ossl_namemap_name2num(namemap, name); - if (id == 0) - return NULL; + if (id == 0) { + EVP_MD *fetched_md; + + /* Try to fetch it because the name might not be known yet. */ + if (!do_retry) + return NULL; + do_retry = 0; + ERR_set_mark(); + fetched_md = EVP_MD_fetch(libctx, name, NULL); + EVP_MD_free(fetched_md); + ERR_pop_to_mark(); + goto retry; + } if (!ossl_namemap_doall_names(namemap, id, digest_from_name, &dp)) return NULL; diff --git a/openssl/crypto/evp/pmeth_lib.c b/openssl/crypto/evp/pmeth_lib.c index 0a561323f..71485c949 100644 --- a/openssl/crypto/evp/pmeth_lib.c +++ b/openssl/crypto/evp/pmeth_lib.c @@ -1008,6 +1008,7 @@ static int evp_pkey_ctx_add1_octet_string(EVP_PKEY_CTX *ctx, int fallback, int datalen) { OSSL_PARAM os_params[2]; + const OSSL_PARAM *gettables; unsigned char *info = NULL; size_t info_len = 0; size_t info_alloc = 0; @@ -1031,6 +1032,12 @@ static int evp_pkey_ctx_add1_octet_string(EVP_PKEY_CTX *ctx, int fallback, return 1; } + /* Check for older provider that doesn't support getting this parameter */ + gettables = EVP_PKEY_CTX_gettable_params(ctx); + if (gettables == NULL || OSSL_PARAM_locate_const(gettables, param) == NULL) + return evp_pkey_ctx_set1_octet_string(ctx, fallback, param, op, ctrl, + data, datalen); + /* Get the original value length */ os_params[0] = OSSL_PARAM_construct_octet_string(param, NULL, 0); os_params[1] = OSSL_PARAM_construct_end(); @@ -1038,9 +1045,9 @@ static int evp_pkey_ctx_add1_octet_string(EVP_PKEY_CTX *ctx, int fallback, if (!EVP_PKEY_CTX_get_params(ctx, os_params)) return 0; - /* Older provider that doesn't support getting this parameter */ + /* This should not happen but check to be sure. */ if (os_params[0].return_size == OSSL_PARAM_UNMODIFIED) - return evp_pkey_ctx_set1_octet_string(ctx, fallback, param, op, ctrl, data, datalen); + return 0; info_alloc = os_params[0].return_size + datalen; if (info_alloc == 0) diff --git a/openssl/crypto/o_str.c b/openssl/crypto/o_str.c index 065460336..dfac215ac 100644 --- a/openssl/crypto/o_str.c +++ b/openssl/crypto/o_str.c @@ -225,12 +225,14 @@ static int buf2hexstr_sep(char *str, size_t str_n, size_t *strlength, int has_sep = (sep != CH_ZERO); size_t len = has_sep ? buflen * 3 : 1 + buflen * 2; + if (len == 0) + ++len; if (strlength != NULL) *strlength = len; if (str == NULL) return 1; - if (str_n < (unsigned long)len) { + if (str_n < len) { ERR_raise(ERR_LIB_CRYPTO, CRYPTO_R_TOO_SMALL_BUFFER); return 0; } @@ -242,7 +244,7 @@ static int buf2hexstr_sep(char *str, size_t str_n, size_t *strlength, if (has_sep) *q++ = sep; } - if (has_sep) + if (has_sep && buflen > 0) --q; *q = CH_ZERO; diff --git a/openssl/crypto/objects/obj_dat.c b/openssl/crypto/objects/obj_dat.c index 493b0e11d..8bc4fa8ec 100644 --- a/openssl/crypto/objects/obj_dat.c +++ b/openssl/crypto/objects/obj_dat.c @@ -263,7 +263,7 @@ int OBJ_new_nid(int num) static int ossl_obj_add_object(const ASN1_OBJECT *obj, int lock) { ASN1_OBJECT *o = NULL; - ADDED_OBJ *ao[4] = { NULL, NULL, NULL, NULL }, *aop; + ADDED_OBJ *ao[4] = { NULL, NULL, NULL, NULL }, *aop[4]; int i; if ((o = OBJ_dup(obj)) == NULL) @@ -294,9 +294,21 @@ static int ossl_obj_add_object(const ASN1_OBJECT *obj, int lock) if (ao[i] != NULL) { ao[i]->type = i; ao[i]->obj = o; - aop = lh_ADDED_OBJ_insert(added, ao[i]); - /* memory leak, but should not normally matter */ - OPENSSL_free(aop); + aop[i] = lh_ADDED_OBJ_retrieve(added, ao[i]); + if (aop[i] != NULL) + aop[i]->type = -1; + (void)lh_ADDED_OBJ_insert(added, ao[i]); + if (lh_ADDED_OBJ_error(added)) { + if (aop[i] != NULL) + aop[i]->type = i; + while (i-- > ADDED_DATA) { + lh_ADDED_OBJ_delete(added, ao[i]); + if (aop[i] != NULL) + aop[i]->type = i; + } + ERR_raise(ERR_LIB_OBJ, ERR_R_CRYPTO_LIB); + goto err; + } } } o->flags &= diff --git a/openssl/crypto/pkcs12/p12_crt.c b/openssl/crypto/pkcs12/p12_crt.c index 2e40dd93c..d0e3761d4 100644 --- a/openssl/crypto/pkcs12/p12_crt.c +++ b/openssl/crypto/pkcs12/p12_crt.c @@ -1,5 +1,5 @@ /* - * Copyright 1999-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1999-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -249,16 +249,19 @@ PKCS12_SAFEBAG *PKCS12_add_key_ex(STACK_OF(PKCS12_SAFEBAG) **pbags, if (key_usage && !PKCS8_add_keyusage(p8, key_usage)) goto err; if (nid_key != -1) { + /* This call does not take ownership of p8 */ bag = PKCS12_SAFEBAG_create_pkcs8_encrypt_ex(nid_key, pass, -1, NULL, 0, iter, p8, ctx, propq); - PKCS8_PRIV_KEY_INFO_free(p8); - } else + } else { bag = PKCS12_SAFEBAG_create0_p8inf(p8); + if (bag != NULL) + p8 = NULL; /* bag takes ownership of p8 */ + } + /* This does not need to be in the error path */ + if (p8 != NULL) + PKCS8_PRIV_KEY_INFO_free(p8); - if (!bag) - goto err; - - if (!pkcs12_add_bag(pbags, bag)) + if (bag == NULL || !pkcs12_add_bag(pbags, bag)) goto err; return bag; diff --git a/openssl/crypto/pkcs7/pk7_doit.c b/openssl/crypto/pkcs7/pk7_doit.c index c753a0880..215501418 100644 --- a/openssl/crypto/pkcs7/pk7_doit.c +++ b/openssl/crypto/pkcs7/pk7_doit.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -1234,36 +1234,29 @@ static int add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype, void *value) { X509_ATTRIBUTE *attr = NULL; + int i, n; if (*sk == NULL) { if ((*sk = sk_X509_ATTRIBUTE_new_null()) == NULL) return 0; - new_attrib: - if ((attr = X509_ATTRIBUTE_create(nid, atrtype, value)) == NULL) - return 0; - if (!sk_X509_ATTRIBUTE_push(*sk, attr)) { - X509_ATTRIBUTE_free(attr); - return 0; - } - } else { - int i; - - for (i = 0; i < sk_X509_ATTRIBUTE_num(*sk); i++) { - attr = sk_X509_ATTRIBUTE_value(*sk, i); - if (OBJ_obj2nid(X509_ATTRIBUTE_get0_object(attr)) == nid) { - X509_ATTRIBUTE_free(attr); - attr = X509_ATTRIBUTE_create(nid, atrtype, value); - if (attr == NULL) - return 0; - if (!sk_X509_ATTRIBUTE_set(*sk, i, attr)) { - X509_ATTRIBUTE_free(attr); - return 0; - } - goto end; - } - } - goto new_attrib; } + n = sk_X509_ATTRIBUTE_num(*sk); + for (i = 0; i < n; i++) { + attr = sk_X509_ATTRIBUTE_value(*sk, i); + if (OBJ_obj2nid(X509_ATTRIBUTE_get0_object(attr)) == nid) + goto end; + } + if (!sk_X509_ATTRIBUTE_push(*sk, NULL)) + return 0; + end: + attr = X509_ATTRIBUTE_create(nid, atrtype, value); + if (attr == NULL) { + if (i == n) + sk_X509_ATTRIBUTE_pop(*sk); + return 0; + } + X509_ATTRIBUTE_free(sk_X509_ATTRIBUTE_value(*sk, i)); + (void) sk_X509_ATTRIBUTE_set(*sk, i, attr); return 1; } diff --git a/openssl/crypto/property/property.c b/openssl/crypto/property/property.c index c551c825b..55e990bdb 100644 --- a/openssl/crypto/property/property.c +++ b/openssl/crypto/property/property.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use @@ -96,6 +96,8 @@ typedef struct { DEFINE_SPARSE_ARRAY_OF(ALGORITHM); +DEFINE_STACK_OF(ALGORITHM) + typedef struct ossl_global_properties_st { OSSL_PROPERTY_LIST *list; #ifndef FIPS_MODULE @@ -461,33 +463,45 @@ static void alg_do_one(ALGORITHM *alg, IMPLEMENTATION *impl, fn(alg->nid, impl->method.method, fnarg); } -struct alg_do_each_data_st { - void (*fn)(int id, void *method, void *fnarg); - void *fnarg; -}; - -static void alg_do_each(ossl_uintmax_t idx, ALGORITHM *alg, void *arg) +static void alg_copy(ossl_uintmax_t idx, ALGORITHM *alg, void *arg) { - struct alg_do_each_data_st *data = arg; - int i, end = sk_IMPLEMENTATION_num(alg->impls); - - for (i = 0; i < end; i++) { - IMPLEMENTATION *impl = sk_IMPLEMENTATION_value(alg->impls, i); + STACK_OF(ALGORITHM) *newalg = arg; - alg_do_one(alg, impl, data->fn, data->fnarg); - } + (void)sk_ALGORITHM_push(newalg, alg); } void ossl_method_store_do_all(OSSL_METHOD_STORE *store, void (*fn)(int id, void *method, void *fnarg), void *fnarg) { - struct alg_do_each_data_st data; + int i, j; + int numalgs, numimps; + STACK_OF(ALGORITHM) *tmpalgs; + ALGORITHM *alg; - data.fn = fn; - data.fnarg = fnarg; - if (store != NULL) - ossl_sa_ALGORITHM_doall_arg(store->algs, alg_do_each, &data); + if (store != NULL) { + + if (!ossl_property_read_lock(store)) + return; + + tmpalgs = sk_ALGORITHM_new_reserve(NULL, + ossl_sa_ALGORITHM_num(store->algs)); + if (tmpalgs == NULL) { + ossl_property_unlock(store); + return; + } + + ossl_sa_ALGORITHM_doall_arg(store->algs, alg_copy, tmpalgs); + ossl_property_unlock(store); + numalgs = sk_ALGORITHM_num(tmpalgs); + for (i = 0; i < numalgs; i++) { + alg = sk_ALGORITHM_value(tmpalgs, i); + numimps = sk_IMPLEMENTATION_num(alg->impls); + for (j = 0; j < numimps; j++) + alg_do_one(alg, sk_IMPLEMENTATION_value(alg->impls, j), fn, fnarg); + } + sk_ALGORITHM_free(tmpalgs); + } } int ossl_method_store_fetch(OSSL_METHOD_STORE *store, @@ -643,10 +657,13 @@ static void impl_cache_flush_one_alg(ossl_uintmax_t idx, ALGORITHM *alg, void *v) { IMPL_CACHE_FLUSH *state = (IMPL_CACHE_FLUSH *)v; + unsigned long orig_down_load = lh_QUERY_get_down_load(alg->cache); state->cache = alg->cache; + lh_QUERY_set_down_load(alg->cache, 0); lh_QUERY_doall_IMPL_CACHE_FLUSH(state->cache, &impl_cache_flush_cache, state); + lh_QUERY_set_down_load(alg->cache, orig_down_load); } static void ossl_method_cache_flush_some(OSSL_METHOD_STORE *store) diff --git a/openssl/crypto/rand/randfile.c b/openssl/crypto/rand/randfile.c index 7fd2b73a0..76ce36819 100644 --- a/openssl/crypto/rand/randfile.c +++ b/openssl/crypto/rand/randfile.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -16,6 +16,7 @@ # include #endif +#include "internal/e_os.h" #include "internal/cryptlib.h" #include @@ -216,8 +217,16 @@ int RAND_write_file(const char *file) * should be restrictive from the start */ int fd = open(file, O_WRONLY | O_CREAT | O_BINARY, 0600); - if (fd != -1) + + if (fd != -1) { out = fdopen(fd, "wb"); + if (out == NULL) { + close(fd); + ERR_raise_data(ERR_LIB_RAND, RAND_R_CANNOT_OPEN_FILE, + "Filename=%s", file); + return -1; + } + } } #endif diff --git a/openssl/crypto/rsa/rsa_oaep.c b/openssl/crypto/rsa/rsa_oaep.c index b9030440c..4b5943b6b 100644 --- a/openssl/crypto/rsa/rsa_oaep.c +++ b/openssl/crypto/rsa/rsa_oaep.c @@ -1,5 +1,5 @@ /* - * Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1999-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -184,7 +184,7 @@ int RSA_padding_check_PKCS1_OAEP_mgf1(unsigned char *to, int tlen, mdlen = EVP_MD_get_size(md); - if (tlen <= 0 || flen <= 0) + if (tlen <= 0 || flen <= 0 || mdlen <= 0) return -1; /* * |num| is the length of the modulus; |flen| is the length of the diff --git a/openssl/crypto/sm3/sm3_local.h b/openssl/crypto/sm3/sm3_local.h index d2845f967..897418aee 100644 --- a/openssl/crypto/sm3/sm3_local.h +++ b/openssl/crypto/sm3/sm3_local.h @@ -1,5 +1,5 @@ /* - * Copyright 2017-2022 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2017-2024 The OpenSSL Project Authors. All Rights Reserved. * Copyright 2017 Ribose Inc. All Rights Reserved. * Ported from Ribose contributions from Botan. * @@ -39,7 +39,7 @@ # define HWSM3_CAPABLE (OPENSSL_armcap_P & ARMV8_SM3) void ossl_hwsm3_block_data_order(SM3_CTX *c, const void *p, size_t num); # endif -# if defined(__riscv) && __riscv_xlen == 64 +# if defined(OPENSSL_CPUID_OBJ) && defined(__riscv) && __riscv_xlen == 64 # include "crypto/riscv_arch.h" # define HWSM3_CAPABLE 1 void ossl_hwsm3_block_data_order(SM3_CTX *c, const void *p, size_t num); diff --git a/openssl/crypto/threads_none.c b/openssl/crypto/threads_none.c index c57c59bde..66ef99f49 100644 --- a/openssl/crypto/threads_none.c +++ b/openssl/crypto/threads_none.c @@ -23,7 +23,8 @@ struct rcu_lock_st { struct rcu_cb_item *cb_items; }; -CRYPTO_RCU_LOCK *ossl_rcu_lock_new(int num_writers) +CRYPTO_RCU_LOCK *ossl_rcu_lock_new(int num_writers, + ossl_unused OSSL_LIB_CTX *ctx) { struct rcu_lock_st *lock; diff --git a/openssl/crypto/threads_pthread.c b/openssl/crypto/threads_pthread.c index 870b91fb7..2d2f23117 100644 --- a/openssl/crypto/threads_pthread.c +++ b/openssl/crypto/threads_pthread.c @@ -244,8 +244,6 @@ static ossl_inline uint64_t fallback_atomic_or_fetch(uint64_t *p, uint64_t m) # define ATOMIC_OR_FETCH(p, v, o) fallback_atomic_or_fetch(p, v) # endif -static CRYPTO_THREAD_LOCAL rcu_thr_key; - /* * users is broken up into 2 parts * bits 0-15 current readers @@ -300,6 +298,9 @@ struct rcu_lock_st { /* Callbacks to call for next ossl_synchronize_rcu */ struct rcu_cb_item *cb_items; + /* The context we are being created against */ + OSSL_LIB_CTX *ctx; + /* rcu generation counter for in-order retirement */ uint32_t id_ctr; @@ -337,24 +338,6 @@ struct rcu_lock_st { pthread_cond_t prior_signal; }; -/* - * Called on thread exit to free the pthread key - * associated with this thread, if any - */ -static void free_rcu_thr_data(void *ptr) -{ - struct rcu_thr_data *data = - (struct rcu_thr_data *)CRYPTO_THREAD_get_local(&rcu_thr_key); - - OPENSSL_free(data); - CRYPTO_THREAD_set_local(&rcu_thr_key, NULL); -} - -static void ossl_rcu_init(void) -{ - CRYPTO_THREAD_init_local(&rcu_thr_key, NULL); -} - /* Read side acquisition of the current qp */ static struct rcu_qp *get_hold_current_qp(struct rcu_lock_st *lock) { @@ -403,22 +386,33 @@ static struct rcu_qp *get_hold_current_qp(struct rcu_lock_st *lock) return &lock->qp_group[qp_idx]; } +static void ossl_rcu_free_local_data(void *arg) +{ + OSSL_LIB_CTX *ctx = arg; + CRYPTO_THREAD_LOCAL *lkey = ossl_lib_ctx_get_rcukey(ctx); + struct rcu_thr_data *data = CRYPTO_THREAD_get_local(lkey); + + OPENSSL_free(data); + CRYPTO_THREAD_set_local(lkey, NULL); +} + void ossl_rcu_read_lock(CRYPTO_RCU_LOCK *lock) { struct rcu_thr_data *data; int i, available_qp = -1; + CRYPTO_THREAD_LOCAL *lkey = ossl_lib_ctx_get_rcukey(lock->ctx); /* * we're going to access current_qp here so ask the * processor to fetch it */ - data = CRYPTO_THREAD_get_local(&rcu_thr_key); + data = CRYPTO_THREAD_get_local(lkey); if (data == NULL) { data = OPENSSL_zalloc(sizeof(*data)); OPENSSL_assert(data != NULL); - CRYPTO_THREAD_set_local(&rcu_thr_key, data); - ossl_init_thread_start(NULL, NULL, free_rcu_thr_data); + CRYPTO_THREAD_set_local(lkey, data); + ossl_init_thread_start(NULL, lock->ctx, ossl_rcu_free_local_data); } for (i = 0; i < MAX_QPS; i++) { @@ -444,7 +438,8 @@ void ossl_rcu_read_lock(CRYPTO_RCU_LOCK *lock) void ossl_rcu_read_unlock(CRYPTO_RCU_LOCK *lock) { int i; - struct rcu_thr_data *data = CRYPTO_THREAD_get_local(&rcu_thr_key); + CRYPTO_THREAD_LOCAL *lkey = ossl_lib_ctx_get_rcukey(lock->ctx); + struct rcu_thr_data *data = CRYPTO_THREAD_get_local(lkey); uint64_t ret; assert(data != NULL); @@ -637,22 +632,22 @@ void ossl_rcu_assign_uptr(void **p, void **v) ATOMIC_STORE(pvoid, p, v, __ATOMIC_RELEASE); } -static CRYPTO_ONCE rcu_init_once = CRYPTO_ONCE_STATIC_INIT; - -CRYPTO_RCU_LOCK *ossl_rcu_lock_new(int num_writers) +CRYPTO_RCU_LOCK *ossl_rcu_lock_new(int num_writers, OSSL_LIB_CTX *ctx) { struct rcu_lock_st *new; - if (!CRYPTO_THREAD_run_once(&rcu_init_once, ossl_rcu_init)) - return NULL; - if (num_writers < 1) num_writers = 1; + ctx = ossl_lib_ctx_get_concrete(ctx); + if (ctx == NULL) + return 0; + new = OPENSSL_zalloc(sizeof(*new)); if (new == NULL) return NULL; + new->ctx = ctx; pthread_mutex_init(&new->write_lock, NULL); pthread_mutex_init(&new->prior_lock, NULL); pthread_mutex_init(&new->alloc_lock, NULL); diff --git a/openssl/crypto/threads_win.c b/openssl/crypto/threads_win.c index 64354dc42..bc430ef1b 100644 --- a/openssl/crypto/threads_win.c +++ b/openssl/crypto/threads_win.c @@ -43,8 +43,6 @@ typedef struct { } CRYPTO_win_rwlock; # endif -static CRYPTO_THREAD_LOCAL rcu_thr_key; - # define READER_SHIFT 0 # define ID_SHIFT 32 # define READER_SIZE 32 @@ -92,6 +90,7 @@ struct rcu_thr_data { */ struct rcu_lock_st { struct rcu_cb_item *cb_items; + OSSL_LIB_CTX *ctx; uint32_t id_ctr; struct rcu_qp *qp_group; size_t group_count; @@ -106,26 +105,6 @@ struct rcu_lock_st { CRYPTO_CONDVAR *prior_signal; }; -/* - * Called on thread exit to free the pthread key - * associated with this thread, if any - */ -static void free_rcu_thr_data(void *ptr) -{ - struct rcu_thr_data *data = - (struct rcu_thr_data *)CRYPTO_THREAD_get_local(&rcu_thr_key); - - OPENSSL_free(data); - CRYPTO_THREAD_set_local(&rcu_thr_key, NULL); -} - - -static void ossl_rcu_init(void) -{ - CRYPTO_THREAD_init_local(&rcu_thr_key, NULL); - ossl_init_thread_start(NULL, NULL, free_rcu_thr_data); -} - static struct rcu_qp *allocate_new_qp_group(struct rcu_lock_st *lock, int count) { @@ -136,23 +115,23 @@ static struct rcu_qp *allocate_new_qp_group(struct rcu_lock_st *lock, return new; } -static CRYPTO_ONCE rcu_init_once = CRYPTO_ONCE_STATIC_INIT; - -CRYPTO_RCU_LOCK *ossl_rcu_lock_new(int num_writers) +CRYPTO_RCU_LOCK *ossl_rcu_lock_new(int num_writers, OSSL_LIB_CTX *ctx) { struct rcu_lock_st *new; - if (!CRYPTO_THREAD_run_once(&rcu_init_once, ossl_rcu_init)) - return NULL; - if (num_writers < 1) num_writers = 1; + ctx = ossl_lib_ctx_get_concrete(ctx); + if (ctx == NULL) + return 0; + new = OPENSSL_zalloc(sizeof(*new)); if (new == NULL) return NULL; + new->ctx = ctx; new->write_lock = ossl_crypto_mutex_new(); new->alloc_signal = ossl_crypto_condvar_new(); new->prior_signal = ossl_crypto_condvar_new(); @@ -205,22 +184,33 @@ static ossl_inline struct rcu_qp *get_hold_current_qp(CRYPTO_RCU_LOCK *lock) return &lock->qp_group[qp_idx]; } +static void ossl_rcu_free_local_data(void *arg) +{ + OSSL_LIB_CTX *ctx = arg; + CRYPTO_THREAD_LOCAL *lkey = ossl_lib_ctx_get_rcukey(ctx); + struct rcu_thr_data *data = CRYPTO_THREAD_get_local(lkey); + OPENSSL_free(data); + CRYPTO_THREAD_set_local(lkey, NULL); +} + void ossl_rcu_read_lock(CRYPTO_RCU_LOCK *lock) { struct rcu_thr_data *data; int i; int available_qp = -1; + CRYPTO_THREAD_LOCAL *lkey = ossl_lib_ctx_get_rcukey(lock->ctx); /* * we're going to access current_qp here so ask the * processor to fetch it */ - data = CRYPTO_THREAD_get_local(&rcu_thr_key); + data = CRYPTO_THREAD_get_local(lkey); if (data == NULL) { data = OPENSSL_zalloc(sizeof(*data)); OPENSSL_assert(data != NULL); - CRYPTO_THREAD_set_local(&rcu_thr_key, data); + CRYPTO_THREAD_set_local(lkey, data); + ossl_init_thread_start(NULL, lock->ctx, ossl_rcu_free_local_data); } for (i = 0; i < MAX_QPS; i++) { @@ -253,7 +243,8 @@ void ossl_rcu_write_unlock(CRYPTO_RCU_LOCK *lock) void ossl_rcu_read_unlock(CRYPTO_RCU_LOCK *lock) { - struct rcu_thr_data *data = CRYPTO_THREAD_get_local(&rcu_thr_key); + CRYPTO_THREAD_LOCAL *lkey = ossl_lib_ctx_get_rcukey(lock->ctx); + struct rcu_thr_data *data = CRYPTO_THREAD_get_local(lkey); int i; LONG64 ret; diff --git a/openssl/crypto/x509/v3_utl.c b/openssl/crypto/x509/v3_utl.c index 1a1817499..1fa25ad3a 100644 --- a/openssl/crypto/x509/v3_utl.c +++ b/openssl/crypto/x509/v3_utl.c @@ -1,5 +1,5 @@ /* - * Copyright 1999-2022 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1999-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -916,36 +916,64 @@ static int do_x509_check(X509 *x, const char *chk, size_t chklen, ASN1_STRING *cstr; gen = sk_GENERAL_NAME_value(gens, i); - if ((gen->type == GEN_OTHERNAME) && (check_type == GEN_EMAIL)) { - if (OBJ_obj2nid(gen->d.otherName->type_id) == - NID_id_on_SmtpUTF8Mailbox) { - san_present = 1; - - /* - * If it is not a UTF8String then that is unexpected and we - * treat it as no match - */ - if (gen->d.otherName->value->type == V_ASN1_UTF8STRING) { - cstr = gen->d.otherName->value->value.utf8string; - - /* Positive on success, negative on error! */ - if ((rv = do_check_string(cstr, 0, equal, flags, - chk, chklen, peername)) != 0) - break; - } - } else + switch (gen->type) { + default: + continue; + case GEN_OTHERNAME: + switch (OBJ_obj2nid(gen->d.otherName->type_id)) { + default: continue; - } else { - if ((gen->type != check_type) && (gen->type != GEN_OTHERNAME)) + case NID_id_on_SmtpUTF8Mailbox: + /*- + * https://datatracker.ietf.org/doc/html/rfc8398#section-3 + * + * Due to name constraint compatibility reasons described + * in Section 6, SmtpUTF8Mailbox subjectAltName MUST NOT + * be used unless the local-part of the email address + * contains non-ASCII characters. When the local-part is + * ASCII, rfc822Name subjectAltName MUST be used instead + * of SmtpUTF8Mailbox. This is compatible with legacy + * software that supports only rfc822Name (and not + * SmtpUTF8Mailbox). [...] + * + * SmtpUTF8Mailbox is encoded as UTF8String. + * + * If it is not a UTF8String then that is unexpected, and + * we ignore the invalid SAN (neither set san_present nor + * consider it a candidate for equality). This does mean + * that the subject CN may be considered, as would be the + * case when the malformed SmtpUtf8Mailbox SAN is instead + * simply absent. + * + * When CN-ID matching is not desirable, applications can + * choose to turn it off, doing so is at this time a best + * practice. + */ + if (check_type != GEN_EMAIL + || gen->d.otherName->value->type != V_ASN1_UTF8STRING) + continue; + alt_type = 0; + cstr = gen->d.otherName->value->value.utf8string; + break; + } + break; + case GEN_EMAIL: + if (check_type != GEN_EMAIL) continue; - } - san_present = 1; - if (check_type == GEN_EMAIL) cstr = gen->d.rfc822Name; - else if (check_type == GEN_DNS) + break; + case GEN_DNS: + if (check_type != GEN_DNS) + continue; cstr = gen->d.dNSName; - else + break; + case GEN_IPADD: + if (check_type != GEN_IPADD) + continue; cstr = gen->d.iPAddress; + break; + } + san_present = 1; /* Positive on success, negative on error! */ if ((rv = do_check_string(cstr, alt_type, equal, flags, chk, chklen, peername)) != 0) diff --git a/openssl/crypto/x509/x_name.c b/openssl/crypto/x509/x_name.c index 4568833f8..bcb480f58 100644 --- a/openssl/crypto/x509/x_name.c +++ b/openssl/crypto/x509/x_name.c @@ -1,5 +1,5 @@ /* - * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -480,8 +480,8 @@ static int i2d_name_canon(const STACK_OF(STACK_OF_X509_NAME_ENTRY) * _intname, v = sk_ASN1_VALUE_value(intname, i); ltmp = ASN1_item_ex_i2d(&v, in, ASN1_ITEM_rptr(X509_NAME_ENTRIES), -1, -1); - if (ltmp < 0) - return ltmp; + if (ltmp < 0 || len > INT_MAX - ltmp) + return -1; len += ltmp; } return len; diff --git a/openssl/doc/HOWTO/certificates.txt b/openssl/doc/HOWTO/certificates.txt index 78ab97b41..82ce502a1 100644 --- a/openssl/doc/HOWTO/certificates.txt +++ b/openssl/doc/HOWTO/certificates.txt @@ -89,7 +89,7 @@ was kind enough, your certificate is a raw DER thing in PEM format. Your key most definitely is if you have followed the examples above. However, some (most?) certificate authorities will encode them with things like PKCS7 or PKCS12, or something else. Depending on your -applications, this may be perfectly OK, it all depends on what they +applications, this may be perfectly OK. It all depends on what they know how to decode. If not, there are a number of OpenSSL tools to convert between some (most?) formats. diff --git a/openssl/doc/fingerprints.txt b/openssl/doc/fingerprints.txt index 9613cbac9..bdcad1472 100644 --- a/openssl/doc/fingerprints.txt +++ b/openssl/doc/fingerprints.txt @@ -12,9 +12,6 @@ in the file named openssl-1.0.1h.tar.gz.asc. The following is the list of fingerprints for the keys that are currently in use to sign OpenSSL distributions: -OpenSSL OMC: -EFC0 A467 D613 CB83 C7ED 6D30 D894 E2CE 8B3D 79F5 - OpenSSL: BA54 73A2 B058 7B07 FB27 CF2D 2160 94DF D0CB 81EF diff --git a/openssl/doc/internal/man3/ossl_rcu_lock_new.pod b/openssl/doc/internal/man3/ossl_rcu_lock_new.pod index 7b82f6bbd..57b5e4d73 100644 --- a/openssl/doc/internal/man3/ossl_rcu_lock_new.pod +++ b/openssl/doc/internal/man3/ossl_rcu_lock_new.pod @@ -13,7 +13,7 @@ ossl_rcu_assign_uptr =head1 SYNOPSIS - CRYPTO_RCU_LOCK *ossl_rcu_lock_new(int num_writers); + CRYPTO_RCU_LOCK *ossl_rcu_lock_new(int num_writers, OSSL_LIB_CTX *ctx); void ossl_rcu_read_lock(CRYPTO_RCU_LOCK *lock); void ossl_rcu_write_lock(CRYPTO_RCU_LOCK *lock); void ossl_rcu_write_unlock(CRYPTO_RCU_LOCK *lock); @@ -65,7 +65,8 @@ ossl_rcu_lock_new() allocates a new RCU lock. The I param indicates the number of write side threads which may execute ossl_synchronize_rcu() in parallel. The value must be at least 1, but may be larger to obtain increased write side throughput at the cost of additional -internal memory usage. A value of 1 is generally recommended. +internal memory usage. A value of 1 is generally recommended. The I +parameter references the library context in which the lock is allocated. =item * diff --git a/openssl/doc/man1/openssl-ca.pod.in b/openssl/doc/man1/openssl-ca.pod.in index fe09f85c2..107d958c9 100644 --- a/openssl/doc/man1/openssl-ca.pod.in +++ b/openssl/doc/man1/openssl-ca.pod.in @@ -177,7 +177,8 @@ See L for details. =item B<-sigopt> I:I Pass options to the signature algorithm during sign operations. -Names and values of these options are algorithm-specific. +Names and values of these options are algorithm-specific and +documented in L. =item B<-vfyopt> I:I @@ -852,7 +853,7 @@ L =head1 COPYRIGHT -Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man1/openssl-cmp.pod.in b/openssl/doc/man1/openssl-cmp.pod.in index f9f33db56..4f7840270 100644 --- a/openssl/doc/man1/openssl-cmp.pod.in +++ b/openssl/doc/man1/openssl-cmp.pod.in @@ -414,6 +414,12 @@ The file where any newly enrolled certificate should be saved. =item B<-chainout> I The file where the chain of any newly enrolled certificate should be saved. +This chain excludes the leaf certificate, i.e., the newly enrolled certificate. +Also the trust anchor (the root certificate) is not included. + +If the B<-certout> option is given, too, with equal I argument, +then the file produced contains both outputs concatenated: +the newly enrolled certificate followed by its chain. =back diff --git a/openssl/doc/man1/openssl-dgst.pod.in b/openssl/doc/man1/openssl-dgst.pod.in index 5dcdbe548..e50fa55d7 100644 --- a/openssl/doc/man1/openssl-dgst.pod.in +++ b/openssl/doc/man1/openssl-dgst.pod.in @@ -126,7 +126,8 @@ See L for details. =item B<-sigopt> I:I Pass options to the signature algorithm during sign or verify operations. -Names and values of these options are algorithm-specific. +Names and values of these options are algorithm-specific and documented +in L. =item B<-passin> I @@ -278,7 +279,7 @@ The B<-engine> and B<-engine_impl> options were deprecated in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man1/openssl-enc.pod.in b/openssl/doc/man1/openssl-enc.pod.in index 14066a318..33fe72d28 100644 --- a/openssl/doc/man1/openssl-enc.pod.in +++ b/openssl/doc/man1/openssl-enc.pod.in @@ -98,13 +98,19 @@ Base64 process the data. This means that if encryption is taking place the data is base64 encoded after encryption. If decryption is set then the input data is base64 decoded before being decrypted. +When the B<-A> option not given, +on encoding a newline is inserted after each 64 characters, and +on decoding a newline is expected among the first 1024 bytes of input. + =item B<-base64> Same as B<-a> =item B<-A> -If the B<-a> option is set then base64 process the data on one line. +If the B<-a> option is set then base64 encoding produces output without any +newline character, and base64 decoding does not require any newlines. +Therefore it can be helpful to use the B<-A> option when decoding unknown input. =item B<-k> I @@ -463,6 +469,9 @@ or =head1 BUGS The B<-A> option when used with large files doesn't work properly. +On the other hand, when base64 decoding without the B<-A> option, +if the first 1024 bytes of input do not include a newline character +the first two lines of input are ignored. The B command only supports a fixed number of algorithms with certain parameters. So if, for example, you want to use RC2 with a @@ -480,7 +489,7 @@ The B<-saltlen> option was added in OpenSSL 3.2. =head1 COPYRIGHT -Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man1/openssl-passphrase-options.pod b/openssl/doc/man1/openssl-passphrase-options.pod index abc43fb41..2260dce8a 100644 --- a/openssl/doc/man1/openssl-passphrase-options.pod +++ b/openssl/doc/man1/openssl-passphrase-options.pod @@ -46,26 +46,32 @@ the environment of other processes is visible on certain platforms =item BI -The first line of I is the password. If the same I -argument is supplied to B<-passin> and B<-passout> arguments then the first -line will be used for the input password and the next line for the output -password. I need not refer to a regular file: it could for example -refer to a device or named pipe. +Reads the password from the specified file I, which can be a regular +file, device, or named pipe. Only the first line, up to the newline character, +is read from the stream. + +If the same I argument is supplied to both B<-passin> and B<-passout> +arguments, the first line will be used for the input password, and the next +line will be used for the output password. =item BI -Read the password from the file descriptor I. This can be used to -send the data via a pipe for example. +Reads the password from the file descriptor I. This can be useful for +sending data via a pipe, for example. The same line handling as described for +B applies to passwords read from file descriptors. + +B is not supported on Windows. =item B -Read the password from standard input. +Reads the password from standard input. The same line handling as described for +B applies to passwords read from standard input. =back =head1 COPYRIGHT -Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man1/openssl-s_client.pod.in b/openssl/doc/man1/openssl-s_client.pod.in index 032edb2a3..4b93dda5f 100644 --- a/openssl/doc/man1/openssl-s_client.pod.in +++ b/openssl/doc/man1/openssl-s_client.pod.in @@ -656,7 +656,11 @@ For example strings, see L =item B<-curves> I Specifies the list of supported curves to be sent by the client. The curve is -ultimately selected by the server. For a list of all curves, use: +ultimately selected by the server. + +The list of all supported groups includes named EC parameters as well as X25519 +and X448 or FFDHE groups, and may also include groups implemented in 3rd-party +providers. For a list of named EC parameters, use: $ openssl ecparam -list_curves @@ -1044,7 +1048,7 @@ options were added in OpenSSL 3.2. =head1 COPYRIGHT -Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man1/openssl-s_server.pod.in b/openssl/doc/man1/openssl-s_server.pod.in index 3049426f8..80f8c3299 100644 --- a/openssl/doc/man1/openssl-s_server.pod.in +++ b/openssl/doc/man1/openssl-s_server.pod.in @@ -671,7 +671,10 @@ Signature algorithms to support for client certificate authentication =item B<-named_curve> I Specifies the elliptic curve to use. NOTE: this is single curve, not a list. -For a list of all possible curves, use: + +The list of all supported groups includes named EC parameters as well as X25519 +and X448 or FFDHE groups, and may also include groups implemented in 3rd-party +providers. For a list of named EC parameters, use: $ openssl ecparam -list_curves diff --git a/openssl/doc/man1/openssl-verification-options.pod b/openssl/doc/man1/openssl-verification-options.pod index 05bb560d8..38ae58d83 100644 --- a/openssl/doc/man1/openssl-verification-options.pod +++ b/openssl/doc/man1/openssl-verification-options.pod @@ -430,7 +430,7 @@ This option may be used multiple times. =item B<-policy> I Enable policy processing and add I to the user-initial-policy-set (see -RFC5280). The policy I can be an object name an OID in numeric form. +RFC5280). The policy I can be an object name or an OID in numeric form. This argument can appear more than once. =item B<-explicit_policy> @@ -686,7 +686,7 @@ The checks enabled by B<-x509_strict> have been extended in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/ASN1_INTEGER_new.pod b/openssl/doc/man3/ASN1_INTEGER_new.pod index 4722f880c..869ac754f 100644 --- a/openssl/doc/man3/ASN1_INTEGER_new.pod +++ b/openssl/doc/man3/ASN1_INTEGER_new.pod @@ -18,6 +18,7 @@ ASN1_INTEGER_new, ASN1_INTEGER_free - ASN1_INTEGER allocation functions ASN1_INTEGER_new() returns an allocated B structure. ASN1_INTEGER_free() frees up a single B object. +If the argument is NULL, nothing is done. B structure representing the ASN.1 INTEGER type @@ -34,7 +35,7 @@ L =head1 COPYRIGHT -Copyright 2020 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/ASYNC_WAIT_CTX_new.pod b/openssl/doc/man3/ASYNC_WAIT_CTX_new.pod index 7621a8b3a..d85c51e55 100644 --- a/openssl/doc/man3/ASYNC_WAIT_CTX_new.pod +++ b/openssl/doc/man3/ASYNC_WAIT_CTX_new.pod @@ -178,6 +178,9 @@ operation, normally it is detected by a polling function or an interrupt, as the user code set a callback by calling ASYNC_WAIT_CTX_set_callback() previously, then the registered callback will be called. +ASYNC_WAIT_CTX_free() frees up a single B object. +If the argument is NULL, nothing is done. + =head1 RETURN VALUES ASYNC_WAIT_CTX_new() returns a pointer to the newly allocated B @@ -216,7 +219,7 @@ were added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/BIO_ADDR.pod b/openssl/doc/man3/BIO_ADDR.pod index eb5a4a8fe..9dd2065ac 100644 --- a/openssl/doc/man3/BIO_ADDR.pod +++ b/openssl/doc/man3/BIO_ADDR.pod @@ -18,7 +18,7 @@ BIO_ADDR_path_string - BIO_ADDR routines BIO_ADDR *BIO_ADDR_new(void); int BIO_ADDR_copy(BIO_ADDR *dst, const BIO_ADDR *src); BIO_ADDR *BIO_ADDR_dup(const BIO_ADDR *ap); - void BIO_ADDR_free(BIO_ADDR *); + void BIO_ADDR_free(BIO_ADDR *ap); void BIO_ADDR_clear(BIO_ADDR *ap); int BIO_ADDR_rawmake(BIO_ADDR *ap, int family, const void *where, size_t wherelen, unsigned short port); @@ -47,7 +47,7 @@ BIO_ADDR_dup() creates a new B, with a copy of the address data in B. BIO_ADDR_free() frees a B created with BIO_ADDR_new() -or BIO_ADDR_dup(); +or BIO_ADDR_dup(). If the argument is NULL, nothing is done. BIO_ADDR_clear() clears any data held within the provided B and sets it back to an uninitialised state. @@ -131,7 +131,7 @@ BIO_ADDR_copy() and BIO_ADDR_dup() were added in OpenSSL 3.2. =head1 COPYRIGHT -Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/BIO_ADDRINFO.pod b/openssl/doc/man3/BIO_ADDRINFO.pod index 626052e7f..71a14ff4f 100644 --- a/openssl/doc/man3/BIO_ADDRINFO.pod +++ b/openssl/doc/man3/BIO_ADDRINFO.pod @@ -78,7 +78,7 @@ BIO_ADDRINFO_next() returns the next B in the chain from the given one. BIO_ADDRINFO_free() frees the chain of B starting -with the given one. +with the given one. If the argument is NULL, nothing is done. =head1 RETURN VALUES @@ -103,7 +103,7 @@ The BIO_lookup_ex() function was added in OpenSSL 1.1.1. =head1 COPYRIGHT -Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/BIO_f_base64.pod b/openssl/doc/man3/BIO_f_base64.pod index c865f0a17..c951d4926 100644 --- a/openssl/doc/man3/BIO_f_base64.pod +++ b/openssl/doc/man3/BIO_f_base64.pod @@ -21,25 +21,23 @@ any data read through it. Base64 BIOs do not support BIO_gets() or BIO_puts(). -For writing, output is by default divided to lines of length 64 -characters and there is always a newline at the end of output. +For writing, by default output is divided to lines of length 64 +characters and there is a newline at the end of output. +This behavior can be changed with B flag. -For reading, first line should be at most 1024 -characters long. If it is longer then it is ignored completely. -Other input lines can be of any length. There must be a newline -at the end of input. - -This behavior can be changed with BIO_FLAGS_BASE64_NO_NL flag. +For reading, first line should be at most 1024 bytes long including newline +unless the flag B is set. +Further input lines can be of any length (i.e., newlines may appear anywhere +in the input) and a newline at the end of input is not needed. BIO_flush() on a base64 BIO that is being written through is used to signal that no more data is to be encoded: this is used to flush the final block through the BIO. -The flag BIO_FLAGS_BASE64_NO_NL can be set with BIO_set_flags(). +The flag B can be set with BIO_set_flags(). For writing, it causes all data to be written on one line without newline at the end. -For reading, it expects the data to be all on one line (with or -without a trailing newline). +For reading, it removes all expectations on newlines in the input data. =head1 NOTES @@ -85,6 +83,10 @@ data to standard output: =head1 BUGS +On decoding, if the flag B is not set and +the first 1024 bytes of input do not include a newline character +the first two lines of input are ignored. + The ambiguity of EOF in base64 encoded data can cause additional data following the base64 encoded block to be misinterpreted. @@ -93,7 +95,7 @@ to reliably determine EOF (for example a MIME boundary). =head1 COPYRIGHT -Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/BIO_meth_new.pod b/openssl/doc/man3/BIO_meth_new.pod index 41e36f7c7..b532190e5 100644 --- a/openssl/doc/man3/BIO_meth_new.pod +++ b/openssl/doc/man3/BIO_meth_new.pod @@ -100,7 +100,7 @@ additionally have the "descriptor" bit set (B). See the L page for more information. BIO_meth_free() destroys a B structure and frees up any memory -associated with it. +associated with it. If the argument is NULL, nothing is done. BIO_meth_get_write_ex() and BIO_meth_set_write_ex() get and set the function used for writing arbitrary length data to the BIO respectively. This function diff --git a/openssl/doc/man3/BN_add.pod b/openssl/doc/man3/BN_add.pod index 35cfdd149..46966d996 100644 --- a/openssl/doc/man3/BN_add.pod +++ b/openssl/doc/man3/BN_add.pod @@ -14,9 +14,9 @@ arithmetic operations on BIGNUMs int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); - int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); + int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); - int BN_sqr(BIGNUM *r, BIGNUM *a, BN_CTX *ctx); + int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx); int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *a, const BIGNUM *d, BN_CTX *ctx); @@ -25,25 +25,25 @@ arithmetic operations on BIGNUMs int BN_nnmod(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); - int BN_mod_add(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m, + int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx); - int BN_mod_sub(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m, + int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx); - int BN_mod_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m, + int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx); - int BN_mod_sqr(BIGNUM *r, BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); + int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); - BIGNUM *BN_mod_sqrt(BIGNUM *in, BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); + BIGNUM *BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); - int BN_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BN_CTX *ctx); + int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx); - int BN_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p, + int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx); - int BN_gcd(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); + int BN_gcd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); =head1 DESCRIPTION @@ -135,7 +135,7 @@ L, L =head1 COPYRIGHT -Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/BN_generate_prime.pod b/openssl/doc/man3/BN_generate_prime.pod index b536bcb3b..accc8a749 100644 --- a/openssl/doc/man3/BN_generate_prime.pod +++ b/openssl/doc/man3/BN_generate_prime.pod @@ -167,7 +167,8 @@ programs should prefer the "new" style, whilst the "old" style is provided for backwards compatibility purposes. A B structure should be created through a call to BN_GENCB_new(), -and freed through a call to BN_GENCB_free(). +and freed through a call to BN_GENCB_free(). If the argument is NULL, +nothing is done. For "new" style callbacks a BN_GENCB structure should be initialised with a call to BN_GENCB_set(), where B is a B, B is of @@ -245,7 +246,7 @@ BN_check_prime() was added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/BN_set_bit.pod b/openssl/doc/man3/BN_set_bit.pod index 349ef9e05..ddc27d0c4 100644 --- a/openssl/doc/man3/BN_set_bit.pod +++ b/openssl/doc/man3/BN_set_bit.pod @@ -33,8 +33,11 @@ error occurs if B is shorter than B bits. BN_is_bit_set() tests if bit B in B is set. BN_mask_bits() truncates B to an B bit number -(CEn)>). An error occurs if B already is -shorter than B bits. +(CEn)>). An error occurs if B is negative. An error is +also returned if the internal representation of B is already shorter than +B bits. The internal representation depends on the platform's word size, and +this error can be safely ignored. Use L to determine the exact +number of bits if needed. BN_lshift() shifts B left by B bits and places the result in B (C). Note that B must be nonnegative. BN_lshift1() shifts @@ -59,7 +62,7 @@ L, L =head1 COPYRIGHT -Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/BUF_MEM_new.pod b/openssl/doc/man3/BUF_MEM_new.pod index 262e18f31..79de43a1d 100644 --- a/openssl/doc/man3/BUF_MEM_new.pod +++ b/openssl/doc/man3/BUF_MEM_new.pod @@ -34,6 +34,7 @@ should be allocated on the secure heap; see L. BUF_MEM_free() frees up an already existing buffer. The data is zeroed before freeing up in case the buffer contains sensitive data. +If the argument is NULL, nothing is done. BUF_MEM_grow() changes the size of an already existing buffer to B. Any data already in the buffer is preserved if it increases in @@ -65,7 +66,7 @@ The BUF_MEM_new_ex() function was added in OpenSSL 1.1.0. =head1 COPYRIGHT -Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/COMP_CTX_new.pod b/openssl/doc/man3/COMP_CTX_new.pod index 997f1187f..ce4717d73 100644 --- a/openssl/doc/man3/COMP_CTX_new.pod +++ b/openssl/doc/man3/COMP_CTX_new.pod @@ -54,7 +54,9 @@ These functions provide compression support for OpenSSL. Compression is used wit the OpenSSL library to support TLS record and certificate compression. COMP_CTX_new() is used to create a new B structure used to compress data. + COMP_CTX_free() is used to free the returned B. +If the argument is NULL, nothing is done. COMP_CTX_get_method() returns the B of the given I. @@ -172,7 +174,7 @@ Brotli and Zstandard functions were added in OpenSSL 3.2. =head1 COPYRIGHT -Copyright 2022 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2022-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/CRYPTO_THREAD_run_once.pod b/openssl/doc/man3/CRYPTO_THREAD_run_once.pod index 470b741c1..4db4bc785 100644 --- a/openssl/doc/man3/CRYPTO_THREAD_run_once.pod +++ b/openssl/doc/man3/CRYPTO_THREAD_run_once.pod @@ -81,6 +81,7 @@ CRYPTO_THREAD_unlock() unlocks the previously locked I. =item * CRYPTO_THREAD_lock_free() frees the provided I. +If the argument is NULL, nothing is done. =item * @@ -213,10 +214,13 @@ This example safely initializes and uses a lock. { int ret = 0; - if (mylock()) { - /* Your code here, do not return without releasing the lock! */ - ret = ... ; + if (!mylock()) { + /* Do not unlock unless the lock was successfully acquired. */ + return 0; } + + /* Your code here, do not return without releasing the lock! */ + ret = ... ; myunlock(); return ret; } @@ -233,7 +237,7 @@ L, L. =head1 COPYRIGHT -Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/CTLOG_STORE_new.pod b/openssl/doc/man3/CTLOG_STORE_new.pod index 801b1447e..361eda57b 100644 --- a/openssl/doc/man3/CTLOG_STORE_new.pod +++ b/openssl/doc/man3/CTLOG_STORE_new.pod @@ -52,7 +52,7 @@ The expected format of the file is: Once a CTLOG_STORE is no longer required, it should be passed to CTLOG_STORE_free(). This will delete all of the CTLOGs stored within, along -with the CTLOG_STORE itself. +with the CTLOG_STORE itself. If the argument is NULL, nothing is done. =head1 NOTES @@ -78,7 +78,7 @@ added in OpenSSL 1.1.0. =head1 COPYRIGHT -Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/CTLOG_new.pod b/openssl/doc/man3/CTLOG_new.pod index 30b806824..7a78a6c58 100644 --- a/openssl/doc/man3/CTLOG_new.pod +++ b/openssl/doc/man3/CTLOG_new.pod @@ -50,7 +50,7 @@ property query string are used. Regardless of whether CTLOG_new() or CTLOG_new_from_base64() is used, it is the caller's responsibility to pass the CTLOG to CTLOG_free() once it is no longer needed. This will delete it and, if created by CTLOG_new(), the EVP_PKEY that -was passed to it. +was passed to it. If the argument to CTLOG_free() is NULL, nothing is done. CTLOG_get0_name() returns the name of the log, as provided when the CTLOG was created. Ownership of the string remains with the CTLOG. @@ -80,7 +80,7 @@ were added in OpenSSL 3.0. All other functions were added in OpenSSL 1.1.0. =head1 COPYRIGHT -Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/CT_POLICY_EVAL_CTX_new.pod b/openssl/doc/man3/CT_POLICY_EVAL_CTX_new.pod index bba6778d2..3b79980c4 100644 --- a/openssl/doc/man3/CT_POLICY_EVAL_CTX_new.pod +++ b/openssl/doc/man3/CT_POLICY_EVAL_CTX_new.pod @@ -105,7 +105,8 @@ The time should be in milliseconds since the Unix Epoch. Each setter has a matching getter for accessing the current value. When no longer required, the B should be passed to -CT_POLICY_EVAL_CTX_free() to delete it. +CT_POLICY_EVAL_CTX_free() to delete it. If the argument to +CT_POLICY_EVAL_CTX_free() is NULL, nothing is done. =head1 NOTES @@ -130,7 +131,7 @@ functions were added in OpenSSL 1.1.0. =head1 COPYRIGHT -Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/DH_meth_new.pod b/openssl/doc/man3/DH_meth_new.pod index 779a69516..d5ba5eac5 100644 --- a/openssl/doc/man3/DH_meth_new.pod +++ b/openssl/doc/man3/DH_meth_new.pod @@ -81,7 +81,7 @@ parameter. This might be useful for creating a new B based on an existing one, but with some differences. DH_meth_free() destroys a B structure and frees up any memory -associated with it. +associated with it. If the argument is NULL, nothing is done. DH_meth_get0_name() will return a pointer to the name of this DH_METHOD. This is a pointer to the internal name string and so should not be freed by the @@ -166,7 +166,7 @@ The functions described here were added in OpenSSL 1.1.0. =head1 COPYRIGHT -Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/DSA_SIG_new.pod b/openssl/doc/man3/DSA_SIG_new.pod index 1f532d300..158da2d7d 100644 --- a/openssl/doc/man3/DSA_SIG_new.pod +++ b/openssl/doc/man3/DSA_SIG_new.pod @@ -20,6 +20,7 @@ DSA_SIG_new() allocates an empty B structure. DSA_SIG_free() frees the B structure and its components. The values are erased before the memory is returned to the system. +If the argument is NULL, nothing is done. DSA_SIG_get0() returns internal pointers to the B and B values contained in B. @@ -48,7 +49,7 @@ L =head1 COPYRIGHT -Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/DSA_meth_new.pod b/openssl/doc/man3/DSA_meth_new.pod index f8f5a1f02..534561c61 100644 --- a/openssl/doc/man3/DSA_meth_new.pod +++ b/openssl/doc/man3/DSA_meth_new.pod @@ -110,7 +110,7 @@ parameter. This might be useful for creating a new B based on an existing one, but with some differences. DSA_meth_free() destroys a B structure and frees up any memory -associated with it. +associated with it. If the argument is NULL, nothing is done. DSA_meth_get0_name() will return a pointer to the name of this DSA_METHOD. This is a pointer to the internal name string and so should not be freed by the @@ -214,7 +214,7 @@ The functions described here were added in OpenSSL 1.1.0. =head1 COPYRIGHT -Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/ECDSA_SIG_new.pod b/openssl/doc/man3/ECDSA_SIG_new.pod index 3266c43b5..e56ec959e 100644 --- a/openssl/doc/man3/ECDSA_SIG_new.pod +++ b/openssl/doc/man3/ECDSA_SIG_new.pod @@ -31,6 +31,7 @@ ECDSA_SIG_new() allocates an empty B structure. Note: before OpenSSL 1.1.0, the I and I components were initialised. ECDSA_SIG_free() frees the B structure I. +If the argument is NULL, nothing is done. ECDSA_SIG_get0() returns internal pointers the I and I values contained in I and stores them in I<*pr> and I<*ps>, respectively. @@ -136,7 +137,7 @@ L =head1 COPYRIGHT -Copyright 2004-2022 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2004-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/ENGINE_add.pod b/openssl/doc/man3/ENGINE_add.pod index 55e5d76fc..24c83c576 100644 --- a/openssl/doc/man3/ENGINE_add.pod +++ b/openssl/doc/man3/ENGINE_add.pod @@ -227,7 +227,8 @@ references such as; ENGINE_by_id(), ENGINE_get_first(), ENGINE_get_last(), ENGINE_get_next(), ENGINE_get_prev(). All structural references should be released by a corresponding to call to the ENGINE_free() function - the ENGINE object itself will only actually be cleaned up and deallocated when -the last structural reference is released. +the last structural reference is released. If the argument to ENGINE_free() +is NULL, nothing is done. It should also be noted that many ENGINE API function calls that accept a structural reference will internally obtain another reference - typically @@ -665,7 +666,7 @@ and should not be used. =head1 COPYRIGHT -Copyright 2002-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2002-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/EVP_ASYM_CIPHER_free.pod b/openssl/doc/man3/EVP_ASYM_CIPHER_free.pod index c158ec1ae..162ad7ed7 100644 --- a/openssl/doc/man3/EVP_ASYM_CIPHER_free.pod +++ b/openssl/doc/man3/EVP_ASYM_CIPHER_free.pod @@ -45,7 +45,7 @@ The returned value must eventually be freed with EVP_ASYM_CIPHER_free(). EVP_ASYM_CIPHER_free() decrements the reference count for the B structure. Typically this structure will have been obtained from an earlier call to EVP_ASYM_CIPHER_fetch(). If the reference count drops to 0 then the -structure is freed. +structure is freed. If the argument is NULL, nothing is done. EVP_ASYM_CIPHER_up_ref() increments the reference count for an B structure. @@ -102,7 +102,7 @@ The functions described here were added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/EVP_CIPHER_meth_new.pod b/openssl/doc/man3/EVP_CIPHER_meth_new.pod index 35d4db2a6..8638cd300 100644 --- a/openssl/doc/man3/EVP_CIPHER_meth_new.pod +++ b/openssl/doc/man3/EVP_CIPHER_meth_new.pod @@ -80,6 +80,7 @@ EVP_CIPHER_meth_new() creates a new B structure. EVP_CIPHER_meth_dup() creates a copy of B. EVP_CIPHER_meth_free() destroys a B structure. +If the argument is NULL, nothing is done. EVP_CIPHER_meth_set_iv_length() sets the length of the IV. This is only needed when the implemented cipher mode requires it. @@ -249,7 +250,7 @@ counted in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/EVP_DigestInit.pod b/openssl/doc/man3/EVP_DigestInit.pod index d31f84557..70d0836ec 100644 --- a/openssl/doc/man3/EVP_DigestInit.pod +++ b/openssl/doc/man3/EVP_DigestInit.pod @@ -160,6 +160,7 @@ Increments the reference count for an B structure. Decrements the reference count for the fetched B structure. If the reference count drops to 0 then the structure is freed. +If the argument is NULL, nothing is done. =item EVP_MD_CTX_new() @@ -173,6 +174,7 @@ existing context. =item EVP_MD_CTX_free() Cleans up digest context I and frees up the space allocated to it. +If the argument is NULL, nothing is done. =item EVP_MD_CTX_ctrl() @@ -548,9 +550,13 @@ can be used the manipulate and test these B flags: This flag instructs the digest to optimize for one update only, if possible. -=for comment EVP_MD_CTX_FLAG_CLEANED is internal, don't mention it +=item EVP_MD_CTX_FLAG_CLEANED -=for comment EVP_MD_CTX_FLAG_REUSE is internal, don't mention it +This flag is for internal use only and I be used in user code. + +=item EVP_MD_CTX_FLAG_REUSE + +This flag is for internal use only and I be used in user code. =for comment We currently avoid documenting flags that are only bit holder: EVP_MD_CTX_FLAG_NON_FIPS_ALLOW, EVP_MD_CTX_FLAGS_PAD_* diff --git a/openssl/doc/man3/EVP_EncodeInit.pod b/openssl/doc/man3/EVP_EncodeInit.pod index 2b9e02e02..03c6f4e60 100644 --- a/openssl/doc/man3/EVP_EncodeInit.pod +++ b/openssl/doc/man3/EVP_EncodeInit.pod @@ -41,7 +41,7 @@ EVP_ENCODE_CTX_new() allocates, initializes and returns a context to be used for the encode/decode functions. EVP_ENCODE_CTX_free() cleans up an encode/decode context B and frees up the -space allocated to it. +space allocated to it. If the argument is NULL, nothing is done. Encoding of binary data is performed in blocks of 48 input bytes (or less for the final block). For each 48 byte input block encoded 64 bytes of base 64 data @@ -151,7 +151,7 @@ L =head1 COPYRIGHT -Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/EVP_EncryptInit.pod b/openssl/doc/man3/EVP_EncryptInit.pod index c6b001b1b..ccb40c6aa 100644 --- a/openssl/doc/man3/EVP_EncryptInit.pod +++ b/openssl/doc/man3/EVP_EncryptInit.pod @@ -272,6 +272,7 @@ Increments the reference count for an B structure. Decrements the reference count for the fetched B structure. If the reference count drops to 0 then the structure is freed. +If the argument is NULL, nothing is done. =item EVP_CIPHER_CTX_new() @@ -280,9 +281,9 @@ Allocates and returns a cipher context. =item EVP_CIPHER_CTX_free() Clears all information from a cipher context and frees any allocated memory -associated with it, including I itself. This function should be called after -all operations using a cipher are complete so sensitive information does not -remain in memory. +associated with it, including I itself. This function should be called +after all operations using a cipher are complete so sensitive information does +not remain in memory. If the argument is NULL, nothing is done. =item EVP_CIPHER_CTX_dup() @@ -374,9 +375,13 @@ exists. Encrypts I bytes from the buffer I and writes the encrypted version to I. The pointers I and I may point to the same location, in which -case the encryption will be done in-place. If I and I point to different -locations, the two buffers must be disjoint, otherwise the operation might fail -or the outcome might be undefined. +case the encryption will be done in-place. However, in-place encryption is +guaranteed to work only if the encryption context (I) has processed data in +multiples of the block size. If the context contains an incomplete data block +from previous operations, in-place encryption will fail. + +If I and I point to different locations, the two buffers must be +disjoint, otherwise the operation might fail or the outcome might be undefined. This function can be called multiple times to encrypt successive blocks of data. The amount of data written depends on the block alignment of the diff --git a/openssl/doc/man3/EVP_KEM_free.pod b/openssl/doc/man3/EVP_KEM_free.pod index 575abc5f5..b0ef60475 100644 --- a/openssl/doc/man3/EVP_KEM_free.pod +++ b/openssl/doc/man3/EVP_KEM_free.pod @@ -41,6 +41,7 @@ The returned value must eventually be freed with EVP_KEM_free(). EVP_KEM_free() decrements the reference count for the B structure. Typically this structure will have been obtained from an earlier call to EVP_KEM_fetch(). If the reference count drops to 0 then the structure is freed. +If the argument is NULL, nothing is done. EVP_KEM_up_ref() increments the reference count for an B structure. @@ -95,7 +96,7 @@ The functions described here were added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/EVP_KEYEXCH_free.pod b/openssl/doc/man3/EVP_KEYEXCH_free.pod index 272855ccb..e08f44e60 100644 --- a/openssl/doc/man3/EVP_KEYEXCH_free.pod +++ b/openssl/doc/man3/EVP_KEYEXCH_free.pod @@ -41,7 +41,7 @@ The returned value must eventually be freed with EVP_KEYEXCH_free(). EVP_KEYEXCH_free() decrements the reference count for the B structure. Typically this structure will have been obtained from an earlier call to EVP_KEYEXCH_fetch(). If the reference count drops to 0 then the -structure is freed. +structure is freed. If the argument is NULL, nothing is done. EVP_KEYEXCH_up_ref() increments the reference count for an B structure. @@ -101,7 +101,7 @@ The functions described here were added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/EVP_KEYMGMT.pod b/openssl/doc/man3/EVP_KEYMGMT.pod index da03286a9..4c0c3b776 100644 --- a/openssl/doc/man3/EVP_KEYMGMT.pod +++ b/openssl/doc/man3/EVP_KEYMGMT.pod @@ -62,6 +62,7 @@ B I. EVP_KEYMGMT_free() decrements the reference count for the given B I, and when the count reaches zero, frees it. +If the argument is NULL, nothing is done. EVP_KEYMGMT_get0_provider() returns the provider that has this particular implementation. @@ -140,7 +141,7 @@ The functions described here were added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/EVP_MD_meth_new.pod b/openssl/doc/man3/EVP_MD_meth_new.pod index a553c378f..349797332 100644 --- a/openssl/doc/man3/EVP_MD_meth_new.pod +++ b/openssl/doc/man3/EVP_MD_meth_new.pod @@ -74,6 +74,7 @@ EVP_MD_meth_dup() creates a copy of B. EVP_MD_meth_free() decrements the reference count for the B structure. If the reference count drops to 0 then the structure is freed. +If the argument is NULL, nothing is done. EVP_MD_meth_set_input_blocksize() sets the internal input block size for the method B to B bytes. @@ -194,7 +195,7 @@ counted in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2015-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/EVP_PKEY_ASN1_METHOD.pod b/openssl/doc/man3/EVP_PKEY_ASN1_METHOD.pod index cc50d363d..41f058fe5 100644 --- a/openssl/doc/man3/EVP_PKEY_ASN1_METHOD.pod +++ b/openssl/doc/man3/EVP_PKEY_ASN1_METHOD.pod @@ -393,7 +393,7 @@ This function is not thread safe, it's recommended to only use this when initializing the application. EVP_PKEY_asn1_free() frees an existing B pointed -by B. +by B. If the argument is NULL, nothing is done. EVP_PKEY_asn1_add0() adds B to the user defined stack of methods unless another B with the same NID is @@ -439,7 +439,7 @@ parameter is now constified. =head1 COPYRIGHT -Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2017-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/EVP_PKEY_meth_new.pod b/openssl/doc/man3/EVP_PKEY_meth_new.pod index db0b09f85..1b0adb291 100644 --- a/openssl/doc/man3/EVP_PKEY_meth_new.pod +++ b/openssl/doc/man3/EVP_PKEY_meth_new.pod @@ -407,7 +407,7 @@ of an B is always called by the EVP framework while doing a digest signing operation by calling L. EVP_PKEY_meth_free() frees an existing B pointed by -B. +B. If the argument is NULL, nothing is done. EVP_PKEY_meth_copy() copies an B object from B to B. @@ -456,7 +456,7 @@ has changed in OpenSSL 3.0 so its I parameter is now constified. =head1 COPYRIGHT -Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2017-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/EVP_RAND.pod b/openssl/doc/man3/EVP_RAND.pod index 0c79c57b8..57133bd62 100644 --- a/openssl/doc/man3/EVP_RAND.pod +++ b/openssl/doc/man3/EVP_RAND.pod @@ -285,7 +285,7 @@ associated RAND ctx. Reads or set the number of elapsed seconds before reseeding the associated RAND ctx. -=item "max_request" (B) +=item "max_request" (B) Specifies the maximum number of bytes that can be generated in a single call to OSSL_FUNC_rand_generate. @@ -411,7 +411,7 @@ The remaining functions were added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/EVP_SIGNATURE.pod b/openssl/doc/man3/EVP_SIGNATURE.pod index 1f534ef33..cf476d145 100644 --- a/openssl/doc/man3/EVP_SIGNATURE.pod +++ b/openssl/doc/man3/EVP_SIGNATURE.pod @@ -49,7 +49,7 @@ The returned value must eventually be freed with EVP_SIGNATURE_free(). EVP_SIGNATURE_free() decrements the reference count for the B structure. Typically this structure will have been obtained from an earlier call to EVP_SIGNATURE_fetch(). If the reference count drops to 0 then the -structure is freed. +structure is freed. If the argument is NULL, nothing is done. EVP_SIGNATURE_up_ref() increments the reference count for an B structure. @@ -106,7 +106,7 @@ The functions described here were added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/HMAC.pod b/openssl/doc/man3/HMAC.pod index 87a567242..ebe69d2db 100644 --- a/openssl/doc/man3/HMAC.pod +++ b/openssl/doc/man3/HMAC.pod @@ -87,7 +87,7 @@ created with HMAC_CTX_new(). HMAC_CTX_free() erases the key and other data from the B, releases any associated resources and finally frees the B -itself. +itself. If the argument is NULL, nothing is done. The following functions may be used if the message is not completely stored in memory: @@ -163,7 +163,7 @@ OpenSSL before version 1.0.0. =head1 COPYRIGHT -Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/MD5.pod b/openssl/doc/man3/MD5.pod index 2e01fe819..99bf82116 100644 --- a/openssl/doc/man3/MD5.pod +++ b/openssl/doc/man3/MD5.pod @@ -7,12 +7,12 @@ MD4_Final, MD5_Init, MD5_Update, MD5_Final - MD2, MD4, and MD5 hash functions =head1 SYNOPSIS - #include - The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining B with a suitable version value, see L: + #include + unsigned char *MD2(const unsigned char *d, unsigned long n, unsigned char *md); int MD2_Init(MD2_CTX *c); @@ -20,25 +20,24 @@ see L: int MD2_Final(unsigned char *md, MD2_CTX *c); - #include - The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining B with a suitable version value, see L: + #include + unsigned char *MD4(const unsigned char *d, unsigned long n, unsigned char *md); int MD4_Init(MD4_CTX *c); int MD4_Update(MD4_CTX *c, const void *data, unsigned long len); int MD4_Final(unsigned char *md, MD4_CTX *c); - - #include - The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining B with a suitable version value, see L: + #include + unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md); int MD5_Init(MD5_CTX *c); @@ -105,7 +104,7 @@ All of these functions were deprecated in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2000-2023 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/NCONF_new_ex.pod b/openssl/doc/man3/NCONF_new_ex.pod index 6861fb198..d088ab2fe 100644 --- a/openssl/doc/man3/NCONF_new_ex.pod +++ b/openssl/doc/man3/NCONF_new_ex.pod @@ -35,7 +35,7 @@ I is set to NULL then the default value of NCONF_default() is used. NCONF_new() is similar to NCONF_new_ex() but sets the I to NULL. NCONF_free() frees the data associated with I and then frees the I -object. +object. If the argument is NULL, nothing is done. NCONF_load() parses the file named I and adds the values found to I. If an error occurs I and I list the file and line that @@ -74,7 +74,7 @@ in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OCSP_REQUEST_new.pod b/openssl/doc/man3/OCSP_REQUEST_new.pod index e34e591fe..3f171e822 100644 --- a/openssl/doc/man3/OCSP_REQUEST_new.pod +++ b/openssl/doc/man3/OCSP_REQUEST_new.pod @@ -29,6 +29,7 @@ OCSP_request_onereq_get0 - OCSP request functions OCSP_REQUEST_new() allocates and returns an empty B structure. OCSP_REQUEST_free() frees up the request structure B. +If the argument is NULL, nothing is done. OCSP_request_add0_id() adds certificate ID B to B. It returns the B structure added so an application can add additional @@ -108,7 +109,7 @@ L =head1 COPYRIGHT -Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2015-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OCSP_cert_to_id.pod b/openssl/doc/man3/OCSP_cert_to_id.pod index 298527f6b..e0fbdfa9e 100644 --- a/openssl/doc/man3/OCSP_cert_to_id.pod +++ b/openssl/doc/man3/OCSP_cert_to_id.pod @@ -38,6 +38,7 @@ issuer name B, issuer key hash B and serial number B. OCSP_CERTID_free() frees up B. +If the argument is NULL, nothing is done. OCSP_id_cmp() compares B B and B. @@ -79,7 +80,7 @@ L =head1 COPYRIGHT -Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2015-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OCSP_response_status.pod b/openssl/doc/man3/OCSP_response_status.pod index 7ff74923a..0902ae8a3 100644 --- a/openssl/doc/man3/OCSP_response_status.pod +++ b/openssl/doc/man3/OCSP_response_status.pod @@ -46,6 +46,7 @@ OCSP_response_create() creates and returns an I structure for I and optionally including basic response I. OCSP_RESPONSE_free() frees up OCSP response I. +If the argument is NULL, nothing is done. OCSP_RESPID_set_by_name() sets the name of the OCSP_RESPID to be the same as the subject name in the supplied X509 certificate I for the OCSP responder. @@ -123,7 +124,7 @@ The OCSP_basic_sign_ctx() function was added in OpenSSL 1.1.1. =head1 COPYRIGHT -Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2015-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OPENSSL_LH_COMPFUNC.pod b/openssl/doc/man3/OPENSSL_LH_COMPFUNC.pod index bf3169ae0..772f42130 100644 --- a/openssl/doc/man3/OPENSSL_LH_COMPFUNC.pod +++ b/openssl/doc/man3/OPENSSL_LH_COMPFUNC.pod @@ -144,7 +144,7 @@ Then a hash table of B> objects can be created using this: B_free>() frees the B(B>) structure I. Allocated hash table entries will not be freed; consider using B_doall>() to deallocate any remaining entries in the -hash table (see below). +hash table (see below). If the argument is NULL, nothing is done. B_flush>() empties the B(B>) structure I
. New entries can be added to the flushed table. Allocated hash table entries diff --git a/openssl/doc/man3/OPENSSL_init_crypto.pod b/openssl/doc/man3/OPENSSL_init_crypto.pod index b2d48daef..1363693c7 100644 --- a/openssl/doc/man3/OPENSSL_init_crypto.pod +++ b/openssl/doc/man3/OPENSSL_init_crypto.pod @@ -249,6 +249,7 @@ If the B flag is not included, any errors in the configuration file will cause an error return from B or indirectly L. The object can be released with OPENSSL_INIT_free() when done. +If the argument to OPENSSL_INIT_free() is NULL, nothing is done. =head1 NOTES @@ -289,7 +290,7 @@ and OPENSSL_INIT_free() functions were added in OpenSSL 1.1.0. =head1 COPYRIGHT -Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OPENSSL_malloc.pod b/openssl/doc/man3/OPENSSL_malloc.pod index 7dc6468f0..20441e76a 100644 --- a/openssl/doc/man3/OPENSSL_malloc.pod +++ b/openssl/doc/man3/OPENSSL_malloc.pod @@ -99,7 +99,8 @@ OPENSSL_zalloc() calls memset() to zero the memory before returning. OPENSSL_clear_realloc() and OPENSSL_clear_free() should be used when the buffer at B holds sensitive information. The old buffer is filled with zero's by calling OPENSSL_cleanse() -before ultimately calling OPENSSL_free(). +before ultimately calling OPENSSL_free(). If the argument to OPENSSL_free() is +NULL, nothing is done. OPENSSL_cleanse() fills B of size B with a string of 0's. Use OPENSSL_cleanse() with care if the memory is a mapping of a file. @@ -198,7 +199,7 @@ clang's memory and leak sanitizer. =head1 COPYRIGHT -Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OPENSSL_secure_malloc.pod b/openssl/doc/man3/OPENSSL_secure_malloc.pod index c5d4bb2db..1bddd7737 100644 --- a/openssl/doc/man3/OPENSSL_secure_malloc.pod +++ b/openssl/doc/man3/OPENSSL_secure_malloc.pod @@ -82,13 +82,15 @@ If CRYPTO_secure_malloc_init() is not called, this is equivalent to calling OPENSSL_free(). It exists for consistency with OPENSSL_secure_malloc() , and is a macro that expands to CRYPTO_secure_free() and adds the C<__FILE__> -and C<__LINE__> parameters.. +and C<__LINE__> parameters.. If the argument to OPENSSL_secure_free() +is NULL, nothing is done. OPENSSL_secure_clear_free() is similar to OPENSSL_secure_free() except that it has an additional C parameter which is used to clear the memory if it was not allocated from the secure heap. If CRYPTO_secure_malloc_init() is not called, this is equivalent to -calling OPENSSL_clear_free(). +calling OPENSSL_clear_free(). If the argument to OPENSSL_secure_clear_free() +is NULL, nothing is done. OPENSSL_secure_actual_size() tells the actual size allocated to the pointer; implementations may allocate more space than initially @@ -133,7 +135,7 @@ a B in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2015-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OSSL_CMP_CTX_new.pod b/openssl/doc/man3/OSSL_CMP_CTX_new.pod index 9d117e204..3af2c8971 100644 --- a/openssl/doc/man3/OSSL_CMP_CTX_new.pod +++ b/openssl/doc/man3/OSSL_CMP_CTX_new.pod @@ -190,6 +190,7 @@ the message timeout is set to 120 seconds, and the proof-of-possession method is set to OSSL_CRMF_POPO_SIGNATURE. OSSL_CMP_CTX_free() deallocates an OSSL_CMP_CTX structure. +If the argument is NULL, nothing is done. OSSL_CMP_CTX_reinit() prepares the given I for a further transaction by clearing the internal CMP transaction (aka session) status, PKIStatusInfo, @@ -343,6 +344,11 @@ RFC 4210. Allow retrieving a trust anchor from extraCerts and using that to validate the certificate chain of an IP message. + This is a quirk option added to support 3GPP TS 33.310. + + Note that using this option is dangerous as the certificate obtained + this way has not been authenticated (at least not at CMP level). + Taking it over as a trust anchor implements trust-on-first-use (TOFU). =item B @@ -642,6 +648,8 @@ If the callback argument is NULL the function tries building an approximate chain as far as possible using the same untrusted certificates from the I, and if this fails it takes the received extraCerts as fallback. The resulting cert chain can be retrieved using OSSL_CMP_CTX_get1_newChain(). +This chain excludes the leaf certificate, i.e., the newly enrolled certificate. +Also the trust anchor (the root certificate) is not included. OSSL_CMP_CTX_set_certConf_cb() sets the callback used for evaluating the newly enrolled certificate before the library sends, depending on its result, diff --git a/openssl/doc/man3/OSSL_CMP_SRV_CTX_new.pod b/openssl/doc/man3/OSSL_CMP_SRV_CTX_new.pod index d1fd7e83b..7484a7a04 100644 --- a/openssl/doc/man3/OSSL_CMP_SRV_CTX_new.pod +++ b/openssl/doc/man3/OSSL_CMP_SRV_CTX_new.pod @@ -114,6 +114,7 @@ associated with the library context I and property query string I, both of which may be NULL to select the defaults. OSSL_CMP_SRV_CTX_free() deletes the given I. +If the argument is NULL, nothing is done. OSSL_CMP_SRV_CTX_init() sets in the given I a custom server context pointer as well as callback functions performing the specific processing of CMP @@ -186,7 +187,7 @@ was added in OpenSSL 3.3. =head1 COPYRIGHT -Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2007-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OSSL_CMP_validate_msg.pod b/openssl/doc/man3/OSSL_CMP_validate_msg.pod index c416a49d7..f04b6b4a8 100644 --- a/openssl/doc/man3/OSSL_CMP_validate_msg.pod +++ b/openssl/doc/man3/OSSL_CMP_validate_msg.pod @@ -42,11 +42,14 @@ using any trust store set via L. If the option OSSL_CMP_OPT_PERMIT_TA_IN_EXTRACERTS_FOR_IR was set by calling L, for an Initialization Response (IP) message -any self-issued certificate from the I extraCerts field may also be used -as trust anchor for the path verification of an acceptable cert if it can be +any self-issued certificate from the I extraCerts field may be used +as a trust anchor for the path verification of an 'acceptable' cert if it can be used also to validate the issued certificate returned in the IP message. This is according to TS 33.310 [Network Domain Security (NDS); Authentication Framework (AF)] document specified by the The 3rd Generation Partnership Project (3GPP). +Note that using this option is dangerous as the certificate obtained this way +has not been authenticated (at least not at CMP level). +Taking it over as a trust anchor implements trust-on-first-use (TOFU). Any cert that has been found as described above is cached and tried first when validating the signatures of subsequent messages in the same transaction. @@ -76,7 +79,7 @@ The OpenSSL CMP support was added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2007-2023 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2007-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OSSL_DECODER.pod b/openssl/doc/man3/OSSL_DECODER.pod index c58ebf462..633aa07f8 100644 --- a/openssl/doc/man3/OSSL_DECODER.pod +++ b/openssl/doc/man3/OSSL_DECODER.pod @@ -61,6 +61,7 @@ I. OSSL_DECODER_free() decrements the reference count for the given I, and when the count reaches zero, frees it. +If the argument is NULL, nothing is done. OSSL_DECODER_get0_provider() returns the provider of the given I. @@ -180,7 +181,7 @@ The functions described here were added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OSSL_DECODER_CTX.pod b/openssl/doc/man3/OSSL_DECODER_CTX.pod index 034cf12c7..33b09c836 100644 --- a/openssl/doc/man3/OSSL_DECODER_CTX.pod +++ b/openssl/doc/man3/OSSL_DECODER_CTX.pod @@ -126,6 +126,7 @@ decoders that have been added to the I so far. Parameters that an implementation doesn't recognise should be ignored by it. OSSL_DECODER_CTX_free() frees the given context I. +If the argument is NULL, nothing is done. OSSL_DECODER_CTX_add_decoder() populates the B I with a decoder, to be used to attempt to decode some encoded input. @@ -249,7 +250,7 @@ The functions described here were added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2020 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OSSL_DECODER_CTX_new_for_pkey.pod b/openssl/doc/man3/OSSL_DECODER_CTX_new_for_pkey.pod index 4b4443777..e55212ad5 100644 --- a/openssl/doc/man3/OSSL_DECODER_CTX_new_for_pkey.pod +++ b/openssl/doc/man3/OSSL_DECODER_CTX_new_for_pkey.pod @@ -82,7 +82,7 @@ choice of preferred pass phrase callback form. These are called indirectly, through an internal L function. The internal L function caches the pass phrase, to -be re-used in all decodings that are performed in the same decoding run (for +be reused in all decodings that are performed in the same decoding run (for example, within one L call). =head2 Input Types @@ -135,7 +135,7 @@ The functions described here were added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OSSL_ENCODER.pod b/openssl/doc/man3/OSSL_ENCODER.pod index d72715472..bbf64b0b4 100644 --- a/openssl/doc/man3/OSSL_ENCODER.pod +++ b/openssl/doc/man3/OSSL_ENCODER.pod @@ -61,6 +61,7 @@ I. OSSL_ENCODER_free() decrements the reference count for the given I, and when the count reaches zero, frees it. +If the argument is NULL, nothing is done. OSSL_ENCODER_get0_provider() returns the provider of the given I. @@ -134,7 +135,7 @@ The functions described here were added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OSSL_ENCODER_CTX.pod b/openssl/doc/man3/OSSL_ENCODER_CTX.pod index b4b5f61e1..e9248c356 100644 --- a/openssl/doc/man3/OSSL_ENCODER_CTX.pod +++ b/openssl/doc/man3/OSSL_ENCODER_CTX.pod @@ -102,6 +102,7 @@ with an L array I. Parameters that the implementation doesn't recognise should be ignored. OSSL_ENCODER_CTX_free() frees the given context I. +If the argument is NULL, nothing is done. OSSL_ENCODER_CTX_add_encoder() populates the B I with a encoder, to be used to encode an input object. @@ -211,7 +212,7 @@ The functions described here were added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OSSL_ERR_STATE_save.pod b/openssl/doc/man3/OSSL_ERR_STATE_save.pod index 93c4b8f47..0e8e1f1fc 100644 --- a/openssl/doc/man3/OSSL_ERR_STATE_save.pod +++ b/openssl/doc/man3/OSSL_ERR_STATE_save.pod @@ -46,6 +46,7 @@ for all the added entries. Any allocated data in the saved error entries is duplicated on adding to the thread state. OSSL_ERR_STATE_free() frees the saved error state I. +If the argument is NULL, nothing is done. =head1 RETURN VALUES @@ -76,7 +77,7 @@ All of these functions were added in OpenSSL 3.2. =head1 COPYRIGHT -Copyright 2023 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2023-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OSSL_HPKE_CTX_new.pod b/openssl/doc/man3/OSSL_HPKE_CTX_new.pod index e291ec7e4..6055ba6ea 100644 --- a/openssl/doc/man3/OSSL_HPKE_CTX_new.pod +++ b/openssl/doc/man3/OSSL_HPKE_CTX_new.pod @@ -240,7 +240,8 @@ I and I are used when fetching algorithms from providers and may be set to NULL. OSSL_HPKE_CTX_free() frees the I B that was created -previously by a call to OSSL_HPKE_CTX_new(). +previously by a call to OSSL_HPKE_CTX_new(). If the argument to +OSSL_HPKE_CTX_free() is NULL, nothing is done. =head2 Sender APIs @@ -565,7 +566,7 @@ This functionality described here was added in OpenSSL 3.2. =head1 COPYRIGHT -Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2022-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OSSL_HTTP_REQ_CTX.pod b/openssl/doc/man3/OSSL_HTTP_REQ_CTX.pod index 105ed60e5..2a1485cbe 100644 --- a/openssl/doc/man3/OSSL_HTTP_REQ_CTX.pod +++ b/openssl/doc/man3/OSSL_HTTP_REQ_CTX.pod @@ -75,6 +75,7 @@ which collects the HTTP request header lines. OSSL_HTTP_REQ_CTX_free() frees up the HTTP request context I. The I is not free'd, I will be free'd if I is set. +If the argument is NULL, nothing is done. OSSL_HTTP_REQ_CTX_set_request_line() adds the 1st HTTP request line to I. The HTTP method is determined by I, diff --git a/openssl/doc/man3/OSSL_LIB_CTX.pod b/openssl/doc/man3/OSSL_LIB_CTX.pod index cf8bd8b06..ad203299e 100644 --- a/openssl/doc/man3/OSSL_LIB_CTX.pod +++ b/openssl/doc/man3/OSSL_LIB_CTX.pod @@ -88,7 +88,7 @@ This can be used to associate a library context with providers that are loaded from a configuration. OSSL_LIB_CTX_free() frees the given I, unless it happens to be the -default OpenSSL library context. +default OpenSSL library context. If the argument is NULL, nothing is done. OSSL_LIB_CTX_get0_global_default() returns a concrete (non NULL) reference to the global default library context. @@ -126,7 +126,7 @@ All of the functions described on this page were added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OSSL_PARAM_BLD.pod b/openssl/doc/man3/OSSL_PARAM_BLD.pod index 639f7bb59..a9dea4121 100644 --- a/openssl/doc/man3/OSSL_PARAM_BLD.pod +++ b/openssl/doc/man3/OSSL_PARAM_BLD.pod @@ -53,6 +53,7 @@ so that values can be added. Any existing values are cleared. OSSL_PARAM_BLD_free() deallocates the memory allocates by OSSL_PARAM_BLD_new(). +If the argument is NULL, nothing is done. OSSL_PARAM_BLD_to_param() converts a built up OSSL_PARAM_BLD structure I into an allocated OSSL_PARAM array. @@ -206,7 +207,7 @@ The functions described here were all added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OSSL_PARAM_dup.pod b/openssl/doc/man3/OSSL_PARAM_dup.pod index 4ae33faf1..c8d109a22 100644 --- a/openssl/doc/man3/OSSL_PARAM_dup.pod +++ b/openssl/doc/man3/OSSL_PARAM_dup.pod @@ -32,6 +32,7 @@ array that have the same key. OSSL_PARAM_free() frees the parameter array I that was created using OSSL_PARAM_dup(), OSSL_PARAM_merge() or OSSL_PARAM_BLD_to_param(). +If the argument to OSSL_PARAM_free() is NULL, nothing is done. =head1 RETURN VALUES @@ -49,7 +50,7 @@ The functions were added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OSSL_SELF_TEST_new.pod b/openssl/doc/man3/OSSL_SELF_TEST_new.pod index 4c4b10fca..c46becd1a 100644 --- a/openssl/doc/man3/OSSL_SELF_TEST_new.pod +++ b/openssl/doc/man3/OSSL_SELF_TEST_new.pod @@ -32,6 +32,7 @@ The callback I may be triggered multiple times by a self test to indicate different phases. OSSL_SELF_TEST_free() frees the space allocated by OSSL_SELF_TEST_new(). +If the argument is NULL, nothing is done. OSSL_SELF_TEST_onbegin() may be inserted at the start of a block of self test code. It can be used for diagnostic purposes. @@ -165,7 +166,7 @@ The functions described here were added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OSSL_STORE_INFO.pod b/openssl/doc/man3/OSSL_STORE_INFO.pod index 39bb93fbf..b8332855d 100644 --- a/openssl/doc/man3/OSSL_STORE_INFO.pod +++ b/openssl/doc/man3/OSSL_STORE_INFO.pod @@ -101,6 +101,7 @@ holds if the B type (as returned by OSSL_STORE_INFO_get_type()) matches the function, otherwise NULL. OSSL_STORE_INFO_free() frees a B and its contained type. +If the argument is NULL, nothing is done. OSSL_STORE_INFO_new_NAME() , OSSL_STORE_INFO_new_PARAMS(), , OSSL_STORE_INFO_new_PUBKEY(), OSSL_STORE_INFO_new_PKEY(), @@ -221,7 +222,7 @@ The OSSL_STORE_INFO_PUBKEY object type was added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OSSL_STORE_LOADER.pod b/openssl/doc/man3/OSSL_STORE_LOADER.pod index c008e397e..b4fcc7efe 100644 --- a/openssl/doc/man3/OSSL_STORE_LOADER.pod +++ b/openssl/doc/man3/OSSL_STORE_LOADER.pod @@ -105,7 +105,6 @@ see L: typedef int (*OSSL_STORE_close_fn)(OSSL_STORE_LOADER_CTX *ctx); int OSSL_STORE_LOADER_set_close(OSSL_STORE_LOADER *store_loader, OSSL_STORE_close_fn store_close_function); - void OSSL_STORE_LOADER_free(OSSL_STORE_LOADER *store_loader); int OSSL_STORE_register_loader(OSSL_STORE_LOADER *loader); OSSL_STORE_LOADER *OSSL_STORE_unregister_loader(const char *scheme); @@ -126,6 +125,7 @@ I. OSSL_STORE_LOADER_free() decrements the reference count for the given I, and when the count reaches zero, frees it. +If the argument is NULL, nothing is done. OSSL_STORE_LOADER_get0_provider() returns the provider of the given I. @@ -297,6 +297,7 @@ OSSL_STORE_LOADER_set_close() sets the closing function for the I. OSSL_STORE_LOADER_free() frees the given I. +If the argument is NULL, nothing is done. OSSL_STORE_register_loader() register the given I and thereby makes it available for use with OSSL_STORE_open(), @@ -358,21 +359,25 @@ L =head1 HISTORY OSSL_STORE_LOADER_fetch(), OSSL_STORE_LOADER_up_ref(), -OSSL_STORE_LOADER_free(), OSSL_STORE_LOADER_get0_provider(), -OSSL_STORE_LOADER_get0_properties(), OSSL_STORE_LOADER_is_a(), -OSSL_STORE_LOADER_do_all_provided() and -OSSL_STORE_LOADER_names_do_all() were added in OpenSSL 3.0. +OSSL_STORE_LOADER_get0_provider(), OSSL_STORE_LOADER_get0_properties(), +OSSL_STORE_LOADER_get0_description(), OSSL_STORE_LOADER_is_a(), +OSSL_STORE_LOADER_do_all_provided() and OSSL_STORE_LOADER_names_do_all() +were added in OpenSSL 3.0. -OSSL_STORE_open_ex_fn() was added in OpenSSL 3.0. +B and OSSL_STORE_LOADER_free() were added in OpenSSL +1.1.1. -B, B, OSSL_STORE_LOADER_new(), +OSSL_STORE_LOADER_set_open_ex() and OSSL_STORE_open_ex_fn() were added in +OpenSSL 3.0, and are deprecated. + +B, OSSL_STORE_LOADER_new(), OSSL_STORE_LOADER_set0_scheme(), OSSL_STORE_LOADER_get0_scheme(), OSSL_STORE_LOADER_get0_engine(), OSSL_STORE_LOADER_set_expect(), OSSL_STORE_LOADER_set_find(), OSSL_STORE_LOADER_set_attach(), OSSL_STORE_LOADER_set_open_ex(), OSSL_STORE_LOADER_set_open(), OSSL_STORE_LOADER_set_ctrl(), OSSL_STORE_LOADER_set_load(), OSSL_STORE_LOADER_set_eof(), -OSSL_STORE_LOADER_set_close(), OSSL_STORE_LOADER_free(), +OSSL_STORE_LOADER_set_close(), OSSL_STORE_register_loader(), OSSL_STORE_LOADER_set_error(), OSSL_STORE_unregister_loader(), OSSL_STORE_open_fn(), OSSL_STORE_ctrl_fn(), OSSL_STORE_load_fn(), OSSL_STORE_eof_fn() and OSSL_STORE_close_fn() @@ -380,7 +385,7 @@ were added in OpenSSL 1.1.1, and became deprecated in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/OSSL_STORE_SEARCH.pod b/openssl/doc/man3/OSSL_STORE_SEARCH.pod index 79186b089..bd512890c 100644 --- a/openssl/doc/man3/OSSL_STORE_SEARCH.pod +++ b/openssl/doc/man3/OSSL_STORE_SEARCH.pod @@ -75,6 +75,7 @@ criterion, so they must have at least the same life time as the created B. OSSL_STORE_SEARCH_free() is used to free the B. +If the argument is NULL, nothing is done. =head2 Loader Functions @@ -183,7 +184,7 @@ were added in OpenSSL 1.1.1. =head1 COPYRIGHT -Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2018-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/PEM_read_bio_PrivateKey.pod b/openssl/doc/man3/PEM_read_bio_PrivateKey.pod index ac93920ad..f1635b898 100644 --- a/openssl/doc/man3/PEM_read_bio_PrivateKey.pod +++ b/openssl/doc/man3/PEM_read_bio_PrivateKey.pod @@ -320,7 +320,9 @@ NULL but I<*x> is NULL then the structure returned will be written to I<*x>. If neither I nor I<*x> is NULL then an attempt is made to reuse the structure at I<*x> (but see BUGS and EXAMPLES sections). Irrespective of the value of I a pointer to the structure is always -returned (or NULL if an error occurred). +returned (or NULL if an error occurred). The caller retains ownership of the +returned object and needs to free it when it is no longer needed, e.g. +using X509_free() for X509 objects or EVP_PKEY_free() for EVP_PKEY objects. The PEM functions which write private keys take an I parameter which specifies the encryption algorithm to use, encryption is done @@ -574,7 +576,7 @@ PEM_write_bio_DHparams() and PEM_write_DHparams() were deprecated in 3.0. =head1 COPYRIGHT -Copyright 2001-2022 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2001-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/RAND_set_DRBG_type.pod b/openssl/doc/man3/RAND_set_DRBG_type.pod index f78c15ff4..423ebfad6 100644 --- a/openssl/doc/man3/RAND_set_DRBG_type.pod +++ b/openssl/doc/man3/RAND_set_DRBG_type.pod @@ -27,7 +27,7 @@ private random instances. RAND_set_seed_source_type() specifies the seed source that will be used within the library context I. The seed source of name I with properties I will be fetched and used to seed the primary -random big generator. +random bit generator. =head1 RETURN VALUES @@ -54,7 +54,7 @@ These functions were added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/RSA_meth_new.pod b/openssl/doc/man3/RSA_meth_new.pod index 6c8eda161..40f9bc4e8 100644 --- a/openssl/doc/man3/RSA_meth_new.pod +++ b/openssl/doc/man3/RSA_meth_new.pod @@ -147,7 +147,7 @@ passed as a parameter. This might be useful for creating a new B based on an existing one, but with some differences. RSA_meth_free() destroys an B structure and frees up any -memory associated with it. +memory associated with it. If the argument is NULL, nothing is done. RSA_meth_get0_name() will return a pointer to the name of this RSA_METHOD. This is a pointer to the internal name string and so @@ -260,7 +260,7 @@ Other functions described here were added in OpenSSL 1.1.0. =head1 COPYRIGHT -Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/SCT_new.pod b/openssl/doc/man3/SCT_new.pod index 235762721..a20affd38 100644 --- a/openssl/doc/man3/SCT_new.pod +++ b/openssl/doc/man3/SCT_new.pod @@ -166,6 +166,12 @@ SCT_set_source() can be used to record where the SCT was found (TLS extension, X.509 certificate extension or OCSP response). This is not required for verifying the SCT. +SCT_free() frees the specified SCT. +If the argument is NULL, nothing is done. + +SCT_LIST_free() frees the specified stack of SCTs. +If the argument is NULL, nothing is done. + =head1 NOTES Some of the setters return int, instead of void. These will all return 1 on @@ -210,7 +216,7 @@ These functions were added in OpenSSL 1.1.0. =head1 COPYRIGHT -Copyright 2016-2017 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/SSL_CTX_set1_curves.pod b/openssl/doc/man3/SSL_CTX_set1_curves.pod index 8e521f755..1ebabfb48 100644 --- a/openssl/doc/man3/SSL_CTX_set1_curves.pod +++ b/openssl/doc/man3/SSL_CTX_set1_curves.pod @@ -43,22 +43,46 @@ When setting such groups applications should use the "list" form of these functions (i.e. SSL_CTX_set1_groups_list() and SSL_set1_groups_list). SSL_CTX_set1_groups() sets the supported groups for B to B -groups in the array B. The array consist of all NIDs of groups in -preference order. For a TLS client the groups are used directly in the -supported groups extension. For a TLS server the groups are used to -determine the set of shared groups. Currently supported groups for -B are B, B, B, -B, B, B, -B, B, B, -B, B, B and B. +groups in the array B. The array consist of all NIDs of supported groups. +Currently supported groups for B are B, +B, B, B, B, +B, B, +B, B, B, +B, B and B. +OpenSSL will use this array in different ways depending on TLS role and version: + +=over 4 + +=item For a TLS client, the groups are used directly in the supported groups +extension. The extension's preference order, to be evaluated by the server, is +determined by the order of the elements in the array. + +=item For a TLS 1.2 server, the groups determine the selected group. If +B is set, the order of the elements in the +array determines the selected group. Otherwise, the order is ignored and the +client's order determines the selection. + +=item For a TLS 1.3 server, the groups determine the selected group, but +selection is more complex. A TLS 1.3 client sends both a group list as well as a +predicted subset of groups. Choosing a group outside the predicted subset incurs +an extra roundtrip. However, in some situations, the most preferred group may +not be predicted. OpenSSL considers all supported groups to be comparable in +security and prioritizes avoiding roundtrips above either client or server +preference order. If an application uses an external provider to extend OpenSSL +with, e.g., a post-quantum algorithm, this behavior may allow a network attacker +to downgrade connections to a weaker algorithm. + +=back SSL_CTX_set1_groups_list() sets the supported groups for B to string B. The string is a colon separated list of group names, for example -"P-521:P-384:P-256:X25519:ffdhe2048". Currently supported groups for B -are B, B, B, B, B, B, -B, B, B, B, -B, B and B. Support for other groups may be -added by external providers. If a group name is preceded with the C +"P-521:P-384:P-256:X25519:ffdhe2048". The groups are used as in +SSL_CTX_set1_groups(), described above. Currently supported groups for +B are B, B, B, B, B, +B, B, B, +B, B, B, B and B. Support +for other groups may be added by external providers, however note the discussion +on TLS 1.3 selection criteria above. If a group name is preceded with the C character, it will be ignored if an implementation is missing. SSL_set1_groups() and SSL_set1_groups_list() are similar except they set @@ -146,6 +170,10 @@ was added in OpenSSL 3.0.0. Support for ignoring unknown groups in SSL_CTX_set1_groups_list() and SSL_set1_groups_list() was added in OpenSSL 3.3. +Earlier versions of this document described the list as a preference order. +However, OpenSSL's behavior as a TLS 1.3 server is to consider I +supported groups as comparable in security. + =head1 COPYRIGHT Copyright 2013-2024 The OpenSSL Project Authors. All Rights Reserved. diff --git a/openssl/doc/man3/SSL_CTX_set_alpn_select_cb.pod b/openssl/doc/man3/SSL_CTX_set_alpn_select_cb.pod index 05fee2fbe..dd5517df4 100644 --- a/openssl/doc/man3/SSL_CTX_set_alpn_select_cb.pod +++ b/openssl/doc/man3/SSL_CTX_set_alpn_select_cb.pod @@ -52,7 +52,8 @@ SSL_select_next_proto, SSL_get0_alpn_selected, SSL_get0_next_proto_negotiated SSL_CTX_set_alpn_protos() and SSL_set_alpn_protos() are used by the client to set the list of protocols available to be negotiated. The B must be in protocol-list format, described below. The length of B is specified in -B. +B. Setting B to 0 clears any existing list of ALPN +protocols and no ALPN extension will be sent to the server. SSL_CTX_set_alpn_select_cb() sets the application callback B used by a server to select which protocol to use for the incoming connection. When B @@ -73,9 +74,16 @@ B and B, B must be in the protocol-list format described below. The first item in the B, B list that matches an item in the B, B list is selected, and returned in B, B. The B value will point into either B or -B, so it should be copied immediately. If no match is found, the first -item in B, B is returned in B, B. This -function can also be used in the NPN callback. +B, so it should be copied immediately. The client list must include at +least one valid (nonempty) protocol entry in the list. + +The SSL_select_next_proto() helper function can be useful from either the ALPN +callback or the NPN callback (described below). If no match is found, the first +item in B, B is returned in B, B and +B is returned. This can be useful when implementing +the NPN callback. In the ALPN case, the value returned in B and B +must be ignored if B has been returned from +SSL_select_next_proto(). SSL_CTX_set_next_proto_select_cb() sets a callback B that is called when a client needs to select a protocol from the server's provided list, and a @@ -85,9 +93,10 @@ must be set to point to the selected protocol (which may be within B). The length of the protocol name must be written into B. The server's advertised protocols are provided in B and B. The callback can assume that B is syntactically valid. The client must -select a protocol. It is fatal to the connection if this callback returns -a value other than B. The B parameter is the pointer -set via SSL_CTX_set_next_proto_select_cb(). +select a protocol (although it may be an empty, zero length protocol). It is +fatal to the connection if this callback returns a value other than +B or if the zero length protocol is selected. The B +parameter is the pointer set via SSL_CTX_set_next_proto_select_cb(). SSL_CTX_set_next_protos_advertised_cb() sets a callback B that is called when a TLS server needs a list of supported protocols for Next Protocol @@ -154,7 +163,8 @@ A match was found and is returned in B, B. =item OPENSSL_NPN_NO_OVERLAP No match was found. The first item in B, B is returned in -B, B. +B, B (or B and 0 in the case where the first entry in +B is invalid). =back @@ -192,7 +202,7 @@ L =head1 COPYRIGHT -Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/SSL_CTX_set_cipher_list.pod b/openssl/doc/man3/SSL_CTX_set_cipher_list.pod index 71f399400..08d7693f4 100644 --- a/openssl/doc/man3/SSL_CTX_set_cipher_list.pod +++ b/openssl/doc/man3/SSL_CTX_set_cipher_list.pod @@ -52,7 +52,7 @@ ciphersuite names in order of preference. Valid TLSv1.3 ciphersuite names are: =back -An empty list is permissible. The default value for the this setting is: +An empty list is permissible. The default value for this setting is: "TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256" @@ -119,7 +119,7 @@ OSSL_default_cipher_list() and OSSL_default_ciphersites() are new in 3.0. =head1 COPYRIGHT -Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2000-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/SSL_CTX_set_tlsext_ticket_key_cb.pod b/openssl/doc/man3/SSL_CTX_set_tlsext_ticket_key_cb.pod index f289383c7..e4871590f 100644 --- a/openssl/doc/man3/SSL_CTX_set_tlsext_ticket_key_cb.pod +++ b/openssl/doc/man3/SSL_CTX_set_tlsext_ticket_key_cb.pod @@ -126,9 +126,9 @@ The I key material can be set using L. =head1 NOTES -Session resumption shortcuts the TLS so that the client certificate -negotiation don't occur. It makes up for this by storing client certificate -an all other negotiated state information encrypted within the ticket. In a +Session resumption shortcuts the TLS handshake so that the client certificate +negotiation doesn't occur. It makes up for this by storing the client certificate +and all other negotiated state information encrypted within the ticket. In a resumed session the applications will have all this state information available exactly as if a full negotiation had occurred. @@ -241,7 +241,7 @@ OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2014-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2014-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/TS_RESP_CTX_new.pod b/openssl/doc/man3/TS_RESP_CTX_new.pod index 725a1921d..01fd23a10 100644 --- a/openssl/doc/man3/TS_RESP_CTX_new.pod +++ b/openssl/doc/man3/TS_RESP_CTX_new.pod @@ -27,6 +27,7 @@ and property query to NULL. This results in the default (NULL) library context being used for any operations requiring algorithm fetches. TS_RESP_CTX_free() frees the B object I. +If the argument is NULL, nothing is done. =head1 RETURN VALUES @@ -39,7 +40,7 @@ The function TS_RESP_CTX_new_ex() was added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/X509V3_get_d2i.pod b/openssl/doc/man3/X509V3_get_d2i.pod index 4a2e81b0d..88294ff71 100644 --- a/openssl/doc/man3/X509V3_get_d2i.pod +++ b/openssl/doc/man3/X509V3_get_d2i.pod @@ -108,6 +108,7 @@ The function X509V3_get_d2i() and its variants will return NULL if the extension is not found, occurs multiple times or cannot be decoded. It is possible to determine the precise reason by checking the value of I<*crit>. +The returned pointer must be explicitly freed. The function X509V3_add1_i2d() and its variants allocate B objects on STACK I<*x> depending on I. The B objects @@ -236,7 +237,7 @@ L =head1 COPYRIGHT -Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2015-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/X509_LOOKUP.pod b/openssl/doc/man3/X509_LOOKUP.pod index f888d2846..de4eca7fd 100644 --- a/openssl/doc/man3/X509_LOOKUP.pod +++ b/openssl/doc/man3/X509_LOOKUP.pod @@ -85,6 +85,7 @@ X509_LOOKUP_shutdown() tears down the internal state and resources of the given B. X509_LOOKUP_free() destructs the given B. +If the argument is NULL, nothing is done. X509_LOOKUP_set_method_data() and X509_LOOKUP_get_method_data() associates and retrieves a pointer to application data to and from the @@ -237,7 +238,7 @@ added in OpenSSL 3.0. =head1 COPYRIGHT -Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/X509_LOOKUP_meth_new.pod b/openssl/doc/man3/X509_LOOKUP_meth_new.pod index 49776e712..19faae2e5 100644 --- a/openssl/doc/man3/X509_LOOKUP_meth_new.pod +++ b/openssl/doc/man3/X509_LOOKUP_meth_new.pod @@ -110,6 +110,7 @@ be given a human-readable string containing a brief description of the lookup method. X509_LOOKUP_meth_free() destroys a B structure. +If the argument is NULL, nothing is done. X509_LOOKUP_get_new_item() and X509_LOOKUP_set_new_item() get and set the function that is called when an B object is created with @@ -187,7 +188,7 @@ The functions described here were added in OpenSSL 1.1.0i. =head1 COPYRIGHT -Copyright 2018-2020 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2018-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/X509_STORE_new.pod b/openssl/doc/man3/X509_STORE_new.pod index 59b5160f3..9162080e0 100644 --- a/openssl/doc/man3/X509_STORE_new.pod +++ b/openssl/doc/man3/X509_STORE_new.pod @@ -27,6 +27,7 @@ X509_STORE_lock() locks the store from modification by other threads, X509_STORE_unlock() unlocks it. X509_STORE_free() frees up a single X509_STORE object. +If the argument is NULL, nothing is done. =head1 RETURN VALUES @@ -49,7 +50,7 @@ functions were added in OpenSSL 1.1.0. =head1 COPYRIGHT -Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/X509_dup.pod b/openssl/doc/man3/X509_dup.pod index 86a259f02..029958d98 100644 --- a/openssl/doc/man3/X509_dup.pod +++ b/openssl/doc/man3/X509_dup.pod @@ -370,7 +370,7 @@ followed by I, which re-builds the cached data. B_free>() releases the object and all pointers and sub-objects -within it. +within it. If the argument is NULL, nothing is done. B_print_ctx>() prints the object I on the specified BIO I. Each line will be prefixed with I spaces. diff --git a/openssl/doc/man3/X509_new.pod b/openssl/doc/man3/X509_new.pod index dcebb55fe..264767e83 100644 --- a/openssl/doc/man3/X509_new.pod +++ b/openssl/doc/man3/X509_new.pod @@ -21,7 +21,7 @@ OSSL_STACK_OF_X509_free =head1 DESCRIPTION -The X509 ASN1 allocation routines, allocate and free an +The X509 ASN1 allocation routines allocate and free an X509 structure, which represents an X509 certificate. X509_new_ex() allocates and initializes a X509 structure with a @@ -36,7 +36,8 @@ and property query to NULL. This results in the default (NULL) library context being used for any X509 operations requiring algorithm fetches. X509_free() decrements the reference count of B structure B and -frees it up if the reference count is zero. If B is NULL nothing is done. +frees it up if the reference count is zero. If the argument is NULL, +nothing is done. X509_up_ref() increments the reference count of B. @@ -45,6 +46,7 @@ chain B and returns a copy of the stack, or an empty stack if B is NULL. OSSL_STACK_OF_X509_free() deallocates the given list of pointers to certificates after calling X509_free() on all its elements. +If the argument is NULL, nothing is done. =head1 NOTES @@ -96,7 +98,7 @@ OSSL_STACK_OF_X509_free() was added in OpenSSL 3.2. =head1 COPYRIGHT -Copyright 2002-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2002-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man3/d2i_X509.pod b/openssl/doc/man3/d2i_X509.pod index 00efb6035..c4b589dd8 100644 --- a/openssl/doc/man3/d2i_X509.pod +++ b/openssl/doc/man3/d2i_X509.pod @@ -387,7 +387,9 @@ B>() attempts to decode I bytes at I<*ppin>. If successful a pointer to the B> structure is returned and I<*ppin> is incremented to the byte following the parsed data. If I is not NULL then a pointer to the returned structure is also written to I<*a>. If an error occurred -then NULL is returned. +then NULL is returned. The caller retains ownership of the +returned object and needs to free it when it is no longer needed, e.g. +using X509_free() for X509 objects or DSA_SIG_free() for DSA_SIG objects. On a successful return, if I<*a> is not NULL then it is assumed that I<*a> contains a valid B> structure and an attempt is made to reuse it. @@ -615,7 +617,7 @@ efficiency reasons. =head1 COPYRIGHT -Copyright 1998-2023 The OpenSSL Project Authors. All Rights Reserved. +Copyright 1998-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man7/EVP_KDF-ARGON2.pod b/openssl/doc/man7/EVP_KDF-ARGON2.pod index d41a3179b..0f80638d0 100644 --- a/openssl/doc/man7/EVP_KDF-ARGON2.pod +++ b/openssl/doc/man7/EVP_KDF-ARGON2.pod @@ -44,6 +44,8 @@ The supported parameters are: =item "size" (B) +=item "properties" (B) + These parameters work as described in L. Note that RFC 9106 recommends 128 bits salt for most applications, or 64 bits @@ -182,7 +184,7 @@ This functionality was added to OpenSSL 3.2. =head1 COPYRIGHT -Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2022-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man7/EVP_KEYEXCH-DH.pod b/openssl/doc/man7/EVP_KEYEXCH-DH.pod index a6927afef..eaec67775 100644 --- a/openssl/doc/man7/EVP_KEYEXCH-DH.pod +++ b/openssl/doc/man7/EVP_KEYEXCH-DH.pod @@ -7,9 +7,14 @@ EVP_KEYEXCH-DH =head1 DESCRIPTION -Key exchange support for the B key type. +Key exchange support for the B and B key types. -=head2 DH key exchange parameters +Please note that although both key types support the same key exchange +operations, they cannot be used together in a single key exchange. It +is not possible to use a private key of the B type in key exchange +with the public key of B type and vice versa. + +=head2 DH and DHX key exchange parameters =over 4 @@ -122,7 +127,7 @@ L, =head1 COPYRIGHT -Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man7/EVP_PKEY-DH.pod b/openssl/doc/man7/EVP_PKEY-DH.pod index 1662b152e..1232730c3 100644 --- a/openssl/doc/man7/EVP_PKEY-DH.pod +++ b/openssl/doc/man7/EVP_PKEY-DH.pod @@ -7,11 +7,12 @@ EVP_PKEY-DH, EVP_PKEY-DHX, EVP_KEYMGMT-DH, EVP_KEYMGMT-DHX =head1 DESCRIPTION -For B FFC key agreement, two classes of domain parameters can be used: -"safe" domain parameters that are associated with approved named safe-prime -groups, and a class of "FIPS186-type" domain parameters. FIPS186-type domain -parameters should only be used for backward compatibility with existing -applications that cannot be upgraded to use the approved safe-prime groups. +For finite field Diffie-Hellman key agreement, two classes of domain +parameters can be used: "safe" domain parameters that are associated with +approved named safe-prime groups, and a class of "FIPS186-type" domain +parameters. FIPS186-type domain parameters should only be used for backward +compatibility with existing applications that cannot be upgraded to use the +approved safe-prime groups. See L for more information about FFC keys. @@ -20,11 +21,11 @@ I value. The B key type uses X9.42 format which saves the value of I and this must be used for FIPS186-4. If key validation is required, users should be aware of the nuances associated with FIPS186-4 style parameters as discussed in -L. +L. =head2 DH and DHX domain parameters -In addition to the common FCC parameters that all FFC keytypes should support +In addition to the common FFC parameters that all FFC keytypes should support (see L) the B and B keytype implementations support the following: @@ -129,43 +130,44 @@ Where s is the security strength of the key which has values of =back -=head2 DH key validation +=head2 DH and DHX key validation -For B that is not a named group the FIPS186-4 standard specifies that the +For keys that are not a named group the FIPS186-4 standard specifies that the values used for FFC parameter generation are also required for parameter validation. This means that optional FFC domain parameter values for I, I and I or I may need to be stored for validation purposes. For B the I and I can be stored in ASN1 data (but the I or I cannot be stored). It is recommended to use a -named safe prime group instead. +B parameters with named safe prime group instead. -For DH keys, L behaves in the following way: -The OpenSSL FIPS provider tests if the parameters are either an approved safe -prime group OR that the FFC parameters conform to FIPS186-4 as defined in -SP800-56Ar3 I. -The OpenSSL default provider uses simpler checks that allows there to be no I -value for backwards compatibility. +With the OpenSSL FIPS provider, L and +L behave in the following way: the parameters +are tested if they are either an approved safe prime group OR that the FFC +parameters conform to FIPS186-4 as defined in SP800-56Ar3 I. -For DH keys, L is equivalent to -L. +The OpenSSL default provider uses simpler checks that allows there to be no I +value for backwards compatibility, however the L will +test the I

value for being a prime (and a safe prime if I is missing) +which can take significant time. The L avoids +the prime tests. -For DH keys, L conforms to -SP800-56Ar3 I. +L conforms to SP800-56Ar3 +I. -For DH keys, L conforms to -SP800-56Ar3 I when the -DH key is an approved named safe prime group, otherwise it is the same as -L. +L conforms to SP800-56Ar3 +I when the key is an approved named safe +prime group, otherwise it is the same as L. -For DH Keys, L tests that the private key is in the -correct range according to SP800-56Ar3. The OpenSSL FIPS provider requires the -value of I to be set (note that this is set for named safe prime groups). +L tests that the private key is in the correct range +according to SP800-56Ar3. The OpenSSL FIPS provider requires the value of I +to be set (note that this is implicitly set for named safe prime groups). For backwards compatibility the OpenSSL default provider only requires I

to be set. -For DH keys, L conforms to -SP800-56Ar3 I. +L conforms to SP800-56Ar3 +I. =head1 EXAMPLES @@ -327,7 +329,7 @@ L =head1 COPYRIGHT -Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/doc/man7/ossl_store.pod b/openssl/doc/man7/ossl_store.pod index a2c626006..d6fdae8f2 100644 --- a/openssl/doc/man7/ossl_store.pod +++ b/openssl/doc/man7/ossl_store.pod @@ -44,7 +44,11 @@ other encoding is undefined. =head2 A generic call - OSSL_STORE_CTX *ctx = OSSL_STORE_open("file:/foo/bar/data.pem"); + #include /* for UI_get_default_method */ + #include + + OSSL_STORE_CTX *ctx = OSSL_STORE_open("file:/foo/bar/data.pem", + UI_get_default_method(), NULL, NULL, NULL); /* * OSSL_STORE_eof() simulates file semantics for any repository to signal @@ -65,6 +69,7 @@ other encoding is undefined. PEM_write_X509(stdout, OSSL_STORE_INFO_get0_CERT(info)); break; } + OSSL_STORE_INFO_free(info); } OSSL_STORE_close(ctx); @@ -77,7 +82,7 @@ L =head1 COPYRIGHT -Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. +Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy diff --git a/openssl/exporters/build.info b/openssl/exporters/build.info index 86acf2df9..9241dc9b0 100644 --- a/openssl/exporters/build.info +++ b/openssl/exporters/build.info @@ -19,7 +19,7 @@ DEPEND[openssl.pc]=libcrypto.pc libssl.pc DEPEND[""]=openssl.pc GENERATE[../installdata.pm]=../util/mkinstallvars.pl \ - "PREFIX=$(INSTALLTOP)" BINDIR=bin "LIBDIR=$(LIBDIR)" \ + "PREFIX=$(INSTALLTOP)" BINDIR=bin "LIBDIR=$(LIBDIR)" "libdir=$(libdir)" \ INCLUDEDIR=include APPLINKDIR=include/openssl \ "ENGINESDIR=$(ENGINESDIR)" "MODULESDIR=$(MODULESDIR)" \ "PKGCONFIGDIR=$(PKGCONFIGDIR)" "CMAKECONFIGDIR=$(CMAKECONFIGDIR)" \ diff --git a/openssl/exporters/cmake/OpenSSLConfig.cmake.in b/openssl/exporters/cmake/OpenSSLConfig.cmake.in index 2d2321931..766aebe3d 100644 --- a/openssl/exporters/cmake/OpenSSLConfig.cmake.in +++ b/openssl/exporters/cmake/OpenSSLConfig.cmake.in @@ -89,12 +89,15 @@ unset(_ossl_undefined_targets) # Set up the import path, so all other import paths are made relative this file get_filename_component(_ossl_prefix "${CMAKE_CURRENT_LIST_FILE}" PATH) {- - # For each component in $OpenSSL::safe::installdata::CMAKECONFIGDIR_REL, have CMake - # out the parent directory. - my $d = unixify($OpenSSL::safe::installdata::CMAKECONFIGDIR_REL); + # For each component in $OpenSSL::safe::installdata::CMAKECONFIGDIR[0] relative to + # $OpenSSL::safe::installdata::PREFIX[0], have CMake figure out the parent directory. + my $d = join('/', unixify(catdir($OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0], + $OpenSSL::safe::installdata::CMAKECONFIGDIR_REL_LIBDIR[0]), 1)); $OUT = ''; - $OUT .= 'get_filename_component(_ossl_prefix "${_ossl_prefix}" PATH)' . "\n" - foreach (split '/', $d); + if ($d ne '.') { + $OUT .= 'get_filename_component(_ossl_prefix "${_ossl_prefix}" PATH)' . "\n" + foreach (split '/', $d); + } -} if(_ossl_prefix STREQUAL "/") set(_ossl_prefix "") @@ -126,13 +129,15 @@ set(OPENSSL_VERSION_FIX "${OpenSSL_VERSION_PATCH}") set(OPENSSL_FOUND YES) # Directories and names -set(OPENSSL_INCLUDE_DIR "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::INCLUDEDIR_REL, 1); -}") -set(OPENSSL_LIBRARY_DIR "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::LIBDIR_REL, 1); -}") -set(OPENSSL_ENGINES_DIR "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::ENGINESDIR_REL, 1); -}") -set(OPENSSL_MODULES_DIR "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::MODULESDIR_REL, 1); -}") -set(OPENSSL_RUNTIME_DIR "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::BINDIR_REL, 1); -}") +set(OPENSSL_LIBRARY_DIR "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0], 1); -}") +set(OPENSSL_INCLUDE_DIR{- $OUT = ''; + $OUT .= ' "${_ossl_prefix}/' . $_ . '"' + foreach (@OpenSSL::safe::installdata::INCLUDEDIR_REL_PREFIX); -}) +set(OPENSSL_ENGINES_DIR "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0], 1); -}/{- unixify($OpenSSL::safe::installdata::ENGINESDIR_REL_LIBDIR[0], 1); -}") +set(OPENSSL_MODULES_DIR "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0], 1); -}/{- unixify($OpenSSL::safe::installdata::MODULESDIR_REL_LIBDIR[0], 1); -}") +set(OPENSSL_RUNTIME_DIR "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::BINDIR_REL_PREFIX[0], 1); -}") {- output_off() if $disabled{uplink}; "" -} -set(OPENSSL_APPLINK_SOURCE "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::APPLINKDIR_REL, 1); -}/applink.c") +set(OPENSSL_APPLINK_SOURCE "${_ossl_prefix}/{- unixify($OpenSSL::safe::installdata::APPLINKDIR_REL_PREFIX[0], 1); -}/applink.c") {- output_on() if $disabled{uplink}; "" -} set(OPENSSL_PROGRAM "${OPENSSL_RUNTIME_DIR}/{- platform->bin('openssl') -}") diff --git a/openssl/exporters/pkg-config/libcrypto.pc.in b/openssl/exporters/pkg-config/libcrypto.pc.in index 14ed339f3..3d56e9741 100644 --- a/openssl/exporters/pkg-config/libcrypto.pc.in +++ b/openssl/exporters/pkg-config/libcrypto.pc.in @@ -1,11 +1,27 @@ -libdir={- $OpenSSL::safe::installdata::LIBDIR -} -includedir={- $OpenSSL::safe::installdata::INCLUDEDIR -} -enginesdir={- $OpenSSL::safe::installdata::ENGINESDIR -} -modulesdir={- $OpenSSL::safe::installdata::MODULESDIR -} +prefix={- $OpenSSL::safe::installdata::PREFIX[0] -} +exec_prefix=${prefix} +libdir={- if (defined $OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0]) { + my $x = ''; + $x = '/' . $OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0] + if $OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0]; + '${exec_prefix}' . $x; + } else { + $OpenSSL::safe::installdata::libdir[0]; + } -} +includedir={- $OUT = ''; + $OUT .= '${prefix}/' . $_ . ' ' + foreach (@OpenSSL::safe::installdata::INCLUDEDIR_REL_PREFIX); -} +enginesdir=${libdir}/{- $OpenSSL::safe::installdata::ENGINESDIR_REL_LIBDIR[0] -} +modulesdir=${libdir}/{- $OpenSSL::safe::installdata::MODULESDIR_REL_LIBDIR[0] -} Name: OpenSSL-libcrypto Description: OpenSSL cryptography library Version: {- $OpenSSL::safe::installdata::VERSION -} Libs: -L${libdir} -lcrypto Libs.private: {- join(' ', @OpenSSL::safe::installdata::LDLIBS) -} -Cflags: -I${includedir} +Cflags:{- $OUT = ' -I${includedir}'; + if (scalar @OpenSSL::safe::installdata::INCLUDEDIR_REL_PREFIX > 1) { + $OUT = ''; + $OUT .= ' -I${prefix}/' . $_ . ' ' + foreach (@OpenSSL::safe::installdata::INCLUDEDIR_REL_PREFIX); + } -} diff --git a/openssl/exporters/pkg-config/libssl.pc.in b/openssl/exporters/pkg-config/libssl.pc.in index a7828b3cc..162db65c9 100644 --- a/openssl/exporters/pkg-config/libssl.pc.in +++ b/openssl/exporters/pkg-config/libssl.pc.in @@ -1,9 +1,25 @@ -libdir={- $OpenSSL::safe::installdata::LIBDIR -} -includedir={- $OpenSSL::safe::installdata::INCLUDEDIR -} +prefix={- $OpenSSL::safe::installdata::PREFIX[0] -} +exec_prefix=${prefix} +libdir={- if (defined $OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0]) { + my $x = ''; + $x = '/' . $OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0] + if $OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0]; + '${exec_prefix}' . $x; + } else { + $OpenSSL::safe::installdata::libdir[0]; + } -} +includedir={- $OUT = ''; + $OUT .= '${prefix}/' . $_ . ' ' + foreach (@OpenSSL::safe::installdata::INCLUDEDIR_REL_PREFIX); -} Name: OpenSSL-libssl Description: Secure Sockets Layer and cryptography libraries Version: {- $OpenSSL::safe::installdata::VERSION -} Requires.private: libcrypto Libs: -L${libdir} -lssl -Cflags: -I${includedir} +Cflags:{- $OUT = ' -I${includedir}'; + if (scalar @OpenSSL::safe::installdata::INCLUDEDIR_REL_PREFIX > 1) { + $OUT = ''; + $OUT .= ' -I${prefix}/' . $_ . ' ' + foreach (@OpenSSL::safe::installdata::INCLUDEDIR_REL_PREFIX); + } -} diff --git a/openssl/exporters/pkg-config/openssl.pc.in b/openssl/exporters/pkg-config/openssl.pc.in index dbb77aa39..73eb8e73c 100644 --- a/openssl/exporters/pkg-config/openssl.pc.in +++ b/openssl/exporters/pkg-config/openssl.pc.in @@ -1,5 +1,16 @@ -libdir={- $OpenSSL::safe::installdata::LIBDIR -} -includedir={- $OpenSSL::safe::installdata::INCLUDEDIR -} +prefix={- $OpenSSL::safe::installdata::PREFIX[0] -} +exec_prefix=${prefix} +libdir={- if (defined $OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0]) { + my $x = ''; + $x = '/' . $OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0] + if $OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0]; + '${exec_prefix}' . $x; + } else { + $OpenSSL::safe::installdata::libdir[0]; + } -} +includedir={- $OUT = ''; + $OUT .= '${prefix}/' . $_ . ' ' + foreach (@OpenSSL::safe::installdata::INCLUDEDIR_REL_PREFIX); -} Name: OpenSSL Description: Secure Sockets Layer and cryptography libraries and tools diff --git a/openssl/fuzz/bignum.c b/openssl/fuzz/bignum.c index d7c3716aa..08da6fb19 100644 --- a/openssl/fuzz/bignum.c +++ b/openssl/fuzz/bignum.c @@ -1,5 +1,5 @@ /* - * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,11 +52,12 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len) */ if (len > 2) { len -= 3; - l1 = (buf[0] * len) / 255; + /* limit l1, l2, and l3 to be no more than 512 bytes */ + l1 = ((buf[0] * len) / 255) % 512; ++buf; - l2 = (buf[0] * (len - l1)) / 255; + l2 = ((buf[0] * (len - l1)) / 255) % 512; ++buf; - l3 = len - l1 - l2; + l3 = (len - l1 - l2) % 512; s1 = buf[0] & 1; s3 = buf[0] & 4; diff --git a/openssl/fuzz/decoder.c b/openssl/fuzz/decoder.c index 7b53fe61a..6d8ddbe64 100644 --- a/openssl/fuzz/decoder.c +++ b/openssl/fuzz/decoder.c @@ -69,12 +69,12 @@ int FuzzerTestOneInput(const uint8_t *buf, size_t len) * Skip it. */ if ((!EVP_PKEY_is_a(pkey, "DH") && !EVP_PKEY_is_a(pkey, "DHX")) - || EVP_PKEY_get_bits(pkey) <= 8192) + || EVP_PKEY_get_bits(pkey) <= 2048) EVP_PKEY_param_check(ctx); EVP_PKEY_public_check(ctx); /* Private and pairwise checks are unbounded, skip for large keys. */ - if (EVP_PKEY_get_bits(pkey) <= 16384) { + if (EVP_PKEY_get_bits(pkey) <= 4096) { EVP_PKEY_private_check(ctx); EVP_PKEY_pairwise_check(ctx); } diff --git a/openssl/include/crypto/aes_platform.h b/openssl/include/crypto/aes_platform.h index 20c53a89b..80eb1796d 100644 --- a/openssl/include/crypto/aes_platform.h +++ b/openssl/include/crypto/aes_platform.h @@ -67,7 +67,7 @@ void AES_xts_decrypt(const unsigned char *inp, unsigned char *out, size_t len, # ifdef VPAES_ASM # define VPAES_CAPABLE (OPENSSL_ppccap_P & PPC_ALTIVEC) # endif -# if !defined(OPENSSL_SYS_AIX) && !defined(OPENSSL_SYS_MACOSX) && !defined(OPENSSL_SYS_AMIGA) +# if !defined(OPENSSL_SYS_MACOSX) && !defined(OPENSSL_SYS_AMIGA) # define HWAES_CAPABLE (OPENSSL_ppccap_P & PPC_CRYPTO207) # define HWAES_set_encrypt_key aes_p8_set_encrypt_key # define HWAES_set_decrypt_key aes_p8_set_decrypt_key @@ -77,6 +77,8 @@ void AES_xts_decrypt(const unsigned char *inp, unsigned char *out, size_t len, # define HWAES_ctr32_encrypt_blocks aes_p8_ctr32_encrypt_blocks # define HWAES_xts_encrypt aes_p8_xts_encrypt # define HWAES_xts_decrypt aes_p8_xts_decrypt +# endif /* OPENSSL_SYS_MACOSX */ +# if !defined(OPENSSL_SYS_AIX) && !defined(OPENSSL_SYS_MACOSX) # define PPC_AES_GCM_CAPABLE (OPENSSL_ppccap_P & PPC_MADD300) # define AES_GCM_ENC_BYTES 128 # define AES_GCM_DEC_BYTES 128 diff --git a/openssl/include/crypto/bn.h b/openssl/include/crypto/bn.h index 216bd6cbb..555834301 100644 --- a/openssl/include/crypto/bn.h +++ b/openssl/include/crypto/bn.h @@ -90,7 +90,7 @@ int bn_rshift_fixed_top(BIGNUM *r, const BIGNUM *a, int n); int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx); int ossl_bn_mask_bits_fixed_top(BIGNUM *a, int n); -int ossl_bn_is_word_fixed_top(const BIGNUM *a, BN_ULONG w); +int ossl_bn_is_word_fixed_top(const BIGNUM *a, const BN_ULONG w); int ossl_bn_priv_rand_range_fixed_top(BIGNUM *r, const BIGNUM *range, unsigned int strength, BN_CTX *ctx); int ossl_bn_gen_dsa_nonce_fixed_top(BIGNUM *out, const BIGNUM *range, diff --git a/openssl/include/crypto/sm4_platform.h b/openssl/include/crypto/sm4_platform.h index 928dc17ff..3df1b4256 100644 --- a/openssl/include/crypto/sm4_platform.h +++ b/openssl/include/crypto/sm4_platform.h @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2022-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -38,7 +38,7 @@ static inline int vpsm4_ex_capable(void) # define HWSM4_cbc_encrypt sm4_v8_cbc_encrypt # define HWSM4_ecb_encrypt sm4_v8_ecb_encrypt # define HWSM4_ctr32_encrypt_blocks sm4_v8_ctr32_encrypt_blocks -# elif defined(__riscv) && __riscv_xlen == 64 +# elif defined(OPENSSL_CPUID_OBJ) && defined(__riscv) && __riscv_xlen == 64 /* RV64 support */ # include "riscv_arch.h" /* Zvksed extension (vector crypto SM4). */ diff --git a/openssl/include/internal/cryptlib.h b/openssl/include/internal/cryptlib.h index 621369661..559eaa9f2 100644 --- a/openssl/include/internal/cryptlib.h +++ b/openssl/include/internal/cryptlib.h @@ -1,5 +1,5 @@ /* - * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -134,6 +134,7 @@ void ossl_lib_ctx_default_deinit(void); OSSL_EX_DATA_GLOBAL *ossl_lib_ctx_get_ex_data_global(OSSL_LIB_CTX *ctx); const char *ossl_lib_ctx_get_descriptor(OSSL_LIB_CTX *libctx); +CRYPTO_THREAD_LOCAL *ossl_lib_ctx_get_rcukey(OSSL_LIB_CTX *libctx); OSSL_LIB_CTX *ossl_crypto_ex_data_get_ossl_lib_ctx(const CRYPTO_EX_DATA *ad); int ossl_crypto_new_ex_data_ex(OSSL_LIB_CTX *ctx, int class_index, void *obj, diff --git a/openssl/include/internal/rcu.h b/openssl/include/internal/rcu.h index aee2f4c29..674d2f0c9 100644 --- a/openssl/include/internal/rcu.h +++ b/openssl/include/internal/rcu.h @@ -13,11 +13,13 @@ # pragma once # endif +#include "crypto/context.h" + typedef void (*rcu_cb_fn)(void *data); typedef struct rcu_lock_st CRYPTO_RCU_LOCK; -CRYPTO_RCU_LOCK *ossl_rcu_lock_new(int num_writers); +CRYPTO_RCU_LOCK *ossl_rcu_lock_new(int num_writers, OSSL_LIB_CTX *ctx); void ossl_rcu_lock_free(CRYPTO_RCU_LOCK *lock); void ossl_rcu_read_lock(CRYPTO_RCU_LOCK *lock); void ossl_rcu_write_lock(CRYPTO_RCU_LOCK *lock); diff --git a/openssl/include/openssl/tls1.h b/openssl/include/openssl/tls1.h index 7e3d1a725..5329338ef 100644 --- a/openssl/include/openssl/tls1.h +++ b/openssl/include/openssl/tls1.h @@ -1,5 +1,5 @@ /* - * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved. * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved * Copyright 2005 Nokia. All rights reserved. * @@ -231,6 +231,8 @@ extern "C" { # define TLSEXT_max_fragment_length_1024 2 # define TLSEXT_max_fragment_length_2048 3 # define TLSEXT_max_fragment_length_4096 4 +/* OpenSSL value for unset maximum fragment length extension */ +# define TLSEXT_max_fragment_length_UNSPECIFIED 255 /* * TLS Certificate Type (for RFC7250) diff --git a/openssl/krb5 b/openssl/krb5 index aa9b4a2a6..784c38f50 160000 --- a/openssl/krb5 +++ b/openssl/krb5 @@ -1 +1 @@ -Subproject commit aa9b4a2a64046afd2fab7cb49c346295874a5fb6 +Subproject commit 784c38f50e70a739400cdd3f2620bac2e2788e6c diff --git a/openssl/providers/fips-sources.checksums b/openssl/providers/fips-sources.checksums index 378f88373..c707a404d 100644 --- a/openssl/providers/fips-sources.checksums +++ b/openssl/providers/fips-sources.checksums @@ -116,7 +116,7 @@ c4d64da1cdc732ea918fccd6a7bb2746b03365dd26f7ba1e74e08c307ca4c58e crypto/bn/rsaz 82117f6a7cfc31fc86ecd9629bd3bf614126b8e8b2c23717a03ff5c1db7c3c5c crypto/buffer/buffer.c d2bfdfd96b182741d2d51f91478ffcc48491b0da44662bc1c32bc506b3eef1ba crypto/c64xpluscpuid.pl ad82132a10f0d4e13672ebed29fc40905717fd83716d1feb7d9b8d86a2192fb6 crypto/cmac/cmac.c -a6e8cf30340ffaec8aec41dfbef7341afe21e7b13e48899403c529368c0ec6fa crypto/context.c +d46e0b730115110a1022ebdcedaef4ecc2a58ae122d86b306712a9417bf1bd81 crypto/context.c 67c2367871b9350a7f7af5be903d6bcca9ebdbff0e9a9bd9f61b56bef5b76696 crypto/core_algorithm.c f0fd9eb38bf7f196bbb4d26ce8fdf86d0a4f9db219157e66b2c0ffefb4f42005 crypto/core_fetch.c 2f03908edadddc55a61e4cfb4d76751a342f61aad564971df37a6b90c7b2a26f crypto/core_namemap.c @@ -189,7 +189,7 @@ eb2f08624819f5d5d865b954a1123a833bc18e9024980f5701125f230e6406b1 crypto/ec/ec_l 5ad8b7c52f91416c5e93b96e1d19f6c0ba1bb8f99d1e382ac43025e8d060a278 crypto/ec/ec_oct.c c7fba2f2c33f67dafa23caef8c3abd12f5336274a9a07d412b83be0366969ee6 crypto/ec/ecdh_kdf.c b86a943ae62145438a7214539ceb3e0de5a30e17a6e59742c6e30991db730ab6 crypto/ec/ecdh_ossl.c -044498db64540441853378f41a48c8fd577159a026ded1e9cedfe6103b7d9b2b crypto/ec/ecdsa_ossl.c +04d29e0b631904012e7c3bd4c908c01159a0bf9731ac84f416fc827fe348e3ee crypto/ec/ecdsa_ossl.c b6baa42b16e8df69a12e0ab101033100cddc808ec2682ba1574373e6ec86ae93 crypto/ec/ecdsa_sign.c f686cea8c8a3259d95c1e6142813d9da47b6d624c62f26c7e4a16d5607cddb35 crypto/ec/ecdsa_vrf.c 141cfc1459214555b623517a054a9e8d5e4065a11301237b7247be2c6f397a0a crypto/ec/ecp_mont.c @@ -202,7 +202,7 @@ b19d2ffc6a21405c125e7831a9c1385acad8eea283f52c6b57ac6c8728233ccf crypto/ec/ecp_ 72caa2b7d2a54165fb35fea5ec7f5f230a3e9746fa71d56cb345e809bfdaf0a0 crypto/ec/ecx_key.c 64d0ed4018f874f6f88f60eea7b8cc093ebd2495172132603f759445d0bf0edc crypto/evp/asymcipher.c 0e75a058dcbbb62cfe39fec6c4a85385dc1a8fce794e4278ce6cebb29763b82b crypto/evp/dh_support.c -1ed084298bcd1d79cfb6e49a92d06fb8e41fd835752ea79f89b6adeae0735583 crypto/evp/digest.c +8808a1f9caa06279e36e8e7b24fde97f64a4bc353c96248467a87b87a04fca6e crypto/evp/digest.c 838277f228cd3025cf95a9cd435e5606ad1fb5d207bbb057aa29892e6a657c55 crypto/evp/ec_support.c 2a24523f7aece1a4a32919fad7d2ba3beabe7b12c80c27ccd08ea642c5e0ff32 crypto/evp/evp_enc.c 7267c75b7d96f7adb85b4b18734dd5d19e59c80b1f96b2e3e4ce112af7763c5b crypto/evp/evp_fetch.c @@ -270,7 +270,7 @@ bdf25257b15eca206be4d950d2dd807ca5f058f91f54edbd7a0d312ed83eef8e crypto/modes/o e55a816c356b2d526bc6e40c8b81afa02576e4d44c7d7b6bbe444fb8b01aad41 crypto/modes/wrap128.c 608a04f387be2a509b4d4ad414b7015ab833e56b85020e692e193160f36883a2 crypto/modes/xts128.c fb874ea18e9754dde11ef1c2993818074ff7cd8a74a981598745f7e11317bb91 crypto/modes/xts128gb.c -35f5b7b015768104645257c19a3f93362684c00002381ce000e0a8b9afd385c1 crypto/o_str.c +28f3e418a5b64dc1e2860019155d7a1f275e78eae330b5ca7d909e860d63bac8 crypto/o_str.c b0decda3aae1d3e07cf3cbe9153cdde9deafe65fae346cd208951b4d7dec512e crypto/packet.c 05563d44cb345e7859093296f95a3ea5139fcc316e98fcb86c6748ee49363a84 crypto/param_build.c cae7bd4973d36edbdc3bdd8d2c8d157f2c4fcfae00fdf821b67aebb789bc8aa6 crypto/param_build_set.c @@ -281,7 +281,7 @@ e3cc1fcbf42ed19a38fb0f84cb41795c94438768f36fda6f371d1f17d7b45740 crypto/params_ c27b8c1659274be74e2d6e9fd76980df499d1331c0c2d51f41b3ad547ba88d59 crypto/ppccap.c b650e7e96b8faad750842b86905032db51e17880958bb8d9826d02ca8eb60642 crypto/ppccpuid.pl 467c416422ecf61e3b713c5eb259fdbcb4aa73ae8dee61804d0b85cfd3fff4f7 crypto/property/defn_cache.c -289f8d0569123201d700934663fabf7215079731a4ea2f5db7944a6cb80d9868 crypto/property/property.c +d48ce9b38720b4d0b118b83322c3344afd11a5ce6b31adf59c6584b5e02e3f6a crypto/property/property.c 66da4f28d408133fb544b14aeb9ad4913e7c5c67e2826e53f0dc5bf4d8fada26 crypto/property/property_local.h 0a84d66734df7515a6de2b8da744a398f11b977f8479076090e67357fa0eb51d crypto/property/property_parse.c a7cefda6a117550e2c76e0f307565ce1e11640b11ba10c80e469a837fd1212a3 crypto/property/property_query.c @@ -304,7 +304,7 @@ deb8257e5ba1e3cdd46e9289b3be671b31e3744a26a9e37bc77aead5de9f7b50 crypto/rsa/rsa 5ae8edaf654645996385fbd420ef73030762fc146bf41deb5294d6d83e257a16 crypto/rsa/rsa_local.h cf0b75cd54b61b9b9a290ef18d0ddce9fb26a029a54eb3f720d9b25188440f00 crypto/rsa/rsa_mp_names.c 5c60f6e05db82e13178d805deb1947b8eee4a905e6e77523d3b288da70a46bb5 crypto/rsa/rsa_none.c -d0538475c5ebd2b2c585dc33fdcfb9a7a2f59f623b7ab0f8a09344a439082dfc crypto/rsa/rsa_oaep.c +59fca779f9a9d68d40582654ab264000ef1abaf2fbad96424448f8c22db0f2e0 crypto/rsa/rsa_oaep.c 6adc9202558e531f4d78c75920882e916be27395dca386044a91adae5b331c64 crypto/rsa/rsa_ossl.c 54446a41065d85d22ed521285196bf285427a071d32d00d070b2248723c2a914 crypto/rsa/rsa_pk1.c cdf66a4964152e16b7da5b6631f31bd2d90bf730b5a46c2622d5279abdecabe1 crypto/rsa/rsa_pss.c @@ -377,16 +377,16 @@ e298c753be277ad9a2ac0132d9897cb4c85607dbb2d11cfefd0c98e0f6a723d9 crypto/thread/ a00e16963e1e2a0126c6a8e62da8a14f98de9736027654c925925dadd0ca3cc1 crypto/thread/arch/thread_win.c 27ec0090f4243c96e4fbe1babfd4320c2a16615ffa368275433217d50a1ef76c crypto/thread/internal.c 67ba8d87fbbb7c9a9e438018e7ecfd1cedd4d00224be05755580d044f5f1317a crypto/threads_lib.c -fd7dad0337c829d419828d57dae1ed4d9996d32ff36cfb2d3c132d957e71fe4e crypto/threads_none.c -05a99678f2ad8ca4ecd95c236947a903d9551b539e710597300147d26a973757 crypto/threads_pthread.c -ad427bf58b0f7bcd3122a3feda34c0a1858172f55a3b3822a4612d2aee2f23e2 crypto/threads_win.c +245ebf04d6814f020b2cf0922e1083704d736d4788998e2d17b0e26a8098a7bf crypto/threads_none.c +6f6916daa171f96c513aca4965b6f94cd2009310a6edbee876475e8c7a99197b crypto/threads_pthread.c +90d223ad2c0cb3c756ac11758c9e3873e77ae862fc9f6cf4101d044587074345 crypto/threads_win.c 8b45f948303045d8f753858b1b892e3da13bebe1bdac500db91fbb54a0ac07da crypto/time.c af0af59fe2cb8668a96751f343232d7faa3e7a937beb2bda09ed74fe60b9cb5f crypto/x86_64cpuid.pl bbec287bb9bf35379885f8f8998b7fd9e8fc22efee9e1b299109af0f33a7ee16 crypto/x86cpuid.pl -8b40a5facb17a55e892d4d09ec64c8b184a226941338b5108cf53a6628cebcd1 include/crypto/aes_platform.h +56912aa7bfb1aba71fdb5b590a60593d604ddec007fd7820cdf176ec07d2694d include/crypto/aes_platform.h 68f6c521b1dbfacb99d75cb1ffdbcd1795d6e0157df69c6c6a7c04f85ea715ec include/crypto/asn1.h 8c6f308c1ca774e6127e325c3b80511dbcdc99631f032694d8db53a5c02364ee include/crypto/asn1_dsa.h -f732c649f10b8f7d18f31ae81c5047ac366bdfc5b870e8f7afe02ac6478b23da include/crypto/bn.h +bb5c7bfddfa81db40a8b078cbb9eff9ca6c3767232489accbaa5dc0c9a203f2f include/crypto/bn.h 1c46818354d42bd1b1c4e5fdae9e019814936e775fd8c918ca49959c2a6416df include/crypto/bn_conf.h.in 7a43a4898fcc8446065e6c99249bcc14e475716e8c1d40d50408c0ab179520e6 include/crypto/bn_dh.h a6957475e4c7ae80c06537c3fd3b63f2368b664da54a96befd0a6fa38de27b4a include/crypto/context.h @@ -413,7 +413,7 @@ cb59783c25ffecb35aaff5548f5d97a26ad463ae491eb3932adb512626f85681 include/crypto 53ec45b4f165adf271b528fc08da0832e2f82d9e13a338cc3ad78e925147c7cc include/internal/common.h 8e984890c7c62cdd6356963f034831831f7167c65096cb4d23bc765d84d2c598 include/internal/constant_time.h c5bb97f654984130c8b44c09a52395bce0b22985d5dbc9c4d9377d86283f11f8 include/internal/core.h -424b502d52e7b12877be283628001bc699d221ab4da7007d5123f7e2f3eac9de include/internal/cryptlib.h +36e5c3ea8e285d0df80a136d26c05df0de521c017ba0e50873e3bcfdb612bd99 include/internal/cryptlib.h 9571cfd3d5666749084b354a6d65adee443deeb5713a58c098c7b03bc69dbc63 include/internal/deprecated.h dc5afb955d810feb5af9f8d25cd8a92118abef320fee95c07b04f301c4e0d96c include/internal/der.h 8059e715f981fbe02b5731610ed24bb6ae617a55e90b03f4260cbb6ccd71e8de include/internal/deterministic_nonce.h @@ -432,7 +432,7 @@ f42d4a6108a18ade3eb99682c072adf83889b6ba3fc80ee3e20929ed8d0f7137 include/intern d4ac19b28ea61f03383364cfad1e941cac44fc36787d80882c5b76ecc9d34e29 include/internal/property.h 727326afb3d33fdffdf26471e313f27892708318c0934089369e4b28267e2635 include/internal/propertyerr.h 811eff73f789e535530cf23ea6037d4da6cde53398e0e7063e60c68b8923a9b5 include/internal/provider.h -42ce0f28fc5e03dd1a243e567b00ac60265a0ec76568b53cbc48503e8780d068 include/internal/rcu.h +95d21e761402fcbf1d3bdb261e425316b07d2790dd190e4eeaa1e21e40ff9a59 include/internal/rcu.h 6771d6b154f3979903c4e53c0249bc0e709ce698966761bc60081428270eafa5 include/internal/refcount.h 5f48b2caa1986f85fc31d1f96621684736c27964291b3718dd35f3a15534fa99 include/internal/safe_math.h c422f38eca312a2f97a0cc91891185a14f812247dfea8abd66f68540870b0429 include/internal/sha3.h @@ -551,7 +551,7 @@ abd5997bc33b681a4ab275978b92aebca0806a4a3f0c2f41dacf11b3b6f4e101 providers/fips 029fad3c27617c725e516621c2f6c3a0e1dca0fa22f4e89a1a6b9a977c8d935d providers/fips/self_test.c f822a03138e8b83ccaa910b89d72f31691da6778bf6638181f993ec7ae1167e3 providers/fips/self_test.h 09362a49fda902e2d29617cad7296b11b9d372fc925c6114196a1ffe3ee81b33 providers/fips/self_test_data.inc -5b6d8dbc1365974eb9a5d417b2276d40fa7b9e733bb224200d20a61b4b025973 providers/fips/self_test_kats.c +47b5e2649e7b37178c2c6236c8503bf87fabfe2b7cc5ecee69a5ed4780decb92 providers/fips/self_test_kats.c 9088379971217bcdc3d599a5b253f5c6d1d2f420f0486e3e279c70156ba995ba providers/implementations/asymciphers/rsa_enc.c c2f1b12c64fc369dfc3b9bc9e76a76de7280e6429adaee55d332eb1971ad1879 providers/implementations/ciphers/cipher_aes.c 6ba7d817081cf0d87ba7bfb38cd9d70e41505480bb8bc796ef896f68d4514ea6 providers/implementations/ciphers/cipher_aes.h @@ -613,7 +613,7 @@ a6879c2e107597c49efa07fae48f0554ffbea9814c31d186bf0ce9f83e1ec9d2 providers/impl 27e57358e8ad201e382b50d5760f010badd9d6253deb34e6fb93a2af35450d9a providers/implementations/include/prov/names.h b9f8781167f274ccd8b643b3bb6c4e1108fb27b2aae588518261af9415228dae providers/implementations/include/prov/seeding.h 266d76cd7ed2103dc031358e04e30c2f0ecf54af70c2d16b29307b3cb9968991 providers/implementations/kdfs/hkdf.c -0d0c153bbb7234a98cd95fb802bed6bfc00a6002dd61a7fe77a44433a3cd9181 providers/implementations/kdfs/kbkdf.c +ba0523cf3f664568f591c888a737a8ea008652e767d2239e998fdcfc7e3b99d4 providers/implementations/kdfs/kbkdf.c 03b3dffd32a2b8f94e7d39b97f3d7b36f00cd0177ee5e7329a39aeca20ed4baf providers/implementations/kdfs/pbkdf2.c c0778565abff112c0c5257329a7750ec4605e62f26cc36851fa1fbee6e03c70c providers/implementations/kdfs/pbkdf2.h abe2b0f3711eaa34846e155cffc9242e4051c45de896f747afd5ac9d87f637dc providers/implementations/kdfs/pbkdf2_fips.c @@ -645,6 +645,6 @@ a9aa31d091df5b8f6710dd36761dfe7d32b6da1881f8581bed85ad4e171b0969 providers/impl 6c8b5f325c997014bd71331c9eb6c185838cd81c10c3ad74dd65289ae923d629 providers/implementations/signature/ecdsa_sig.c d9d4bbbb0af0d1db6f586a36fd63236e4becdd52468a1e6510994e80988400aa providers/implementations/signature/eddsa_sig.c e0e67e402ff19b0d2eb5228d7ebd70b9477c12595ac34d6f201373d7c8a516f4 providers/implementations/signature/mac_legacy_sig.c -5615954440a004ed3132c8830f9c9c76d7f7869f06b31b7c473ff5d34b3ac5c8 providers/implementations/signature/rsa_sig.c +90c6ecba4a453b9af73844a25da30637f84f904bb27adc20d5cb3afb89262fa2 providers/implementations/signature/rsa_sig.c 0b73a04f8a03106e2a0fea10978f9888158046c29c3993ca6557f5a6403d5580 ssl/record/methods/ssl3_cbc.c a8914c1661c53bcb0f435ec280c35c5a135e6c71296554c7322186847e194683 ssl/record/methods/tls_pad.c diff --git a/openssl/providers/fips.checksum b/openssl/providers/fips.checksum index 491fd596c..d67ac669b 100644 --- a/openssl/providers/fips.checksum +++ b/openssl/providers/fips.checksum @@ -1 +1 @@ -157348648f3541d2ada9758e405c6a7929e9e8cf3e02e2643d390a14c02b0c6f providers/fips-sources.checksums +5338618ba25c4ff24729fbc475683fa5e9e44fd0910fc3d7b913a5b931d4f2eb providers/fips-sources.checksums diff --git a/openssl/providers/fips/self_test_kats.c b/openssl/providers/fips/self_test_kats.c index f13c41abd..856b367e4 100644 --- a/openssl/providers/fips/self_test_kats.c +++ b/openssl/providers/fips/self_test_kats.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -858,8 +858,12 @@ int SELF_TEST_kats(OSSL_SELF_TEST *st, OSSL_LIB_CTX *libctx) EVP_RAND_CTX *saved_rand = ossl_rand_get0_private_noncreating(libctx); int ret = 1; + if (saved_rand != NULL && !EVP_RAND_CTX_up_ref(saved_rand)) + return 0; if (!setup_main_random(libctx) || !RAND_set0_private(libctx, main_rand)) { + /* Decrement saved_rand reference counter */ + EVP_RAND_CTX_free(saved_rand); EVP_RAND_CTX_free(main_rand); return 0; } diff --git a/openssl/providers/implementations/ciphers/cipher_sm4_ccm_hw.c b/openssl/providers/implementations/ciphers/cipher_sm4_ccm_hw.c index 34f0e751e..1c1d60494 100644 --- a/openssl/providers/implementations/ciphers/cipher_sm4_ccm_hw.c +++ b/openssl/providers/implementations/ciphers/cipher_sm4_ccm_hw.c @@ -1,5 +1,5 @@ /* - * Copyright 2021-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -59,7 +59,7 @@ static const PROV_CCM_HW ccm_sm4 = { ossl_ccm_generic_gettag }; -#if defined(__riscv) && __riscv_xlen == 64 +#if defined(OPENSSL_CPUID_OBJ) && defined(__riscv) && __riscv_xlen == 64 # include "cipher_sm4_ccm_hw_rv64i.inc" #else const PROV_CCM_HW *ossl_prov_sm4_hw_ccm(size_t keybits) diff --git a/openssl/providers/implementations/ciphers/cipher_sm4_gcm_hw.c b/openssl/providers/implementations/ciphers/cipher_sm4_gcm_hw.c index 06ca45078..c1e354be4 100644 --- a/openssl/providers/implementations/ciphers/cipher_sm4_gcm_hw.c +++ b/openssl/providers/implementations/ciphers/cipher_sm4_gcm_hw.c @@ -1,5 +1,5 @@ /* - * Copyright 2021-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -89,7 +89,7 @@ static const PROV_GCM_HW sm4_gcm = { ossl_gcm_one_shot }; -#if defined(__riscv) && __riscv_xlen == 64 +#if defined(OPENSSL_CPUID_OBJ) && defined(__riscv) && __riscv_xlen == 64 # include "cipher_sm4_gcm_hw_rv64i.inc" #else const PROV_GCM_HW *ossl_prov_sm4_hw_gcm(size_t keybits) diff --git a/openssl/providers/implementations/ciphers/cipher_sm4_hw.c b/openssl/providers/implementations/ciphers/cipher_sm4_hw.c index c4f2f97cc..05a83843e 100644 --- a/openssl/providers/implementations/ciphers/cipher_sm4_hw.c +++ b/openssl/providers/implementations/ciphers/cipher_sm4_hw.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -134,7 +134,7 @@ const PROV_CIPHER_HW *ossl_prov_cipher_hw_sm4_##mode(size_t keybits) \ return &sm4_##mode; \ } -#if defined(__riscv) && __riscv_xlen == 64 +#if defined(OPENSSL_CPUID_OBJ) && defined(__riscv) && __riscv_xlen == 64 # include "cipher_sm4_hw_rv64i.inc" #else /* The generic case */ diff --git a/openssl/providers/implementations/ciphers/cipher_sm4_xts_hw.c b/openssl/providers/implementations/ciphers/cipher_sm4_xts_hw.c index 6cf58e851..d147cf1a6 100644 --- a/openssl/providers/implementations/ciphers/cipher_sm4_xts_hw.c +++ b/openssl/providers/implementations/ciphers/cipher_sm4_xts_hw.c @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2022-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -89,7 +89,7 @@ static const PROV_CIPHER_HW sm4_generic_xts = { cipher_hw_sm4_xts_copyctx }; -#if defined(__riscv) && __riscv_xlen == 64 +#if defined(OPENSSL_CPUID_OBJ) && defined(__riscv) && __riscv_xlen == 64 # include "cipher_sm4_xts_hw_rv64i.inc" #else const PROV_CIPHER_HW *ossl_prov_cipher_hw_sm4_xts(size_t keybits) diff --git a/openssl/providers/implementations/encode_decode/decode_der2key.c b/openssl/providers/implementations/encode_decode/decode_der2key.c index b0d4e0ecf..ee66ab02a 100644 --- a/openssl/providers/implementations/encode_decode/decode_der2key.c +++ b/openssl/providers/implementations/encode_decode/decode_der2key.c @@ -1,5 +1,5 @@ /* - * Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -32,6 +32,7 @@ #include "crypto/ecx.h" #include "crypto/rsa.h" #include "crypto/x509.h" +#include "openssl/obj_mac.h" #include "prov/bio.h" #include "prov/implementations.h" #include "endecoder_local.h" @@ -109,7 +110,10 @@ static void *der2key_decode_p8(const unsigned char **input_der, if ((p8inf = d2i_PKCS8_PRIV_KEY_INFO(NULL, input_der, input_der_len)) != NULL && PKCS8_pkey_get0(NULL, NULL, NULL, &alg, p8inf) - && OBJ_obj2nid(alg->algorithm) == ctx->desc->evp_type) + && (OBJ_obj2nid(alg->algorithm) == ctx->desc->evp_type + /* Allow decoding sm2 private key with id_ecPublicKey */ + || (OBJ_obj2nid(alg->algorithm) == NID_X9_62_id_ecPublicKey + && ctx->desc->evp_type == NID_sm2))) key = key_from_pkcs8(p8inf, PROV_LIBCTX_OF(ctx->provctx), ctx->propq); PKCS8_PRIV_KEY_INFO_free(p8inf); @@ -312,10 +316,19 @@ static int der2key_decode(void *vctx, OSSL_CORE_BIO *cin, int selection, params[0] = OSSL_PARAM_construct_int(OSSL_OBJECT_PARAM_TYPE, &object_type); - params[1] = - OSSL_PARAM_construct_utf8_string(OSSL_OBJECT_PARAM_DATA_TYPE, - (char *)ctx->desc->keytype_name, - 0); + +#ifndef OPENSSL_NO_SM2 + if (strcmp(ctx->desc->keytype_name, "EC") == 0 + && (EC_KEY_get_flags(key) & EC_FLAG_SM2_RANGE) != 0) + params[1] = + OSSL_PARAM_construct_utf8_string(OSSL_OBJECT_PARAM_DATA_TYPE, + "SM2", 0); + else +#endif + params[1] = + OSSL_PARAM_construct_utf8_string(OSSL_OBJECT_PARAM_DATA_TYPE, + (char *)ctx->desc->keytype_name, + 0); /* The address of the key becomes the octet string */ params[2] = OSSL_PARAM_construct_octet_string(OSSL_OBJECT_PARAM_REFERENCE, @@ -435,10 +448,16 @@ static void *ec_d2i_PKCS8(void **key, const unsigned char **der, long der_len, static int ec_check(void *key, struct der2key_ctx_st *ctx) { /* We're trying to be clever by comparing two truths */ - + int ret = 0; int sm2 = (EC_KEY_get_flags(key) & EC_FLAG_SM2_RANGE) != 0; - return sm2 == (ctx->desc->evp_type == EVP_PKEY_SM2); + if (sm2) + ret = ctx->desc->evp_type == EVP_PKEY_SM2 + || ctx->desc->evp_type == NID_X9_62_id_ecPublicKey; + else + ret = ctx->desc->evp_type != EVP_PKEY_SM2; + + return ret; } static void ec_adjust(void *key, struct der2key_ctx_st *ctx) diff --git a/openssl/providers/implementations/kdfs/kbkdf.c b/openssl/providers/implementations/kdfs/kbkdf.c index e6855d573..5d6ebdf39 100644 --- a/openssl/providers/implementations/kdfs/kbkdf.c +++ b/openssl/providers/implementations/kdfs/kbkdf.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. * Copyright 2019 Red Hat, Inc. * * Licensed under the Apache License 2.0 (the "License"). You may not use @@ -354,7 +354,8 @@ static int kbkdf_set_ctx_params(void *vctx, const OSSL_PARAM params[]) if (!ossl_prov_macctx_load_from_params(&ctx->ctx_init, params, NULL, NULL, NULL, libctx)) return 0; - else if (ctx->ctx_init != NULL) { + if (ctx->ctx_init != NULL) { + ctx->is_kmac = 0; if (EVP_MAC_is_a(EVP_MAC_CTX_get0_mac(ctx->ctx_init), OSSL_MAC_NAME_KMAC128) || EVP_MAC_is_a(EVP_MAC_CTX_get0_mac(ctx->ctx_init), diff --git a/openssl/providers/implementations/rands/drbg.c b/openssl/providers/implementations/rands/drbg.c index 46a056bc2..4d48a4844 100644 --- a/openssl/providers/implementations/rands/drbg.c +++ b/openssl/providers/implementations/rands/drbg.c @@ -202,6 +202,11 @@ static size_t get_entropy(PROV_DRBG *drbg, unsigned char **pout, int entropy, return ossl_crngt_get_entropy(drbg, pout, entropy, min_len, max_len, prediction_resistance); #else + /* + * In normal use (i.e. OpenSSL's own uses), this is never called. + * Outside of the FIPS provider, OpenSSL sets its DRBGs up so that + * they always have a parent. This remains purely for legacy reasons. + */ return ossl_prov_get_entropy(drbg->provctx, pout, entropy, min_len, max_len); #endif diff --git a/openssl/providers/implementations/signature/rsa_sig.c b/openssl/providers/implementations/signature/rsa_sig.c index 76db37dd0..f98fb61ce 100644 --- a/openssl/providers/implementations/signature/rsa_sig.c +++ b/openssl/providers/implementations/signature/rsa_sig.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -207,13 +207,29 @@ static int rsa_pss_compute_saltlen(PROV_RSA_CTX *ctx) * Provide a way to use at most the digest length, so that the default does * not violate FIPS 186-4. */ if (saltlen == RSA_PSS_SALTLEN_DIGEST) { - saltlen = EVP_MD_get_size(ctx->md); + if ((saltlen = EVP_MD_get_size(ctx->md)) <= 0) { + ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_DIGEST); + return -1; + } } else if (saltlen == RSA_PSS_SALTLEN_AUTO_DIGEST_MAX) { saltlen = RSA_PSS_SALTLEN_MAX; - saltlenMax = EVP_MD_get_size(ctx->md); + if ((saltlenMax = EVP_MD_get_size(ctx->md)) <= 0) { + ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_DIGEST); + return -1; + } } if (saltlen == RSA_PSS_SALTLEN_MAX || saltlen == RSA_PSS_SALTLEN_AUTO) { - saltlen = RSA_size(ctx->rsa) - EVP_MD_get_size(ctx->md) - 2; + int mdsize, rsasize; + + if ((mdsize = EVP_MD_get_size(ctx->md)) <= 0) { + ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_DIGEST); + return -1; + } + if ((rsasize = RSA_size(ctx->rsa)) <= 2 || rsasize - 2 < mdsize) { + ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY); + return -1; + } + saltlen = rsasize - mdsize - 2; if ((RSA_bits(ctx->rsa) & 0x7) == 1) saltlen--; if (saltlenMax >= 0 && saltlen > saltlenMax) diff --git a/openssl/ssl/bio_ssl.c b/openssl/ssl/bio_ssl.c index aabd047fe..ac65a3988 100644 --- a/openssl/ssl/bio_ssl.c +++ b/openssl/ssl/bio_ssl.c @@ -79,7 +79,7 @@ static int ssl_free(BIO *a) return 0; bs = BIO_get_data(a); if (BIO_get_shutdown(a)) { - if (bs->ssl != NULL) + if (bs->ssl != NULL && !SSL_in_init(bs->ssl)) SSL_shutdown(bs->ssl); if (BIO_get_init(a)) SSL_free(bs->ssl); diff --git a/openssl/ssl/quic/quic_impl.c b/openssl/ssl/quic/quic_impl.c index c77230a19..539d6d9b7 100644 --- a/openssl/ssl/quic/quic_impl.c +++ b/openssl/ssl/quic/quic_impl.c @@ -1065,7 +1065,8 @@ int ossl_quic_handle_events(SSL *s) return 0; quic_lock(ctx.qc); - ossl_quic_reactor_tick(ossl_quic_channel_get_reactor(ctx.qc->ch), 0); + if (ctx.qc->started) + ossl_quic_reactor_tick(ossl_quic_channel_get_reactor(ctx.qc->ch), 0); quic_unlock(ctx.qc); return 1; } @@ -1088,8 +1089,9 @@ int ossl_quic_get_event_timeout(SSL *s, struct timeval *tv, int *is_infinite) quic_lock(ctx.qc); - deadline - = ossl_quic_reactor_get_tick_deadline(ossl_quic_channel_get_reactor(ctx.qc->ch)); + if (ctx.qc->started) + deadline + = ossl_quic_reactor_get_tick_deadline(ossl_quic_channel_get_reactor(ctx.qc->ch)); if (ossl_time_is_infinite(deadline)) { *is_infinite = 1; @@ -2863,6 +2865,9 @@ static size_t ossl_quic_pending_int(const SSL *s, int check_channel) quic_lock(ctx.qc); + if (!ctx.qc->started) + goto out; + if (ctx.xso == NULL) { /* No XSO yet, but there might be a default XSO eligible to be created. */ if (qc_wait_for_default_xso_for_read(&ctx, /*peek=*/1)) { @@ -4096,6 +4101,13 @@ int ossl_quic_conn_poll_events(SSL *ssl, uint64_t events, int do_tick, quic_lock(ctx.qc); + if (!ctx.qc->started) { + /* We can only try to write on non-started connection. */ + if ((events & SSL_POLL_EVENT_W) != 0) + revents |= SSL_POLL_EVENT_W; + goto end; + } + if (do_tick) ossl_quic_reactor_tick(ossl_quic_channel_get_reactor(ctx.qc->ch), 0); @@ -4145,6 +4157,7 @@ int ossl_quic_conn_poll_events(SSL *ssl, uint64_t events, int do_tick, revents |= SSL_POLL_EVENT_OSU; } + end: quic_unlock(ctx.qc); *p_revents = revents; return 1; diff --git a/openssl/ssl/quic/quic_trace.c b/openssl/ssl/quic/quic_trace.c index 5a6d79bf4..9c433746f 100644 --- a/openssl/ssl/quic/quic_trace.c +++ b/openssl/ssl/quic/quic_trace.c @@ -1,5 +1,5 @@ /* - * Copyright 2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2023-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -79,20 +79,21 @@ static int frame_ack(BIO *bio, PACKET *pkt) OSSL_QUIC_ACK_RANGE *ack_ranges = NULL; uint64_t total_ranges = 0; uint64_t i; + int ret = 0; if (!ossl_quic_wire_peek_frame_ack_num_ranges(pkt, &total_ranges) /* In case sizeof(uint64_t) > sizeof(size_t) */ || total_ranges > SIZE_MAX / sizeof(ack_ranges[0]) || (ack_ranges = OPENSSL_zalloc(sizeof(ack_ranges[0]) * (size_t)total_ranges)) == NULL) - return 0; + return ret; ack.ack_ranges = ack_ranges; ack.num_ack_ranges = (size_t)total_ranges; /* Ack delay exponent is 0, so we can get the raw delay time below */ if (!ossl_quic_wire_decode_frame_ack(pkt, 0, &ack, NULL)) - return 0; + goto end; BIO_printf(bio, " Largest acked: %llu\n", (unsigned long long)ack.ack_ranges[0].end); @@ -112,8 +113,10 @@ static int frame_ack(BIO *bio, PACKET *pkt) - ack.ack_ranges[i].start)); } + ret = 1; +end: OPENSSL_free(ack_ranges); - return 1; + return ret; } static int frame_reset_stream(BIO *bio, PACKET *pkt) diff --git a/openssl/ssl/quic/quic_tserver.c b/openssl/ssl/quic/quic_tserver.c index b9de60aea..4f30eb14c 100644 --- a/openssl/ssl/quic/quic_tserver.c +++ b/openssl/ssl/quic/quic_tserver.c @@ -63,7 +63,7 @@ static int alpn_select_cb(SSL *ssl, const unsigned char **out, if (srv->args.alpn == NULL) { alpn = alpndeflt; - alpnlen = sizeof(alpn); + alpnlen = sizeof(alpndeflt); } else { alpn = srv->args.alpn; alpnlen = srv->args.alpnlen; diff --git a/openssl/ssl/ssl_lib.c b/openssl/ssl/ssl_lib.c index 984b03b7c..b2f61f7b7 100644 --- a/openssl/ssl/ssl_lib.c +++ b/openssl/ssl/ssl_lib.c @@ -3530,37 +3530,54 @@ int SSL_select_next_proto(unsigned char **out, unsigned char *outlen, unsigned int server_len, const unsigned char *client, unsigned int client_len) { - unsigned int i, j; - const unsigned char *result; - int status = OPENSSL_NPN_UNSUPPORTED; + PACKET cpkt, csubpkt, spkt, ssubpkt; + + if (!PACKET_buf_init(&cpkt, client, client_len) + || !PACKET_get_length_prefixed_1(&cpkt, &csubpkt) + || PACKET_remaining(&csubpkt) == 0) { + *out = NULL; + *outlen = 0; + return OPENSSL_NPN_NO_OVERLAP; + } + + /* + * Set the default opportunistic protocol. Will be overwritten if we find + * a match. + */ + *out = (unsigned char *)PACKET_data(&csubpkt); + *outlen = (unsigned char)PACKET_remaining(&csubpkt); /* * For each protocol in server preference order, see if we support it. */ - for (i = 0; i < server_len;) { - for (j = 0; j < client_len;) { - if (server[i] == client[j] && - memcmp(&server[i + 1], &client[j + 1], server[i]) == 0) { - /* We found a match */ - result = &server[i]; - status = OPENSSL_NPN_NEGOTIATED; - goto found; + if (PACKET_buf_init(&spkt, server, server_len)) { + while (PACKET_get_length_prefixed_1(&spkt, &ssubpkt)) { + if (PACKET_remaining(&ssubpkt) == 0) + continue; /* Invalid - ignore it */ + if (PACKET_buf_init(&cpkt, client, client_len)) { + while (PACKET_get_length_prefixed_1(&cpkt, &csubpkt)) { + if (PACKET_equal(&csubpkt, PACKET_data(&ssubpkt), + PACKET_remaining(&ssubpkt))) { + /* We found a match */ + *out = (unsigned char *)PACKET_data(&ssubpkt); + *outlen = (unsigned char)PACKET_remaining(&ssubpkt); + return OPENSSL_NPN_NEGOTIATED; + } + } + /* Ignore spurious trailing bytes in the client list */ + } else { + /* This should never happen */ + return OPENSSL_NPN_NO_OVERLAP; } - j += client[j]; - j++; } - i += server[i]; - i++; + /* Ignore spurious trailing bytes in the server list */ } - /* There's no overlap between our protocols and the server's list. */ - result = client; - status = OPENSSL_NPN_NO_OVERLAP; - - found: - *out = (unsigned char *)result + 1; - *outlen = result[0]; - return status; + /* + * There's no overlap between our protocols and the server's list. We use + * the default opportunistic protocol selected earlier + */ + return OPENSSL_NPN_NO_OVERLAP; } #ifndef OPENSSL_NO_NEXTPROTONEG diff --git a/openssl/ssl/ssl_local.h b/openssl/ssl/ssl_local.h index f448cfdbc..c5eb7bc39 100644 --- a/openssl/ssl/ssl_local.h +++ b/openssl/ssl/ssl_local.h @@ -532,7 +532,6 @@ struct ssl_session_st { * certificate is not ok, we must remember the error for session reuse: */ long verify_result; /* only for servers */ - CRYPTO_REF_COUNT references; OSSL_TIME timeout; OSSL_TIME time; OSSL_TIME calc_timeout; @@ -542,11 +541,6 @@ struct ssl_session_st { * load the 'cipher' structure */ unsigned int kex_group; /* TLS group from key exchange */ CRYPTO_EX_DATA ex_data; /* application specific data */ - /* - * These are used to make removal of session-ids more efficient and to - * implement a maximum cache size. - */ - struct ssl_session_st *prev, *next; struct { char *hostname; @@ -576,6 +570,13 @@ struct ssl_session_st { size_t ticket_appdata_len; uint32_t flags; SSL_CTX *owner; + + /* + * These are used to make removal of session-ids more efficient and to + * implement a maximum cache size. Access requires protection of ctx->lock. + */ + struct ssl_session_st *prev, *next; + CRYPTO_REF_COUNT references; }; /* Extended master secret support */ diff --git a/openssl/ssl/ssl_sess.c b/openssl/ssl/ssl_sess.c index 3857e027e..646cf1c52 100644 --- a/openssl/ssl/ssl_sess.c +++ b/openssl/ssl/ssl_sess.c @@ -109,6 +109,7 @@ SSL_SESSION *SSL_SESSION_new(void) if (ss == NULL) return NULL; + ss->ext.max_fragment_len_mode = TLSEXT_max_fragment_length_UNSPECIFIED; ss->verify_result = 1; /* avoid 0 (= X509_V_OK) just in case */ /* 5 minute timeout by default */ ss->timeout = ossl_seconds2time(60 * 5 + 4); @@ -138,7 +139,12 @@ static SSL_SESSION *ssl_session_dup_intern(const SSL_SESSION *src, int ticket) dest = OPENSSL_malloc(sizeof(*dest)); if (dest == NULL) return NULL; - memcpy(dest, src, sizeof(*dest)); + + /* + * src is logically read-only but the prev/next pointers are not, they are + * part of the session cache and can be modified concurrently. + */ + memcpy(dest, src, offsetof(SSL_SESSION, prev)); /* * Set the various pointers to NULL so that we can call SSL_SESSION_free in diff --git a/openssl/ssl/statem/extensions.c b/openssl/ssl/statem/extensions.c index 0a64ca224..8765391f2 100644 --- a/openssl/ssl/statem/extensions.c +++ b/openssl/ssl/statem/extensions.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -1741,15 +1741,9 @@ static int final_early_data(SSL_CONNECTION *s, unsigned int context, int sent) static int final_maxfragmentlen(SSL_CONNECTION *s, unsigned int context, int sent) { - /* - * Session resumption on server-side with MFL extension active - * BUT MFL extension packet was not resent (i.e. sent == 0) - */ - if (s->server && s->hit && USE_MAX_FRAGMENT_LENGTH_EXT(s->session) - && !sent ) { - SSLfatal(s, SSL_AD_MISSING_EXTENSION, SSL_R_BAD_EXTENSION); - return 0; - } + /* MaxFragmentLength defaults to disabled */ + if (s->session->ext.max_fragment_len_mode == TLSEXT_max_fragment_length_UNSPECIFIED) + s->session->ext.max_fragment_len_mode = TLSEXT_max_fragment_length_DISABLED; if (s->session && USE_MAX_FRAGMENT_LENGTH_EXT(s->session)) { s->rlayer.rrlmethod->set_max_frag_len(s->rlayer.rrl, diff --git a/openssl/ssl/statem/extensions_clnt.c b/openssl/ssl/statem/extensions_clnt.c index 381a6c9d7..5bce30b58 100644 --- a/openssl/ssl/statem/extensions_clnt.c +++ b/openssl/ssl/statem/extensions_clnt.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -1560,8 +1560,8 @@ int tls_parse_stoc_npn(SSL_CONNECTION *s, PACKET *pkt, unsigned int context, if (sctx->ext.npn_select_cb(SSL_CONNECTION_GET_SSL(s), &selected, &selected_len, PACKET_data(pkt), PACKET_remaining(pkt), - sctx->ext.npn_select_cb_arg) != - SSL_TLSEXT_ERR_OK) { + sctx->ext.npn_select_cb_arg) != SSL_TLSEXT_ERR_OK + || selected_len == 0) { SSLfatal(s, SSL_AD_HANDSHAKE_FAILURE, SSL_R_BAD_EXTENSION); return 0; } @@ -1590,6 +1590,8 @@ int tls_parse_stoc_alpn(SSL_CONNECTION *s, PACKET *pkt, unsigned int context, X509 *x, size_t chainidx) { size_t len; + PACKET confpkt, protpkt; + int valid = 0; /* We must have requested it. */ if (!s->s3.alpn_sent) { @@ -1608,6 +1610,28 @@ int tls_parse_stoc_alpn(SSL_CONNECTION *s, PACKET *pkt, unsigned int context, SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_R_BAD_EXTENSION); return 0; } + + /* It must be a protocol that we sent */ + if (!PACKET_buf_init(&confpkt, s->ext.alpn, s->ext.alpn_len)) { + SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR); + return 0; + } + while (PACKET_get_length_prefixed_1(&confpkt, &protpkt)) { + if (PACKET_remaining(&protpkt) != len) + continue; + if (memcmp(PACKET_data(pkt), PACKET_data(&protpkt), len) == 0) { + /* Valid protocol found */ + valid = 1; + break; + } + } + + if (!valid) { + /* The protocol sent from the server does not match one we advertised */ + SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_R_BAD_EXTENSION); + return 0; + } + OPENSSL_free(s->s3.alpn_selected); s->s3.alpn_selected = OPENSSL_malloc(len); if (s->s3.alpn_selected == NULL) { diff --git a/openssl/ssl/statem/extensions_srvr.c b/openssl/ssl/statem/extensions_srvr.c index 21db977c8..3997493d8 100644 --- a/openssl/ssl/statem/extensions_srvr.c +++ b/openssl/ssl/statem/extensions_srvr.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -192,21 +192,26 @@ int tls_parse_ctos_maxfragmentlen(SSL_CONNECTION *s, PACKET *pkt, } /* - * RFC 6066: The negotiated length applies for the duration of the session + * When doing a full handshake or a renegotiation max_fragment_len_mode will + * be TLSEXT_max_fragment_length_UNSPECIFIED + * + * In case of a resumption max_fragment_len_mode will be one of + * TLSEXT_max_fragment_length_DISABLED, TLSEXT_max_fragment_length_512, + * TLSEXT_max_fragment_length_1024, TLSEXT_max_fragment_length_2048. + * TLSEXT_max_fragment_length_4096 + * + * RFC 6066: The negotiated length applies for the duration of the session * including session resumptions. - * We should receive the same code as in resumed session ! + * + * So we only set the value in case it is unspecified. */ - if (s->hit && s->session->ext.max_fragment_len_mode != value) { - SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, - SSL_R_SSL3_EXT_INVALID_MAX_FRAGMENT_LENGTH); - return 0; - } + if (s->session->ext.max_fragment_len_mode == TLSEXT_max_fragment_length_UNSPECIFIED) + /* + * Store it in session, so it'll become binding for us + * and we'll include it in a next Server Hello. + */ + s->session->ext.max_fragment_len_mode = value; - /* - * Store it in session, so it'll become binding for us - * and we'll include it in a next Server Hello. - */ - s->session->ext.max_fragment_len_mode = value; return 1; } @@ -1511,9 +1516,10 @@ EXT_RETURN tls_construct_stoc_next_proto_neg(SSL_CONNECTION *s, WPACKET *pkt, return EXT_RETURN_FAIL; } s->s3.npn_seen = 1; + return EXT_RETURN_SENT; } - return EXT_RETURN_SENT; + return EXT_RETURN_NOT_SENT; } #endif diff --git a/openssl/ssl/statem/statem_lib.c b/openssl/ssl/statem/statem_lib.c index 8932ac44c..d52e2a738 100644 --- a/openssl/ssl/statem/statem_lib.c +++ b/openssl/ssl/statem/statem_lib.c @@ -516,6 +516,10 @@ MSG_PROCESS_RETURN tls_process_cert_verify(SSL_CONNECTION *s, PACKET *pkt) SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_R_LENGTH_MISMATCH); goto err; } + if (PACKET_remaining(pkt) != 0) { + SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_R_LENGTH_MISMATCH); + goto err; + } if (!get_cert_verify_tbs_data(s, tls13tbs, &hdata, &hdatalen)) { /* SSLfatal() already called */ diff --git a/openssl/ssl/t1_lib.c b/openssl/ssl/t1_lib.c index e9aa0785d..464631171 100644 --- a/openssl/ssl/t1_lib.c +++ b/openssl/ssl/t1_lib.c @@ -3926,6 +3926,8 @@ int SSL_set_tlsext_max_fragment_length(SSL *ssl, uint8_t mode) uint8_t SSL_SESSION_get_max_fragment_length(const SSL_SESSION *session) { + if (session->ext.max_fragment_len_mode == TLSEXT_max_fragment_length_UNSPECIFIED) + return TLSEXT_max_fragment_length_DISABLED; return session->ext.max_fragment_len_mode; } diff --git a/openssl/test/build.info b/openssl/test/build.info index 41b98cf8c..b7d2161b3 100644 --- a/openssl/test/build.info +++ b/openssl/test/build.info @@ -40,7 +40,7 @@ IF[{- !$disabled{tests} -}] exptest pbetest localetest evp_pkey_ctx_new_from_name \ evp_test \ evp_fetch_prov_test ossl_store_test \ - v3nametest v3ext \ + v3nametest v3ext evp_byname_test \ crltest danetest bad_dtls_test lhash_test \ conf_include_test params_api_test params_conversion_test \ constant_time_test safe_math_test verify_extra_test clienthellotest \ @@ -411,7 +411,11 @@ IF[{- !$disabled{tests} -}] SOURCE[punycode_test]=punycode_test.c INCLUDE[punycode_test]=../include ../apps/include DEPEND[punycode_test]=../libcrypto.a libtestutil.a - + + SOURCE[evp_byname_test]=evp_byname_test.c + INCLUDE[evp_byname_test]=../include ../apps/include + DEPEND[evp_byname_test]=../libcrypto libtestutil.a + SOURCE[stack_test]=stack_test.c INCLUDE[stack_test]=../include ../apps/include DEPEND[stack_test]=../libcrypto libtestutil.a diff --git a/openssl/test/certs/ee-self-signed-pss.pem b/openssl/test/certs/ee-self-signed-pss.pem new file mode 100644 index 000000000..fab433321 --- /dev/null +++ b/openssl/test/certs/ee-self-signed-pss.pem @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDhTCCAjmgAwIBAgIUZxTKBh9L8ApVNcsI5ontnHRbv8wwQQYJKoZIhvcNAQEK +MDSgDzANBglghkgBZQMEAgEFAKEcMBoGCSqGSIb3DQEBCDANBglghkgBZQMEAgEF +AKIDAgEgMB0xGzAZBgNVBAMMEmVlLXNlbGYtc2lnbmVkLXBzczAgFw0yNDA2MTcx +MTA5NTRaGA8yMTI0MDYxODExMDk1NFowHTEbMBkGA1UEAwwSZWUtc2VsZi1zaWdu +ZWQtcHNzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqP+JWGGFrt7b +LA/Vc/vit6gbenVgK9R9PHN2ta7eky9/JJBtyRz0ijjNn6KAFlbLtCy7k+UXH/8N +xkP+MTT4KNh16aO7iILvo3LiU2IFRU3gMZfvqp0Q0lgNngaeMrsbCFZdZQ8/Zo7C +NqAR/8BZNf1JHN0cQjMGeK4EOCPl53Vn05StWqlAH6xZEPUMwWStSsTGNVOzlmqC +GxWL0Zmr5J5vlKrSluVX+4yRZIo8JBbG0hm+gmATO2Kw7T4ds8r5a98xuXqeS0do +pynHP0riIie075Bj1+/Qckk+W625G9Qrb4Zo3dVzErhDydxBD6KjRk+LZ4iED2H+ +eTQfSokftwIDAQABo1MwUTAdBgNVHQ4EFgQU55viKq2KbDrLdlHljgeYIpfhc6Iw +HwYDVR0jBBgwFoAU55viKq2KbDrLdlHljgeYIpfhc6IwDwYDVR0TAQH/BAUwAwEB +/zBBBgkqhkiG9w0BAQowNKAPMA0GCWCGSAFlAwQCAQUAoRwwGgYJKoZIhvcNAQEI +MA0GCWCGSAFlAwQCAQUAogMCASADggEBADjXHPnAha0YQKFCfQZqy8LLgxoQDbfP +5XKQJ8/FfeJXO9yjEmqOEoWM/QQIlM1gpepOOw8ZRhxcwx93eO+XtvJUA3bW+H73 +jwnqiX5mu1SpA/2IHcifxuOuXUwUh7vtOJGFATHusAn7dS3+tnJSkS+6pvSsJjDu +0x3fV8rLq1gL9gOC2MdzkLxyp7xmdgibQMI+PyPNgU1e1Qm88Cp5dVNRMdgQ+3CL +E3h7qfSpSkUCM9rNBc2/rqavQ/UPq5H6r8R9gYd9yR7uGL88B9QI4DQDR8T6x9JG +0ebWYLuH2xWP9Njl2IbwN3uqQSeRSSqy7UlNo51O+nkvU1vCJGy6aXw= +-----END CERTIFICATE----- diff --git a/openssl/test/certs/setup.sh b/openssl/test/certs/setup.sh index d51738430..4280ac3a8 100755 --- a/openssl/test/certs/setup.sh +++ b/openssl/test/certs/setup.sh @@ -226,6 +226,10 @@ OPENSSL_KEYBITS=8192 \ # self-signed end-entity cert with explicit keyUsage not including KeyCertSign openssl req -new -x509 -key ee-key.pem -subj /CN=ee-self-signed -out ee-self-signed.pem -addext keyUsage=digitalSignature -days 36525 +# self-signed end-entity cert signed with RSA-PSS +openssl req -new -x509 -key ee-key.pem -subj /CN=ee-self-signed-pss -out ee-self-signed-pss.pem -days 36525 \ + -sha256 -sigopt rsa_padding_mode:pss -sigopt rsa_pss_saltlen:digest + # Proxy certificates, off of ee-client # Start with some good ones ./mkcert.sh req pc1-key "0.CN = server.example" "1.CN = proxy 1" | \ diff --git a/openssl/test/crltest.c b/openssl/test/crltest.c index 66ee17381..37fa6c13c 100644 --- a/openssl/test/crltest.c +++ b/openssl/test/crltest.c @@ -1,5 +1,5 @@ /* - * Copyright 2015-2022 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2015-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -101,6 +101,13 @@ static const char *kRevokedCRL[] = { NULL }; +static const char *kInvalidCRL[] = { + "-----BEGIN X509 CRL-----\n", + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n", + "-----END X509 CRL-----\n", + NULL +}; + static const char *kBadIssuerCRL[] = { "-----BEGIN X509 CRL-----\n", "MIIBwjCBqwIBATANBgkqhkiG9w0BAQsFADBSMQswCQYDVQQGEwJVUzETMBEGA1UE\n", @@ -371,24 +378,58 @@ static int test_unknown_critical_crl(int n) return r; } -static int test_reuse_crl(void) +static int test_reuse_crl(int idx) { - X509_CRL *reused_crl = CRL_from_strings(kBasicCRL); - char *p; - BIO *b = glue2bio(kRevokedCRL, &p); + X509_CRL *result, *reused_crl = CRL_from_strings(kBasicCRL); + X509_CRL *addref_crl = NULL; + char *p = NULL; + BIO *b = NULL; + int r = 0; - if (b == NULL) { - OPENSSL_free(p); - X509_CRL_free(reused_crl); - return 0; + if (!TEST_ptr(reused_crl)) + goto err; + + if (idx & 1) { + if (!TEST_true(X509_CRL_up_ref(reused_crl))) + goto err; + addref_crl = reused_crl; } - reused_crl = PEM_read_bio_X509_CRL(b, &reused_crl, NULL, NULL); + idx >>= 1; + b = glue2bio(idx == 2 ? kRevokedCRL : kInvalidCRL + idx, &p); + if (!TEST_ptr(b)) + goto err; + + result = PEM_read_bio_X509_CRL(b, &reused_crl, NULL, NULL); + + switch (idx) { + case 0: /* valid PEM + invalid DER */ + if (!TEST_ptr_null(result) + || !TEST_ptr_null(reused_crl)) + goto err; + break; + case 1: /* invalid PEM */ + if (!TEST_ptr_null(result) + || !TEST_ptr(reused_crl)) + goto err; + break; + case 2: + if (!TEST_ptr(result) + || !TEST_ptr(reused_crl) + || !TEST_ptr_eq(result, reused_crl)) + goto err; + break; + } + + r = 1; + + err: OPENSSL_free(p); BIO_free(b); X509_CRL_free(reused_crl); - return 1; + X509_CRL_free(addref_crl); + return r; } int setup_tests(void) @@ -402,7 +443,7 @@ int setup_tests(void) ADD_TEST(test_bad_issuer_crl); ADD_TEST(test_known_critical_crl); ADD_ALL_TESTS(test_unknown_critical_crl, OSSL_NELEM(unknown_critical_crls)); - ADD_TEST(test_reuse_crl); + ADD_ALL_TESTS(test_reuse_crl, 6); return 1; } diff --git a/openssl/test/endecode_test.c b/openssl/test/endecode_test.c index e28fd41b7..1bf99556f 100644 --- a/openssl/test/endecode_test.c +++ b/openssl/test/endecode_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -1032,6 +1032,10 @@ DOMAIN_KEYS(ECExplicitTri2G); IMPLEMENT_TEST_SUITE(ECExplicitTri2G, "EC", 0) IMPLEMENT_TEST_SUITE_LEGACY(ECExplicitTri2G, "EC") # endif +# ifndef OPENSSL_NO_SM2 +KEYS(SM2); +IMPLEMENT_TEST_SUITE(SM2, "SM2", 0) +# endif KEYS(ED25519); IMPLEMENT_TEST_SUITE(ED25519, "ED25519", 1) KEYS(ED448); @@ -1337,9 +1341,7 @@ int setup_tests(void) } /* FIPS(3.0.0): provider imports explicit params but they won't work #17998 */ - is_fips_3_0_0 = fips_provider_version_eq(testctx, 3, 0, 0); - if (is_fips_3_0_0 < 0) - return 0; + is_fips_3_0_0 = is_fips && fips_provider_version_eq(testctx, 3, 0, 0); #ifdef STATIC_LEGACY /* @@ -1396,6 +1398,9 @@ int setup_tests(void) # ifndef OPENSSL_NO_EC2M MAKE_DOMAIN_KEYS(ECExplicitTriNamedCurve, "EC", ec_explicit_tri_params_nc); MAKE_DOMAIN_KEYS(ECExplicitTri2G, "EC", ec_explicit_tri_params_explicit); +# endif +# ifndef OPENSSL_NO_SM2 + MAKE_KEYS(SM2, "SM2", NULL); # endif MAKE_KEYS(ED25519, "ED25519", NULL); MAKE_KEYS(ED448, "ED448", NULL); @@ -1442,6 +1447,12 @@ int setup_tests(void) ADD_TEST_SUITE_LEGACY(ECExplicitTriNamedCurve); ADD_TEST_SUITE(ECExplicitTri2G); ADD_TEST_SUITE_LEGACY(ECExplicitTri2G); +# endif +# ifndef OPENSSL_NO_SM2 + if (!is_fips_3_0_0) { + /* 3.0.0 FIPS provider imports explicit EC params and then fails. */ + ADD_TEST_SUITE(SM2); + } # endif ADD_TEST_SUITE(ED25519); ADD_TEST_SUITE(ED448); @@ -1499,6 +1510,9 @@ void cleanup_tests(void) # ifndef OPENSSL_NO_EC2M FREE_DOMAIN_KEYS(ECExplicitTriNamedCurve); FREE_DOMAIN_KEYS(ECExplicitTri2G); +# endif +# ifndef OPENSSL_NO_SM2 + FREE_KEYS(SM2); # endif FREE_KEYS(ED25519); FREE_KEYS(ED448); diff --git a/openssl/test/evp_byname_test.c b/openssl/test/evp_byname_test.c new file mode 100644 index 000000000..e16e27a3a --- /dev/null +++ b/openssl/test/evp_byname_test.c @@ -0,0 +1,40 @@ +/* + * Copyright 2024 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the Apache License 2.0 (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include +#include +#include + +#include +#include "testutil.h" + +static int test_evp_get_digestbyname(void) +{ + const EVP_MD *md; + + if (!TEST_ptr(md = EVP_get_digestbyname("SHA2-256"))) + return 0; + return 1; +} + +static int test_evp_get_cipherbyname(void) +{ + const EVP_CIPHER *cipher; + + if (!TEST_ptr(cipher = EVP_get_cipherbyname("AES-256-WRAP"))) + return 0; + return 1; +} + +int setup_tests(void) +{ + ADD_TEST(test_evp_get_digestbyname); + ADD_TEST(test_evp_get_cipherbyname); + return 1; +} diff --git a/openssl/test/evp_extra_test.c b/openssl/test/evp_extra_test.c index a42e42d92..4dcb39950 100644 --- a/openssl/test/evp_extra_test.c +++ b/openssl/test/evp_extra_test.c @@ -4927,6 +4927,7 @@ static int custom_md_cleanup(EVP_MD_CTX *ctx) static int test_custom_md_meth(void) { + ASN1_OBJECT *o = NULL; EVP_MD_CTX *mdctx = NULL; EVP_MD *tmp = NULL; char mess[] = "Test Message\n"; @@ -4972,8 +4973,21 @@ static int test_custom_md_meth(void) || !TEST_int_eq(custom_md_cleanup_called, 1)) goto err; + if (!TEST_int_eq(OBJ_create("1.3.6.1.4.1.16604.998866.1", + "custom-md", "custom-md"), NID_undef) + || !TEST_int_eq(ERR_GET_LIB(ERR_peek_error()), ERR_LIB_OBJ) + || !TEST_int_eq(ERR_GET_REASON(ERR_get_error()), OBJ_R_OID_EXISTS)) + goto err; + + o = ASN1_OBJECT_create(nid, (unsigned char *) + "\53\6\1\4\1\201\201\134\274\373\122\1", 12, + "custom-md", "custom-md"); + if (!TEST_int_eq(OBJ_add_object(o), nid)) + goto err; + testresult = 1; err: + ASN1_OBJECT_free(o); EVP_MD_CTX_free(mdctx); EVP_MD_meth_free(tmp); return testresult; @@ -5624,6 +5638,25 @@ static int test_aes_rc4_keylen_change_cve_2023_5363(void) } #endif +static int test_invalid_ctx_for_digest(void) +{ + int ret; + EVP_MD_CTX *mdctx; + + mdctx = EVP_MD_CTX_new(); + if (!TEST_ptr(mdctx)) + return 0; + + if (!TEST_int_eq(EVP_DigestUpdate(mdctx, "test", sizeof("test") - 1), 0)) + ret = 0; + else + ret = 1; + + EVP_MD_CTX_free(mdctx); + + return ret; +} + int setup_tests(void) { OPTION_CHOICE o; @@ -5795,6 +5828,8 @@ int setup_tests(void) ADD_TEST(test_aes_rc4_keylen_change_cve_2023_5363); #endif + ADD_TEST(test_invalid_ctx_for_digest); + return 1; } diff --git a/openssl/test/evp_kdf_test.c b/openssl/test/evp_kdf_test.c index 858c79660..999409b68 100644 --- a/openssl/test/evp_kdf_test.c +++ b/openssl/test/evp_kdf_test.c @@ -1966,6 +1966,64 @@ static int test_kdf_hmac_drbg_gettables(void) return ret; } +/* Test that changing the KBKDF algorithm from KMAC to HMAC works correctly */ +static int test_kbkdf_mac_change(void) +{ + int ret = 0; + EVP_KDF_CTX *kctx = NULL; + OSSL_PARAM params[9], *p = params; + /* Test data taken from the evptest corpus */ + int l = 0, sep = 0, r = 8; + static /* const */ unsigned char key[] = { + 0x3e, 0xdc, 0x6b, 0x5b, 0x8f, 0x7a, 0xad, 0xbd, + 0x71, 0x37, 0x32, 0xb4, 0x82, 0xb8, 0xf9, 0x79, + 0x28, 0x6e, 0x1e, 0xa3, 0xb8, 0xf8, 0xf9, 0x9c, + 0x30, 0xc8, 0x84, 0xcf, 0xe3, 0x34, 0x9b, 0x83 + }; + static /* const */ unsigned char info[] = { + 0x98, 0xe9, 0x98, 0x8b, 0xb4, 0xcc, 0x8b, 0x34, + 0xd7, 0x92, 0x2e, 0x1c, 0x68, 0xad, 0x69, 0x2b, + 0xa2, 0xa1, 0xd9, 0xae, 0x15, 0x14, 0x95, 0x71, + 0x67, 0x5f, 0x17, 0xa7, 0x7a, 0xd4, 0x9e, 0x80, + 0xc8, 0xd2, 0xa8, 0x5e, 0x83, 0x1a, 0x26, 0x44, + 0x5b, 0x1f, 0x0f, 0xf4, 0x4d, 0x70, 0x84, 0xa1, + 0x72, 0x06, 0xb4, 0x89, 0x6c, 0x81, 0x12, 0xda, + 0xad, 0x18, 0x60, 0x5a + }; + static const unsigned char output[] = { + 0x6c, 0x03, 0x76, 0x52, 0x99, 0x06, 0x74, 0xa0, + 0x78, 0x44, 0x73, 0x2d, 0x0a, 0xd9, 0x85, 0xf9 + }; + unsigned char out[sizeof(output)]; + + params[0] = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_MAC, + OSSL_MAC_NAME_KMAC128, 0); + params[1] = OSSL_PARAM_construct_end(); + if (!TEST_ptr(kctx = get_kdfbyname(OSSL_KDF_NAME_KBKDF)) + || !TEST_true(EVP_KDF_CTX_set_params(kctx, params))) + goto err; + + *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_MODE, "COUNTER", 0); + *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_MAC, "HMAC", 0); + *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST, "SHA256", 0); + *p++ = OSSL_PARAM_construct_int(OSSL_KDF_PARAM_KBKDF_USE_L, &l); + *p++ = OSSL_PARAM_construct_int(OSSL_KDF_PARAM_KBKDF_USE_SEPARATOR, &sep); + *p++ = OSSL_PARAM_construct_int(OSSL_KDF_PARAM_KBKDF_R, &r); + *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY, + key, sizeof(key)); + *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO, + info, sizeof(info)); + *p = OSSL_PARAM_construct_end(); + if (!TEST_true(EVP_KDF_derive(kctx, out, sizeof(out), params)) + || !TEST_mem_eq(out, sizeof(out), output, sizeof(output))) + goto err; + + ret = 1; +err: + EVP_KDF_CTX_free(kctx); + return ret; +} + int setup_tests(void) { ADD_TEST(test_kdf_pbkdf1); @@ -2029,5 +2087,6 @@ int setup_tests(void) ADD_TEST(test_kdf_krb5kdf); ADD_TEST(test_kdf_hmac_drbg_settables); ADD_TEST(test_kdf_hmac_drbg_gettables); + ADD_TEST(test_kbkdf_mac_change); return 1; } diff --git a/openssl/test/helpers/handshake.c b/openssl/test/helpers/handshake.c index e0422469e..f611b3a07 100644 --- a/openssl/test/helpers/handshake.c +++ b/openssl/test/helpers/handshake.c @@ -1,5 +1,5 @@ /* - * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -348,6 +348,12 @@ static int parse_protos(const char *protos, unsigned char **out, size_t *outlen) len = strlen(protos); + if (len == 0) { + *out = NULL; + *outlen = 0; + return 1; + } + /* Should never have reuse. */ if (!TEST_ptr_null(*out) /* Test values are small, so we omit length limit checks. */ diff --git a/openssl/test/hexstr_test.c b/openssl/test/hexstr_test.c index 5a9684e0e..566615ed6 100644 --- a/openssl/test/hexstr_test.c +++ b/openssl/test/hexstr_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -120,9 +120,14 @@ static int test_hexstr_ex_to_from(int test_index) return TEST_true(OPENSSL_hexstr2buf_ex(buf, sizeof(buf), &len, test->in, ':')) && TEST_mem_eq(buf, len, test->expected, test->expected_len) + && TEST_false(OPENSSL_buf2hexstr_ex(out, 3 * len - 1, NULL, buf, len, + ':')) && TEST_true(OPENSSL_buf2hexstr_ex(out, sizeof(out), NULL, buf, len, - ':')) - && TEST_str_eq(out, test->in); + ':')) + && TEST_str_eq(out, test->in) + && TEST_true(OPENSSL_buf2hexstr_ex(out, sizeof(out), NULL, buf, 0, + ':')) + && TEST_size_t_eq(strlen(out), 0); } int setup_tests(void) diff --git a/openssl/test/prov_config_test.c b/openssl/test/prov_config_test.c index f93d8d62b..2fd913dea 100644 --- a/openssl/test/prov_config_test.c +++ b/openssl/test/prov_config_test.c @@ -26,15 +26,13 @@ static int test_double_config(void) int testresult = 0; EVP_MD *sha256 = NULL; - if (!TEST_ptr(configfile)) - return 0; if (!TEST_ptr(ctx)) return 0; if (!TEST_true(OSSL_LIB_CTX_load_config(ctx, configfile))) - return 0; + goto err; if (!TEST_true(OSSL_LIB_CTX_load_config(ctx, configfile))) - return 0; + goto err; /* Check we can actually fetch something */ sha256 = EVP_MD_fetch(ctx, "SHA2-256", NULL); @@ -54,9 +52,6 @@ static int test_recursive_config(void) int testresult = 0; unsigned long err; - if (!TEST_ptr(recurseconfigfile)) - goto err; - if (!TEST_ptr(ctx)) goto err; diff --git a/openssl/test/provider_fallback_test.c b/openssl/test/provider_fallback_test.c index 5902f57c8..26ba9ea1d 100644 --- a/openssl/test/provider_fallback_test.c +++ b/openssl/test/provider_fallback_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -39,9 +39,15 @@ static int test_explicit_provider(void) int ok; ok = TEST_ptr(ctx = OSSL_LIB_CTX_new()) - && TEST_ptr(prov = OSSL_PROVIDER_load(ctx, "default")) - && test_provider(ctx) - && TEST_true(OSSL_PROVIDER_unload(prov)); + && TEST_ptr(prov = OSSL_PROVIDER_load(ctx, "default")); + + if (ok) { + ok = test_provider(ctx); + if (ok) + ok = TEST_true(OSSL_PROVIDER_unload(prov)); + else + OSSL_PROVIDER_unload(prov); + } OSSL_LIB_CTX_free(ctx); return ok; diff --git a/openssl/test/provider_internal_test.c b/openssl/test/provider_internal_test.c index 9998e6bf9..29e5b8ae1 100644 --- a/openssl/test/provider_internal_test.c +++ b/openssl/test/provider_internal_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -22,7 +22,7 @@ static OSSL_PARAM greeting_request[] = { static int test_provider(OSSL_PROVIDER *prov, const char *expected_greeting) { - const char *greeting = NULL; + const char *greeting = "no greeting received"; int ret = 0; ret = diff --git a/openssl/test/provider_status_test.c b/openssl/test/provider_status_test.c index 551277c8e..9fcd2c2b1 100644 --- a/openssl/test/provider_status_test.c +++ b/openssl/test/provider_status_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -14,6 +14,7 @@ #include #include #include +#include #include "testutil.h" typedef enum OPTION_choice { @@ -147,6 +148,8 @@ static int test_provider_status(void) OSSL_PROVIDER *prov = NULL; OSSL_PARAM params[2]; EVP_MD *fetch = NULL; + EVP_PKEY_CTX *pctx = NULL; + EVP_PKEY *pkey = NULL; if (!TEST_ptr(prov = OSSL_PROVIDER_load(libctx, provider_name))) goto err; @@ -163,6 +166,16 @@ static int test_provider_status(void) goto err; EVP_MD_free(fetch); fetch = NULL; + /* Use RNG before triggering on-demand self tests */ + if (!TEST_ptr((pctx = EVP_PKEY_CTX_new_from_name(libctx, "RSA", NULL))) + || !TEST_int_gt(EVP_PKEY_keygen_init(pctx), 0) + || !TEST_int_gt(EVP_PKEY_CTX_set_rsa_keygen_bits(pctx, 2048), 0) + || !TEST_int_gt(EVP_PKEY_keygen(pctx, &pkey), 0)) + goto err; + EVP_PKEY_free(pkey); + EVP_PKEY_CTX_free(pctx); + pkey = NULL; + pctx = NULL; /* Test that the provider self test is ok */ self_test_args.count = 0; diff --git a/openssl/test/provider_test.c b/openssl/test/provider_test.c index 2d20d1207..ef08cc51e 100644 --- a/openssl/test/provider_test.c +++ b/openssl/test/provider_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -255,6 +255,7 @@ static int test_builtin_provider_with_child(void) if (!TEST_true(OSSL_PROVIDER_add_builtin(libctx, name, PROVIDER_INIT_FUNCTION_NAME))) { + OSSL_PROVIDER_unload(legacy); OSSL_LIB_CTX_free(libctx); return 0; } diff --git a/openssl/test/recipes/03-test_fipsinstall.t b/openssl/test/recipes/03-test_fipsinstall.t index b8b136d11..56a33d764 100644 --- a/openssl/test/recipes/03-test_fipsinstall.t +++ b/openssl/test/recipes/03-test_fipsinstall.t @@ -1,5 +1,5 @@ #! /usr/bin/env perl -# Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the Apache License 2.0 (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy @@ -206,7 +206,7 @@ ok(!run(app(['openssl', 'fipsinstall', '-out', 'fips.cnf', '-module', $infile, ok(!run(app(['openssl', 'fipsinstall', '-out', 'fips_fail.cnf', '-module', $infile, '-provider_name', 'fips', '-mac_name', 'HMAC', '-macopt', 'digest:SHA256', '-macopt', "hexkey:$fipskey", - '-section_name', 'fips_sect', '-corrupt_desc', 'SHA1'])), + '-section_name', 'fips_sect', '-corrupt_desc', 'SHA2'])), "fipsinstall fails when the digest result is corrupted"); # corrupt another digest diff --git a/openssl/test/recipes/04-test_conf.t b/openssl/test/recipes/04-test_conf.t index f987e43c8..574859e90 100644 --- a/openssl/test/recipes/04-test_conf.t +++ b/openssl/test/recipes/04-test_conf.t @@ -1,5 +1,5 @@ #! /usr/bin/env perl -# Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2017-2024 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the Apache License 2.0 (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy @@ -18,6 +18,7 @@ setup('test_conf'); my %input_result = ( 'dollarid_on.cnf' => 'dollarid_on.txt', 'dollarid_off.cnf' => 'dollarid_off.txt', + 'oversized_line.cnf' => 'oversized_line.txt', ); plan skip_all => 'This is unsupported for cross compiled configurations' diff --git a/openssl/test/recipes/04-test_conf_data/oversized_line.cnf b/openssl/test/recipes/04-test_conf_data/oversized_line.cnf new file mode 100644 index 000000000..08988a2e0 --- /dev/null +++ b/openssl/test/recipes/04-test_conf_data/oversized_line.cnf @@ -0,0 +1,3 @@ +foo = a_line_longer_than_512_characters_\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"_end +bar = a_line_longer_than_512_characters__\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"\"_end +last = x diff --git a/openssl/test/recipes/04-test_conf_data/oversized_line.txt b/openssl/test/recipes/04-test_conf_data/oversized_line.txt new file mode 100644 index 000000000..c15b65430 --- /dev/null +++ b/openssl/test/recipes/04-test_conf_data/oversized_line.txt @@ -0,0 +1,4 @@ +[ default ] +foo = a_line_longer_than_512_characters_""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""_end +bar = a_line_longer_than_512_characters__""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""_end +last = x diff --git a/openssl/test/recipes/25-test_eai_data.t b/openssl/test/recipes/25-test_eai_data.t index 522982ddf..63548d060 100644 --- a/openssl/test/recipes/25-test_eai_data.t +++ b/openssl/test/recipes/25-test_eai_data.t @@ -1,5 +1,5 @@ #! /usr/bin/env perl -# Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the Apache License 2.0 (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy @@ -21,16 +21,18 @@ setup("test_eai_data"); #./util/wrap.pl apps/openssl verify -nameopt utf8 -no_check_time -CAfile test/recipes/25-test_eai_data/utf8_chain.pem test/recipes/25-test_eai_data/ascii_leaf.pem #./util/wrap.pl apps/openssl verify -nameopt utf8 -no_check_time -CAfile test/recipes/25-test_eai_data/ascii_chain.pem test/recipes/25-test_eai_data/utf8_leaf.pem -plan tests => 12; +plan tests => 16; require_ok(srctop_file('test','recipes','tconversion.pl')); my $folder = "test/recipes/25-test_eai_data"; my $ascii_pem = srctop_file($folder, "ascii_leaf.pem"); my $utf8_pem = srctop_file($folder, "utf8_leaf.pem"); +my $kdc_pem = srctop_file($folder, "kdc-cert.pem"); my $ascii_chain_pem = srctop_file($folder, "ascii_chain.pem"); my $utf8_chain_pem = srctop_file($folder, "utf8_chain.pem"); +my $kdc_chain_pem = srctop_file($folder, "kdc-root-cert.pem"); my $out; my $outcnt = 0; @@ -56,10 +58,18 @@ SKIP: { ok(run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-CAfile", $ascii_chain_pem, $ascii_pem]))); ok(run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-CAfile", $utf8_chain_pem, $utf8_pem]))); +ok(run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-CAfile", $kdc_chain_pem, $kdc_pem]))); ok(!run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-CAfile", $ascii_chain_pem, $utf8_pem]))); ok(!run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-CAfile", $utf8_chain_pem, $ascii_pem]))); +# Check an otherName does not get misparsed as an DNS name, (should trigger ASAN errors if violated). +ok(run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-verify_hostname", 'mx1.example.com', "-CAfile", $kdc_chain_pem, $kdc_pem]))); +# Check an otherName does not get misparsed as an email address, (should trigger ASAN errors if violated). +ok(run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-verify_email", 'joe@example.com', "-CAfile", $kdc_chain_pem, $kdc_pem]))); +# We expect SmtpUTF8Mailbox to be a UTF8 String, not an IA5String. +ok(!run(app(["openssl", "verify", "-nameopt", "utf8", "-no_check_time", "-verify_email", 'moe@example.com', "-CAfile", $kdc_chain_pem, $kdc_pem]))); + #Check that we get the expected failure return code with({ exit_checker => sub { return shift == 2; } }, sub { diff --git a/openssl/test/recipes/25-test_eai_data/kdc-cert.pem b/openssl/test/recipes/25-test_eai_data/kdc-cert.pem new file mode 100644 index 000000000..e8a2c6f55 --- /dev/null +++ b/openssl/test/recipes/25-test_eai_data/kdc-cert.pem @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDbDCCAlSgAwIBAgIBAjANBgkqhkiG9w0BAQsFADAPMQ0wCwYDVQQDDARSb290 +MCAXDTI0MDYyMDA2MTQxNVoYDzIxMjQwNjIwMDYxNDE1WjAXMRUwEwYDVQQDDAxU +RVNULkVYQU1QTEUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6wfP+ +6go79dkpo/dGLMlPZ7Gw/Q6gUYrCWZWUEgEeRVHCrqOlgUEyA+PcWas/XDPUxXry +BQlJHLvlqamAQn8gs4QPBARFYWKNiTVGyaRkgNA1N5gqyZdrP9UE+ZJmdqxRAAe8 +vvpGZWSgevPhLUiSCFYDiD0Rtji2Hm3rGUrReQFBQDEw2pNGwz9zIaxUs08kQZcx +Yzyiplz5Oau+R/6sAgUwDlrD9xOlUxx/tA/MSDIfkK8qioU11uUZtO5VjkNQy/bT +7zQMmXxWgm2MIgOs1u4YN7YGOtgqHE9v9iPHHfgrkbQDtVDGQsa8AQEhkUDSCtW9 +3VFAKx6dGNXYzFwfAgMBAAGjgcgwgcUwHQYDVR0OBBYEFFR5tZycW19DmtbL4Zqj +te1c2vZLMAkGA1UdIwQCMAAwCQYDVR0TBAIwADCBjQYDVR0RBIGFMIGCoD8GBisG +AQUCAqA1MDOgDhsMVEVTVC5FWEFNUExFoSEwH6ADAgEBoRgwFhsGa3JidGd0GwxU +RVNULkVYQU1QTEWgHQYIKwYBBQUHCAmgERYPbW9lQGV4YW1wbGUuY29tgQ9qb2VA +ZXhhbXBsZS5jb22CD214MS5leGFtcGxlLmNvbTANBgkqhkiG9w0BAQsFAAOCAQEA +T0xzVtVpRtaOzIhgzw7XQUdzWD5UEGSJJ1cBCOmKUWwDLTAouCYLFB4TbEE7MMUb +iuMy60bjmVtvfJIXorGUgSadRe5RWJ5DamJWvPA0Q9x7blnEcXqEF+9Td+ypevgU +UYHFmg83OYwxOsFXZ5cRuXMk3WCsDHQIBi6D1L6oDDZ2pfArs5mqm3thQKVlqyl1 +El3XRYEdqAz/5eCOFNfwxF0ALxjxVr/Z50StUZU8I7Zfev6+kHhyrR7dqzYJImv9 +0fTCOBEMjIETDsrA70OxAMu4V16nrWZdJdvzblS2qrt97Omkj+2kiPAJFB76RpwI +oDQ9fKfUOAmUFth2/R/eGA== +-----END CERTIFICATE----- diff --git a/openssl/test/recipes/25-test_eai_data/kdc-root-cert.pem b/openssl/test/recipes/25-test_eai_data/kdc-root-cert.pem new file mode 100644 index 000000000..a74c96bf3 --- /dev/null +++ b/openssl/test/recipes/25-test_eai_data/kdc-root-cert.pem @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE----- +MIICnDCCAYQCCQCBswYcrlZSHjANBgkqhkiG9w0BAQsFADAPMQ0wCwYDVQQDDARS +b290MCAXDTI0MDYyMDA2MTQxNVoYDzIxMjQwNjIwMDYxNDE1WjAPMQ0wCwYDVQQD +DARSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqRj8S4kBbIUj +61kZfi6nE35Q38U140+qt4uAiwAhKumfVHlBM0zQ98WFt5zMHIBQwIb3yjc2zj+0 +qzUnQfwm1r/RfcMmBPEti9Ge+aEMSsds2gMXziOFM8wd2aAFPy7UVE0XpEWofsRK +MGi61MKVdPSbGIxBwY9VW38/7D/wf1HtJe7y0xpuecR7GB2XAs+qST59NjuF+7wS +dLM8Hb3TATgeYbXXWsRJgwz+SPzExg5WmLnU+7y4brZ32dHtdSmkRVSgSlaIf7Xj +3Tc6Zi7I+W/JYk7hy1zUexVdWCak4PHcoWrXe0gNNN/t8VfLfMExt5z/HIylXnU7 +pGUyqZlTGQIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQAHpLF1UCRy7b6Hk0rLokxI +lgwiH9BU9mktigAGASvkbllpt+YbUbWnuYAvpHBGiP1qZtfX2r96UrSJaGO9BEzT +Gp9ThnSjoj4Srul0+s/NArU22irFLmDzbalgevAmm9gMGkdqkiIm/mXbwrPj0ncl +KGicevXryVpvaP62eZ8cc3C4p97frMmXxRX8sTdQpD/gRI7prdEILRSKveqT+AEW +7rFGM5AOevb4U8ddop8A3D/kX0wcCAIBF6jCNk3uEJ57jVcagL04kPnVfdRiedTS +vfq1DRNcD29d1H/9u0fHdSn1/+8Ep3X+afQ3C6//5NvOEaXcIGO4QSwkprQydfv8 +-----END CERTIFICATE----- diff --git a/openssl/test/recipes/25-test_eai_data/kdc.sh b/openssl/test/recipes/25-test_eai_data/kdc.sh new file mode 100755 index 000000000..7a8dbc719 --- /dev/null +++ b/openssl/test/recipes/25-test_eai_data/kdc.sh @@ -0,0 +1,41 @@ +#! /usr/bin/env bash + +# Create a root CA, signing a leaf cert with a KDC principal otherName SAN, and +# also a non-UTF8 smtpUtf8Mailbox SAN followed by an rfc822Name SAN and a DNS +# name SAN. In the vulnerable EAI code, the KDC principal `otherName` should +# trigger ASAN errors in DNS name checks, while the non-UTF8 `smtpUtf8Mailbox` +# should likewise lead to ASAN issues with email name checks. + +rm -f root-key.pem root-cert.pem +openssl req -nodes -new -newkey rsa:2048 -keyout kdc-root-key.pem \ + -x509 -subj /CN=Root -days 36524 -out kdc-root-cert.pem + +exts=$( + printf "%s\n%s\n%s\n%s = " \ + "subjectKeyIdentifier = hash" \ + "authorityKeyIdentifier = keyid" \ + "basicConstraints = CA:false" \ + "subjectAltName" + printf "%s, " "otherName:1.3.6.1.5.2.2;SEQUENCE:kdc_princ_name" + printf "%s, " "otherName:1.3.6.1.5.5.7.8.9;IA5:moe@example.com" + printf "%s, " "email:joe@example.com" + printf "%s\n" "DNS:mx1.example.com" + printf "[kdc_princ_name]\n" + printf "realm = EXP:0, GeneralString:TEST.EXAMPLE\n" + printf "principal_name = EXP:1, SEQUENCE:kdc_principal_seq\n" + printf "[kdc_principal_seq]\n" + printf "name_type = EXP:0, INTEGER:1\n" + printf "name_string = EXP:1, SEQUENCE:kdc_principal_components\n" + printf "[kdc_principal_components]\n" + printf "princ1 = GeneralString:krbtgt\n" + printf "princ2 = GeneralString:TEST.EXAMPLE\n" + ) + +printf "%s\n" "$exts" + +openssl req -nodes -new -newkey rsa:2048 -keyout kdc-key.pem \ + -subj "/CN=TEST.EXAMPLE" | + openssl x509 -req -out kdc-cert.pem \ + -CA "kdc-root-cert.pem" -CAkey "kdc-root-key.pem" \ + -set_serial 2 -days 36524 \ + -extfile <(printf "%s\n" "$exts") diff --git a/openssl/test/recipes/25-test_x509.t b/openssl/test/recipes/25-test_x509.t index 739ac746b..13dce3407 100644 --- a/openssl/test/recipes/25-test_x509.t +++ b/openssl/test/recipes/25-test_x509.t @@ -271,5 +271,7 @@ ok(-e $ca_serial_dot_in_dir); SKIP: { skip "EC is not supported by this OpenSSL build", 1 if disabled("ec"); - ok(run(test(["x509_test"])), "running x509_test"); + my $psscert = srctop_file(@certs, "ee-self-signed-pss.pem"); + + ok(run(test(["x509_test", $psscert])), "running x509_test"); } diff --git a/openssl/test/recipes/30-test_evp_byname.t b/openssl/test/recipes/30-test_evp_byname.t new file mode 100644 index 000000000..d06e874fe --- /dev/null +++ b/openssl/test/recipes/30-test_evp_byname.t @@ -0,0 +1,16 @@ +#! /usr/bin/env perl +# Copyright 2024 The OpenSSL Project Authors. All Rights Reserved. +# +# Licensed under the Apache License 2.0 (the "License"). You may not use +# this file except in compliance with the License. You can obtain a copy +# in the file LICENSE in the source distribution or at +# https://www.openssl.org/source/license.html + +use strict; +use OpenSSL::Test; +use OpenSSL::Test::Simple; +use OpenSSL::Test::Utils; + +setup("test_evp_byname"); + +simple_test("test_evp_byname", "evp_byname_test"); diff --git a/openssl/test/recipes/30-test_evp_data/evppkey_dsa.txt b/openssl/test/recipes/30-test_evp_data/evppkey_dsa.txt index debd62bca..39f9a0134 100644 --- a/openssl/test/recipes/30-test_evp_data/evppkey_dsa.txt +++ b/openssl/test/recipes/30-test_evp_data/evppkey_dsa.txt @@ -1,5 +1,5 @@ # -# Copyright 2001-2023 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2001-2024 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the Apache License 2.0 (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy @@ -270,6 +270,7 @@ Title = FIPS Tests (using different key sizes and digests) # Test sign with a 2048 bit key with N == 160 is not allowed in fips mode Availablein = fips +FIPSversion = <3.4.0 DigestSign = SHA256 Key = DSA-2048-160 Input = "Hello" @@ -324,6 +325,7 @@ Title = Fips Negative Tests (using different key sizes and digests) # Test sign with a 1024 bit key is not allowed in fips mode Availablein = fips +FIPSversion = <3.4.0 DigestSign = SHA256 Securitycheck = 1 Key = DSA-1024-FIPS186-2 @@ -340,6 +342,7 @@ Result = DIGESTSIGNINIT_ERROR # Test sign with a 3072 bit key with N == 224 is not allowed in fips mode Availablein = fips +FIPSversion = <3.4.0 DigestSign = SHA256 Securitycheck = 1 Key = DSA-3072-224 @@ -348,6 +351,7 @@ Result = DIGESTSIGNINIT_ERROR # Test sign with a 4096 bit key is not allowed in fips mode Availablein = fips +FIPSversion = <3.4.0 DigestSign = SHA256 Securitycheck = 1 Key = DSA-4096-256 diff --git a/openssl/test/recipes/30-test_evp_data/evppkey_ecdsa.txt b/openssl/test/recipes/30-test_evp_data/evppkey_ecdsa.txt index 1543ed9f7..1f9ce93cd 100644 --- a/openssl/test/recipes/30-test_evp_data/evppkey_ecdsa.txt +++ b/openssl/test/recipes/30-test_evp_data/evppkey_ecdsa.txt @@ -1,5 +1,5 @@ # -# Copyright 2001-2021 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2001-2024 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the Apache License 2.0 (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy @@ -216,6 +216,7 @@ Result = DIGESTSIGNINIT_ERROR # Test that SHA1 is not allowed in fips mode for signing Availablein = fips +FIPSversion = <3.4.0 Sign = P-256 Securitycheck = 1 Ctrl = digest:SHA1 diff --git a/openssl/test/recipes/30-test_evp_data/evppkey_rsa_common.txt b/openssl/test/recipes/30-test_evp_data/evppkey_rsa_common.txt index 76ddc1ec6..1c49017aa 100644 --- a/openssl/test/recipes/30-test_evp_data/evppkey_rsa_common.txt +++ b/openssl/test/recipes/30-test_evp_data/evppkey_rsa_common.txt @@ -1,5 +1,5 @@ # -# Copyright 2001-2023 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2001-2024 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the Apache License 2.0 (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy @@ -1831,6 +1831,7 @@ Output = 80382819f51b197c42f9fc02a85198683d918059afc013ae155992442563dd289700829 # Signing with SHA1 is not allowed in fips mode Availablein = fips +FIPSversion = <3.4.0 DigestSign = SHA1 Securitycheck = 1 Key = RSA-2048 diff --git a/openssl/test/recipes/70-test_npn.t b/openssl/test/recipes/70-test_npn.t new file mode 100644 index 000000000..f82e71af6 --- /dev/null +++ b/openssl/test/recipes/70-test_npn.t @@ -0,0 +1,73 @@ +#! /usr/bin/env perl +# Copyright 2024 The OpenSSL Project Authors. All Rights Reserved. +# +# Licensed under the Apache License 2.0 (the "License"). You may not use +# this file except in compliance with the License. You can obtain a copy +# in the file LICENSE in the source distribution or at +# https://www.openssl.org/source/license.html + +use strict; +use OpenSSL::Test qw/:DEFAULT cmdstr srctop_file/; +use OpenSSL::Test::Utils; + +use TLSProxy::Proxy; + +my $test_name = "test_npn"; +setup($test_name); + +plan skip_all => "TLSProxy isn't usable on $^O" + if $^O =~ /^(VMS)$/; + +plan skip_all => "$test_name needs the dynamic engine feature enabled" + if disabled("engine") || disabled("dynamic-engine"); + +plan skip_all => "$test_name needs the sock feature enabled" + if disabled("sock"); + +plan skip_all => "$test_name needs NPN enabled" + if disabled("nextprotoneg"); + +plan skip_all => "$test_name needs TLSv1.2 enabled" + if disabled("tls1_2"); + +my $proxy = TLSProxy::Proxy->new( + undef, + cmdstr(app(["openssl"]), display => 1), + srctop_file("apps", "server.pem"), + (!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE}) +); + +$proxy->start() or plan skip_all => "Unable to start up Proxy for tests"; +plan tests => 1; + +my $npnseen = 0; + +# Test 1: Check sending an empty NextProto message from the client works. This is +# valid as per the spec, but OpenSSL does not allow you to send it. +# Therefore we must be prepared to receive such a message but we cannot +# generate it except via TLSProxy +$proxy->clear(); +$proxy->filter(\&npn_filter); +$proxy->clientflags("-nextprotoneg foo -no_tls1_3"); +$proxy->serverflags("-nextprotoneg foo"); +$proxy->start(); +ok($npnseen && TLSProxy::Message->success(), "Empty NPN message"); + +sub npn_filter +{ + my $proxy = shift; + my $message; + + # The NextProto message always appears in flight 2 + return if $proxy->flight != 2; + + foreach my $message (@{$proxy->message_list}) { + if ($message->mt == TLSProxy::Message::MT_NEXT_PROTO) { + # Our TLSproxy NextProto message support doesn't support parsing of + # the message. If we repack it just creates an empty NextProto + # message - which is exactly the scenario we want to test here. + $message->repack(); + $npnseen = 1; + } + } +} diff --git a/openssl/test/recipes/80-test_cmp_http_data/test_connection.csv b/openssl/test/recipes/80-test_cmp_http_data/test_connection.csv index 94916e89f..83e746518 100644 --- a/openssl/test/recipes/80-test_cmp_http_data/test_connection.csv +++ b/openssl/test/recipes/80-test_cmp_http_data/test_connection.csv @@ -2,7 +2,7 @@ expected,description, -section,val, -server,val, -proxy,val, -no_proxy,val, -tls ,Message transfer options:,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,, 1,default config, -section,,,,,,,,BLANK,,,,BLANK,,BLANK,,BLANK, -1,server domain name, -section,, -server,localhost:_SERVER_PORT,,,,,,,,,,,,,, +disabled as not supported by some host IP configurations,server domain name, -section,, -server,localhost:_SERVER_PORT,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,, 0,wrong server, -section,, -server,xn--rksmrgs-5wao1o.example.com:_SERVER_PORT,,,,,BLANK,,,, -msg_timeout,1,BLANK,,BLANK, 0,wrong server port, -section,, -server,_SERVER_HOST:99,,,,,BLANK,,,, -msg_timeout,1,BLANK,,BLANK, diff --git a/openssl/test/recipes/80-test_cmp_http_data/test_enrollment.csv b/openssl/test/recipes/80-test_cmp_http_data/test_enrollment.csv index 3d14c78a4..a66afdc83 100644 --- a/openssl/test/recipes/80-test_cmp_http_data/test_enrollment.csv +++ b/openssl/test/recipes/80-test_cmp_http_data/test_enrollment.csv @@ -66,7 +66,9 @@ expected,description, -section,val, -cmd,val, -newkey,val,val, -newkeypass,val, 1,disable_confirm, -section,, -cmd,ir, -newkey,new.key,, -newkeypass,pass:,,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,, -disable_confirm,, -certout,_RESULT_DIR/test.certout_disable.pem,, -out_trusted,root.crt,,BLANK,,BLANK,,, 0,disable_confirm with parameter, -section,, -cmd,ir, -newkey,new.key,, -newkeypass,pass:,,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,, -disable_confirm,abc, -certout,_RESULT_DIR/test.certout_disable1.pem,, -out_trusted,root.crt,,BLANK,,BLANK,,, ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, -1,use certout (and chainout), -section,, -cmd,ir, -newkey,new.key,, -newkeypass,pass:,,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,, ,,, -out_trusted,root.crt,,BLANK,,BLANK,,,,-cert,_RESULT_DIR/test.certout_newkey.pem,-untrusted,_RESULT_DIR/test.chainout.pem +1,use certout (and chainout) , -section,, -cmd,ir, -newkey,new.key,, -newkeypass,pass:,,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,, ,,, -out_trusted,root.crt,,BLANK,,BLANK,,,,-cert,_RESULT_DIR/test.certout_newkey.pem,-untrusted,_RESULT_DIR/test.chainout.pem +1,certout and chainout sent to same file, -section,, -cmd,ir, -newkey,new.key,, -newkeypass,pass:,,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,, ,,, -out_trusted,root.crt,,BLANK,,BLANK,,,,-certout,_RESULT_DIR/test.certout_chainout.pem,,-chainout,_RESULT_DIR/test.certout_chainout.pem +1,use certout and chainout from same file, -section,, -cmd,ir, -newkey,new.key,, -newkeypass,pass:,,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,, ,,, -out_trusted,root.crt,,BLANK,,BLANK,,,,-cert,_RESULT_DIR/test.certout_chainout.pem,-untrusted,"""" 0,no certout, -section,, -cmd,ir, -newkey,new.key,, -newkeypass,pass:,,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,, -certout,"""",, -out_trusted,root.crt,,BLANK,,BLANK,,, 0,certout missing arg, -section,, -cmd,ir, -newkey,new.key,, -newkeypass,pass:,,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,, -certout,,, -out_trusted,root.crt,,BLANK,,BLANK,,, 0,certout is non-existing directory and file, -section,, -cmd,ir, -newkey,new.key,, -newkeypass,pass:,,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,,BLANK,, -certout,idontexist/idontexist,, -out_trusted,root.crt,,BLANK,,BLANK,,, diff --git a/openssl/test/ssl-tests/08-npn.cnf b/openssl/test/ssl-tests/08-npn.cnf index f38b3f697..1931d02de 100644 --- a/openssl/test/ssl-tests/08-npn.cnf +++ b/openssl/test/ssl-tests/08-npn.cnf @@ -1,6 +1,6 @@ # Generated with generate_ssl_tests.pl -num_tests = 20 +num_tests = 22 test-0 = 0-npn-simple test-1 = 1-npn-client-finds-match @@ -8,20 +8,22 @@ test-2 = 2-npn-client-honours-server-pref test-3 = 3-npn-client-first-pref-on-mismatch test-4 = 4-npn-no-server-support test-5 = 5-npn-no-client-support -test-6 = 6-npn-with-sni-no-context-switch -test-7 = 7-npn-with-sni-context-switch -test-8 = 8-npn-selected-sni-server-supports-npn -test-9 = 9-npn-selected-sni-server-does-not-support-npn -test-10 = 10-alpn-preferred-over-npn -test-11 = 11-sni-npn-preferred-over-alpn -test-12 = 12-npn-simple-resumption -test-13 = 13-npn-server-switch-resumption -test-14 = 14-npn-client-switch-resumption -test-15 = 15-npn-client-first-pref-on-mismatch-resumption -test-16 = 16-npn-no-server-support-resumption -test-17 = 17-npn-no-client-support-resumption -test-18 = 18-alpn-preferred-over-npn-resumption -test-19 = 19-npn-used-if-alpn-not-supported-resumption +test-6 = 6-npn-empty-client-list +test-7 = 7-npn-empty-server-list +test-8 = 8-npn-with-sni-no-context-switch +test-9 = 9-npn-with-sni-context-switch +test-10 = 10-npn-selected-sni-server-supports-npn +test-11 = 11-npn-selected-sni-server-does-not-support-npn +test-12 = 12-alpn-preferred-over-npn +test-13 = 13-sni-npn-preferred-over-alpn +test-14 = 14-npn-simple-resumption +test-15 = 15-npn-server-switch-resumption +test-16 = 16-npn-client-switch-resumption +test-17 = 17-npn-client-first-pref-on-mismatch-resumption +test-18 = 18-npn-no-server-support-resumption +test-19 = 19-npn-no-client-support-resumption +test-20 = 20-alpn-preferred-over-npn-resumption +test-21 = 21-npn-used-if-alpn-not-supported-resumption # =========================================================== [0-npn-simple] @@ -206,253 +208,318 @@ NPNProtocols = foo # =========================================================== -[6-npn-with-sni-no-context-switch] -ssl_conf = 6-npn-with-sni-no-context-switch-ssl +[6-npn-empty-client-list] +ssl_conf = 6-npn-empty-client-list-ssl -[6-npn-with-sni-no-context-switch-ssl] -server = 6-npn-with-sni-no-context-switch-server -client = 6-npn-with-sni-no-context-switch-client -server2 = 6-npn-with-sni-no-context-switch-server2 +[6-npn-empty-client-list-ssl] +server = 6-npn-empty-client-list-server +client = 6-npn-empty-client-list-client -[6-npn-with-sni-no-context-switch-server] +[6-npn-empty-client-list-server] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[6-npn-with-sni-no-context-switch-server2] +[6-npn-empty-client-list-client] +CipherString = DEFAULT +MaxProtocol = TLSv1.2 +VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem +VerifyMode = Peer + +[test-6] +ExpectedClientAlert = HandshakeFailure +ExpectedResult = ClientFail +server = 6-npn-empty-client-list-server-extra +client = 6-npn-empty-client-list-client-extra + +[6-npn-empty-client-list-server-extra] +NPNProtocols = foo + +[6-npn-empty-client-list-client-extra] +NPNProtocols = + + +# =========================================================== + +[7-npn-empty-server-list] +ssl_conf = 7-npn-empty-server-list-ssl + +[7-npn-empty-server-list-ssl] +server = 7-npn-empty-server-list-server +client = 7-npn-empty-server-list-client + +[7-npn-empty-server-list-server] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[6-npn-with-sni-no-context-switch-client] +[7-npn-empty-server-list-client] CipherString = DEFAULT MaxProtocol = TLSv1.2 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem VerifyMode = Peer -[test-6] +[test-7] +ExpectedNPNProtocol = foo +server = 7-npn-empty-server-list-server-extra +client = 7-npn-empty-server-list-client-extra + +[7-npn-empty-server-list-server-extra] +NPNProtocols = + +[7-npn-empty-server-list-client-extra] +NPNProtocols = foo + + +# =========================================================== + +[8-npn-with-sni-no-context-switch] +ssl_conf = 8-npn-with-sni-no-context-switch-ssl + +[8-npn-with-sni-no-context-switch-ssl] +server = 8-npn-with-sni-no-context-switch-server +client = 8-npn-with-sni-no-context-switch-client +server2 = 8-npn-with-sni-no-context-switch-server2 + +[8-npn-with-sni-no-context-switch-server] +Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem +CipherString = DEFAULT +PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem + +[8-npn-with-sni-no-context-switch-server2] +Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem +CipherString = DEFAULT +PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem + +[8-npn-with-sni-no-context-switch-client] +CipherString = DEFAULT +MaxProtocol = TLSv1.2 +VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem +VerifyMode = Peer + +[test-8] ExpectedNPNProtocol = foo ExpectedServerName = server1 -server = 6-npn-with-sni-no-context-switch-server-extra -server2 = 6-npn-with-sni-no-context-switch-server2-extra -client = 6-npn-with-sni-no-context-switch-client-extra +server = 8-npn-with-sni-no-context-switch-server-extra +server2 = 8-npn-with-sni-no-context-switch-server2-extra +client = 8-npn-with-sni-no-context-switch-client-extra -[6-npn-with-sni-no-context-switch-server-extra] +[8-npn-with-sni-no-context-switch-server-extra] NPNProtocols = foo ServerNameCallback = IgnoreMismatch -[6-npn-with-sni-no-context-switch-server2-extra] +[8-npn-with-sni-no-context-switch-server2-extra] NPNProtocols = bar -[6-npn-with-sni-no-context-switch-client-extra] +[8-npn-with-sni-no-context-switch-client-extra] NPNProtocols = foo,bar ServerName = server1 # =========================================================== -[7-npn-with-sni-context-switch] -ssl_conf = 7-npn-with-sni-context-switch-ssl +[9-npn-with-sni-context-switch] +ssl_conf = 9-npn-with-sni-context-switch-ssl -[7-npn-with-sni-context-switch-ssl] -server = 7-npn-with-sni-context-switch-server -client = 7-npn-with-sni-context-switch-client -server2 = 7-npn-with-sni-context-switch-server2 +[9-npn-with-sni-context-switch-ssl] +server = 9-npn-with-sni-context-switch-server +client = 9-npn-with-sni-context-switch-client +server2 = 9-npn-with-sni-context-switch-server2 -[7-npn-with-sni-context-switch-server] +[9-npn-with-sni-context-switch-server] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[7-npn-with-sni-context-switch-server2] +[9-npn-with-sni-context-switch-server2] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[7-npn-with-sni-context-switch-client] +[9-npn-with-sni-context-switch-client] CipherString = DEFAULT MaxProtocol = TLSv1.2 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem VerifyMode = Peer -[test-7] +[test-9] ExpectedNPNProtocol = bar ExpectedServerName = server2 -server = 7-npn-with-sni-context-switch-server-extra -server2 = 7-npn-with-sni-context-switch-server2-extra -client = 7-npn-with-sni-context-switch-client-extra +server = 9-npn-with-sni-context-switch-server-extra +server2 = 9-npn-with-sni-context-switch-server2-extra +client = 9-npn-with-sni-context-switch-client-extra -[7-npn-with-sni-context-switch-server-extra] +[9-npn-with-sni-context-switch-server-extra] NPNProtocols = foo ServerNameCallback = IgnoreMismatch -[7-npn-with-sni-context-switch-server2-extra] +[9-npn-with-sni-context-switch-server2-extra] NPNProtocols = bar -[7-npn-with-sni-context-switch-client-extra] +[9-npn-with-sni-context-switch-client-extra] NPNProtocols = foo,bar ServerName = server2 # =========================================================== -[8-npn-selected-sni-server-supports-npn] -ssl_conf = 8-npn-selected-sni-server-supports-npn-ssl +[10-npn-selected-sni-server-supports-npn] +ssl_conf = 10-npn-selected-sni-server-supports-npn-ssl -[8-npn-selected-sni-server-supports-npn-ssl] -server = 8-npn-selected-sni-server-supports-npn-server -client = 8-npn-selected-sni-server-supports-npn-client -server2 = 8-npn-selected-sni-server-supports-npn-server2 +[10-npn-selected-sni-server-supports-npn-ssl] +server = 10-npn-selected-sni-server-supports-npn-server +client = 10-npn-selected-sni-server-supports-npn-client +server2 = 10-npn-selected-sni-server-supports-npn-server2 -[8-npn-selected-sni-server-supports-npn-server] +[10-npn-selected-sni-server-supports-npn-server] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[8-npn-selected-sni-server-supports-npn-server2] +[10-npn-selected-sni-server-supports-npn-server2] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[8-npn-selected-sni-server-supports-npn-client] +[10-npn-selected-sni-server-supports-npn-client] CipherString = DEFAULT MaxProtocol = TLSv1.2 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem VerifyMode = Peer -[test-8] +[test-10] ExpectedNPNProtocol = bar ExpectedServerName = server2 -server = 8-npn-selected-sni-server-supports-npn-server-extra -server2 = 8-npn-selected-sni-server-supports-npn-server2-extra -client = 8-npn-selected-sni-server-supports-npn-client-extra +server = 10-npn-selected-sni-server-supports-npn-server-extra +server2 = 10-npn-selected-sni-server-supports-npn-server2-extra +client = 10-npn-selected-sni-server-supports-npn-client-extra -[8-npn-selected-sni-server-supports-npn-server-extra] +[10-npn-selected-sni-server-supports-npn-server-extra] ServerNameCallback = IgnoreMismatch -[8-npn-selected-sni-server-supports-npn-server2-extra] +[10-npn-selected-sni-server-supports-npn-server2-extra] NPNProtocols = bar -[8-npn-selected-sni-server-supports-npn-client-extra] +[10-npn-selected-sni-server-supports-npn-client-extra] NPNProtocols = foo,bar ServerName = server2 # =========================================================== -[9-npn-selected-sni-server-does-not-support-npn] -ssl_conf = 9-npn-selected-sni-server-does-not-support-npn-ssl +[11-npn-selected-sni-server-does-not-support-npn] +ssl_conf = 11-npn-selected-sni-server-does-not-support-npn-ssl -[9-npn-selected-sni-server-does-not-support-npn-ssl] -server = 9-npn-selected-sni-server-does-not-support-npn-server -client = 9-npn-selected-sni-server-does-not-support-npn-client -server2 = 9-npn-selected-sni-server-does-not-support-npn-server2 +[11-npn-selected-sni-server-does-not-support-npn-ssl] +server = 11-npn-selected-sni-server-does-not-support-npn-server +client = 11-npn-selected-sni-server-does-not-support-npn-client +server2 = 11-npn-selected-sni-server-does-not-support-npn-server2 -[9-npn-selected-sni-server-does-not-support-npn-server] +[11-npn-selected-sni-server-does-not-support-npn-server] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[9-npn-selected-sni-server-does-not-support-npn-server2] +[11-npn-selected-sni-server-does-not-support-npn-server2] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[9-npn-selected-sni-server-does-not-support-npn-client] +[11-npn-selected-sni-server-does-not-support-npn-client] CipherString = DEFAULT MaxProtocol = TLSv1.2 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem VerifyMode = Peer -[test-9] +[test-11] ExpectedServerName = server2 -server = 9-npn-selected-sni-server-does-not-support-npn-server-extra -client = 9-npn-selected-sni-server-does-not-support-npn-client-extra +server = 11-npn-selected-sni-server-does-not-support-npn-server-extra +client = 11-npn-selected-sni-server-does-not-support-npn-client-extra -[9-npn-selected-sni-server-does-not-support-npn-server-extra] +[11-npn-selected-sni-server-does-not-support-npn-server-extra] NPNProtocols = bar ServerNameCallback = IgnoreMismatch -[9-npn-selected-sni-server-does-not-support-npn-client-extra] +[11-npn-selected-sni-server-does-not-support-npn-client-extra] NPNProtocols = foo,bar ServerName = server2 # =========================================================== -[10-alpn-preferred-over-npn] -ssl_conf = 10-alpn-preferred-over-npn-ssl +[12-alpn-preferred-over-npn] +ssl_conf = 12-alpn-preferred-over-npn-ssl -[10-alpn-preferred-over-npn-ssl] -server = 10-alpn-preferred-over-npn-server -client = 10-alpn-preferred-over-npn-client +[12-alpn-preferred-over-npn-ssl] +server = 12-alpn-preferred-over-npn-server +client = 12-alpn-preferred-over-npn-client -[10-alpn-preferred-over-npn-server] +[12-alpn-preferred-over-npn-server] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[10-alpn-preferred-over-npn-client] +[12-alpn-preferred-over-npn-client] CipherString = DEFAULT MaxProtocol = TLSv1.2 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem VerifyMode = Peer -[test-10] +[test-12] ExpectedALPNProtocol = foo -server = 10-alpn-preferred-over-npn-server-extra -client = 10-alpn-preferred-over-npn-client-extra +server = 12-alpn-preferred-over-npn-server-extra +client = 12-alpn-preferred-over-npn-client-extra -[10-alpn-preferred-over-npn-server-extra] +[12-alpn-preferred-over-npn-server-extra] ALPNProtocols = foo NPNProtocols = bar -[10-alpn-preferred-over-npn-client-extra] +[12-alpn-preferred-over-npn-client-extra] ALPNProtocols = foo NPNProtocols = bar # =========================================================== -[11-sni-npn-preferred-over-alpn] -ssl_conf = 11-sni-npn-preferred-over-alpn-ssl +[13-sni-npn-preferred-over-alpn] +ssl_conf = 13-sni-npn-preferred-over-alpn-ssl -[11-sni-npn-preferred-over-alpn-ssl] -server = 11-sni-npn-preferred-over-alpn-server -client = 11-sni-npn-preferred-over-alpn-client -server2 = 11-sni-npn-preferred-over-alpn-server2 +[13-sni-npn-preferred-over-alpn-ssl] +server = 13-sni-npn-preferred-over-alpn-server +client = 13-sni-npn-preferred-over-alpn-client +server2 = 13-sni-npn-preferred-over-alpn-server2 -[11-sni-npn-preferred-over-alpn-server] +[13-sni-npn-preferred-over-alpn-server] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[11-sni-npn-preferred-over-alpn-server2] +[13-sni-npn-preferred-over-alpn-server2] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[11-sni-npn-preferred-over-alpn-client] +[13-sni-npn-preferred-over-alpn-client] CipherString = DEFAULT MaxProtocol = TLSv1.2 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem VerifyMode = Peer -[test-11] +[test-13] ExpectedNPNProtocol = bar ExpectedServerName = server2 -server = 11-sni-npn-preferred-over-alpn-server-extra -server2 = 11-sni-npn-preferred-over-alpn-server2-extra -client = 11-sni-npn-preferred-over-alpn-client-extra +server = 13-sni-npn-preferred-over-alpn-server-extra +server2 = 13-sni-npn-preferred-over-alpn-server2-extra +client = 13-sni-npn-preferred-over-alpn-client-extra -[11-sni-npn-preferred-over-alpn-server-extra] +[13-sni-npn-preferred-over-alpn-server-extra] ALPNProtocols = foo ServerNameCallback = IgnoreMismatch -[11-sni-npn-preferred-over-alpn-server2-extra] +[13-sni-npn-preferred-over-alpn-server2-extra] NPNProtocols = bar -[11-sni-npn-preferred-over-alpn-client-extra] +[13-sni-npn-preferred-over-alpn-client-extra] ALPNProtocols = foo NPNProtocols = bar ServerName = server2 @@ -460,356 +527,356 @@ ServerName = server2 # =========================================================== -[12-npn-simple-resumption] -ssl_conf = 12-npn-simple-resumption-ssl +[14-npn-simple-resumption] +ssl_conf = 14-npn-simple-resumption-ssl -[12-npn-simple-resumption-ssl] -server = 12-npn-simple-resumption-server -client = 12-npn-simple-resumption-client -resume-server = 12-npn-simple-resumption-server -resume-client = 12-npn-simple-resumption-client +[14-npn-simple-resumption-ssl] +server = 14-npn-simple-resumption-server +client = 14-npn-simple-resumption-client +resume-server = 14-npn-simple-resumption-server +resume-client = 14-npn-simple-resumption-client -[12-npn-simple-resumption-server] +[14-npn-simple-resumption-server] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[12-npn-simple-resumption-client] +[14-npn-simple-resumption-client] CipherString = DEFAULT MaxProtocol = TLSv1.2 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem VerifyMode = Peer -[test-12] +[test-14] ExpectedNPNProtocol = foo HandshakeMode = Resume ResumptionExpected = Yes -server = 12-npn-simple-resumption-server-extra -resume-server = 12-npn-simple-resumption-server-extra -client = 12-npn-simple-resumption-client-extra -resume-client = 12-npn-simple-resumption-client-extra +server = 14-npn-simple-resumption-server-extra +resume-server = 14-npn-simple-resumption-server-extra +client = 14-npn-simple-resumption-client-extra +resume-client = 14-npn-simple-resumption-client-extra -[12-npn-simple-resumption-server-extra] +[14-npn-simple-resumption-server-extra] NPNProtocols = foo -[12-npn-simple-resumption-client-extra] +[14-npn-simple-resumption-client-extra] NPNProtocols = foo # =========================================================== -[13-npn-server-switch-resumption] -ssl_conf = 13-npn-server-switch-resumption-ssl +[15-npn-server-switch-resumption] +ssl_conf = 15-npn-server-switch-resumption-ssl -[13-npn-server-switch-resumption-ssl] -server = 13-npn-server-switch-resumption-server -client = 13-npn-server-switch-resumption-client -resume-server = 13-npn-server-switch-resumption-resume-server -resume-client = 13-npn-server-switch-resumption-client +[15-npn-server-switch-resumption-ssl] +server = 15-npn-server-switch-resumption-server +client = 15-npn-server-switch-resumption-client +resume-server = 15-npn-server-switch-resumption-resume-server +resume-client = 15-npn-server-switch-resumption-client -[13-npn-server-switch-resumption-server] +[15-npn-server-switch-resumption-server] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[13-npn-server-switch-resumption-resume-server] +[15-npn-server-switch-resumption-resume-server] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[13-npn-server-switch-resumption-client] +[15-npn-server-switch-resumption-client] CipherString = DEFAULT MaxProtocol = TLSv1.2 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem VerifyMode = Peer -[test-13] +[test-15] ExpectedNPNProtocol = baz HandshakeMode = Resume ResumptionExpected = Yes -server = 13-npn-server-switch-resumption-server-extra -resume-server = 13-npn-server-switch-resumption-resume-server-extra -client = 13-npn-server-switch-resumption-client-extra -resume-client = 13-npn-server-switch-resumption-client-extra +server = 15-npn-server-switch-resumption-server-extra +resume-server = 15-npn-server-switch-resumption-resume-server-extra +client = 15-npn-server-switch-resumption-client-extra +resume-client = 15-npn-server-switch-resumption-client-extra -[13-npn-server-switch-resumption-server-extra] +[15-npn-server-switch-resumption-server-extra] NPNProtocols = bar,foo -[13-npn-server-switch-resumption-resume-server-extra] +[15-npn-server-switch-resumption-resume-server-extra] NPNProtocols = baz,foo -[13-npn-server-switch-resumption-client-extra] +[15-npn-server-switch-resumption-client-extra] NPNProtocols = foo,bar,baz # =========================================================== -[14-npn-client-switch-resumption] -ssl_conf = 14-npn-client-switch-resumption-ssl +[16-npn-client-switch-resumption] +ssl_conf = 16-npn-client-switch-resumption-ssl -[14-npn-client-switch-resumption-ssl] -server = 14-npn-client-switch-resumption-server -client = 14-npn-client-switch-resumption-client -resume-server = 14-npn-client-switch-resumption-server -resume-client = 14-npn-client-switch-resumption-resume-client +[16-npn-client-switch-resumption-ssl] +server = 16-npn-client-switch-resumption-server +client = 16-npn-client-switch-resumption-client +resume-server = 16-npn-client-switch-resumption-server +resume-client = 16-npn-client-switch-resumption-resume-client -[14-npn-client-switch-resumption-server] +[16-npn-client-switch-resumption-server] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[14-npn-client-switch-resumption-client] +[16-npn-client-switch-resumption-client] CipherString = DEFAULT MaxProtocol = TLSv1.2 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem VerifyMode = Peer -[14-npn-client-switch-resumption-resume-client] +[16-npn-client-switch-resumption-resume-client] CipherString = DEFAULT MaxProtocol = TLSv1.2 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem VerifyMode = Peer -[test-14] +[test-16] ExpectedNPNProtocol = bar HandshakeMode = Resume ResumptionExpected = Yes -server = 14-npn-client-switch-resumption-server-extra -resume-server = 14-npn-client-switch-resumption-server-extra -client = 14-npn-client-switch-resumption-client-extra -resume-client = 14-npn-client-switch-resumption-resume-client-extra +server = 16-npn-client-switch-resumption-server-extra +resume-server = 16-npn-client-switch-resumption-server-extra +client = 16-npn-client-switch-resumption-client-extra +resume-client = 16-npn-client-switch-resumption-resume-client-extra -[14-npn-client-switch-resumption-server-extra] +[16-npn-client-switch-resumption-server-extra] NPNProtocols = foo,bar,baz -[14-npn-client-switch-resumption-client-extra] +[16-npn-client-switch-resumption-client-extra] NPNProtocols = foo,baz -[14-npn-client-switch-resumption-resume-client-extra] +[16-npn-client-switch-resumption-resume-client-extra] NPNProtocols = bar,baz # =========================================================== -[15-npn-client-first-pref-on-mismatch-resumption] -ssl_conf = 15-npn-client-first-pref-on-mismatch-resumption-ssl +[17-npn-client-first-pref-on-mismatch-resumption] +ssl_conf = 17-npn-client-first-pref-on-mismatch-resumption-ssl -[15-npn-client-first-pref-on-mismatch-resumption-ssl] -server = 15-npn-client-first-pref-on-mismatch-resumption-server -client = 15-npn-client-first-pref-on-mismatch-resumption-client -resume-server = 15-npn-client-first-pref-on-mismatch-resumption-resume-server -resume-client = 15-npn-client-first-pref-on-mismatch-resumption-client +[17-npn-client-first-pref-on-mismatch-resumption-ssl] +server = 17-npn-client-first-pref-on-mismatch-resumption-server +client = 17-npn-client-first-pref-on-mismatch-resumption-client +resume-server = 17-npn-client-first-pref-on-mismatch-resumption-resume-server +resume-client = 17-npn-client-first-pref-on-mismatch-resumption-client -[15-npn-client-first-pref-on-mismatch-resumption-server] +[17-npn-client-first-pref-on-mismatch-resumption-server] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[15-npn-client-first-pref-on-mismatch-resumption-resume-server] +[17-npn-client-first-pref-on-mismatch-resumption-resume-server] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[15-npn-client-first-pref-on-mismatch-resumption-client] +[17-npn-client-first-pref-on-mismatch-resumption-client] CipherString = DEFAULT MaxProtocol = TLSv1.2 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem VerifyMode = Peer -[test-15] +[test-17] ExpectedNPNProtocol = foo HandshakeMode = Resume ResumptionExpected = Yes -server = 15-npn-client-first-pref-on-mismatch-resumption-server-extra -resume-server = 15-npn-client-first-pref-on-mismatch-resumption-resume-server-extra -client = 15-npn-client-first-pref-on-mismatch-resumption-client-extra -resume-client = 15-npn-client-first-pref-on-mismatch-resumption-client-extra +server = 17-npn-client-first-pref-on-mismatch-resumption-server-extra +resume-server = 17-npn-client-first-pref-on-mismatch-resumption-resume-server-extra +client = 17-npn-client-first-pref-on-mismatch-resumption-client-extra +resume-client = 17-npn-client-first-pref-on-mismatch-resumption-client-extra -[15-npn-client-first-pref-on-mismatch-resumption-server-extra] +[17-npn-client-first-pref-on-mismatch-resumption-server-extra] NPNProtocols = bar -[15-npn-client-first-pref-on-mismatch-resumption-resume-server-extra] +[17-npn-client-first-pref-on-mismatch-resumption-resume-server-extra] NPNProtocols = baz -[15-npn-client-first-pref-on-mismatch-resumption-client-extra] +[17-npn-client-first-pref-on-mismatch-resumption-client-extra] NPNProtocols = foo,bar # =========================================================== -[16-npn-no-server-support-resumption] -ssl_conf = 16-npn-no-server-support-resumption-ssl +[18-npn-no-server-support-resumption] +ssl_conf = 18-npn-no-server-support-resumption-ssl -[16-npn-no-server-support-resumption-ssl] -server = 16-npn-no-server-support-resumption-server -client = 16-npn-no-server-support-resumption-client -resume-server = 16-npn-no-server-support-resumption-resume-server -resume-client = 16-npn-no-server-support-resumption-client +[18-npn-no-server-support-resumption-ssl] +server = 18-npn-no-server-support-resumption-server +client = 18-npn-no-server-support-resumption-client +resume-server = 18-npn-no-server-support-resumption-resume-server +resume-client = 18-npn-no-server-support-resumption-client -[16-npn-no-server-support-resumption-server] +[18-npn-no-server-support-resumption-server] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[16-npn-no-server-support-resumption-resume-server] +[18-npn-no-server-support-resumption-resume-server] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[16-npn-no-server-support-resumption-client] +[18-npn-no-server-support-resumption-client] CipherString = DEFAULT MaxProtocol = TLSv1.2 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem VerifyMode = Peer -[test-16] +[test-18] HandshakeMode = Resume ResumptionExpected = Yes -server = 16-npn-no-server-support-resumption-server-extra -client = 16-npn-no-server-support-resumption-client-extra -resume-client = 16-npn-no-server-support-resumption-client-extra +server = 18-npn-no-server-support-resumption-server-extra +client = 18-npn-no-server-support-resumption-client-extra +resume-client = 18-npn-no-server-support-resumption-client-extra -[16-npn-no-server-support-resumption-server-extra] +[18-npn-no-server-support-resumption-server-extra] NPNProtocols = foo -[16-npn-no-server-support-resumption-client-extra] +[18-npn-no-server-support-resumption-client-extra] NPNProtocols = foo # =========================================================== -[17-npn-no-client-support-resumption] -ssl_conf = 17-npn-no-client-support-resumption-ssl +[19-npn-no-client-support-resumption] +ssl_conf = 19-npn-no-client-support-resumption-ssl -[17-npn-no-client-support-resumption-ssl] -server = 17-npn-no-client-support-resumption-server -client = 17-npn-no-client-support-resumption-client -resume-server = 17-npn-no-client-support-resumption-server -resume-client = 17-npn-no-client-support-resumption-resume-client +[19-npn-no-client-support-resumption-ssl] +server = 19-npn-no-client-support-resumption-server +client = 19-npn-no-client-support-resumption-client +resume-server = 19-npn-no-client-support-resumption-server +resume-client = 19-npn-no-client-support-resumption-resume-client -[17-npn-no-client-support-resumption-server] +[19-npn-no-client-support-resumption-server] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[17-npn-no-client-support-resumption-client] +[19-npn-no-client-support-resumption-client] CipherString = DEFAULT MaxProtocol = TLSv1.2 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem VerifyMode = Peer -[17-npn-no-client-support-resumption-resume-client] +[19-npn-no-client-support-resumption-resume-client] CipherString = DEFAULT MaxProtocol = TLSv1.2 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem VerifyMode = Peer -[test-17] +[test-19] HandshakeMode = Resume ResumptionExpected = Yes -server = 17-npn-no-client-support-resumption-server-extra -resume-server = 17-npn-no-client-support-resumption-server-extra -client = 17-npn-no-client-support-resumption-client-extra +server = 19-npn-no-client-support-resumption-server-extra +resume-server = 19-npn-no-client-support-resumption-server-extra +client = 19-npn-no-client-support-resumption-client-extra -[17-npn-no-client-support-resumption-server-extra] +[19-npn-no-client-support-resumption-server-extra] NPNProtocols = foo -[17-npn-no-client-support-resumption-client-extra] +[19-npn-no-client-support-resumption-client-extra] NPNProtocols = foo # =========================================================== -[18-alpn-preferred-over-npn-resumption] -ssl_conf = 18-alpn-preferred-over-npn-resumption-ssl +[20-alpn-preferred-over-npn-resumption] +ssl_conf = 20-alpn-preferred-over-npn-resumption-ssl -[18-alpn-preferred-over-npn-resumption-ssl] -server = 18-alpn-preferred-over-npn-resumption-server -client = 18-alpn-preferred-over-npn-resumption-client -resume-server = 18-alpn-preferred-over-npn-resumption-resume-server -resume-client = 18-alpn-preferred-over-npn-resumption-client +[20-alpn-preferred-over-npn-resumption-ssl] +server = 20-alpn-preferred-over-npn-resumption-server +client = 20-alpn-preferred-over-npn-resumption-client +resume-server = 20-alpn-preferred-over-npn-resumption-resume-server +resume-client = 20-alpn-preferred-over-npn-resumption-client -[18-alpn-preferred-over-npn-resumption-server] +[20-alpn-preferred-over-npn-resumption-server] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[18-alpn-preferred-over-npn-resumption-resume-server] +[20-alpn-preferred-over-npn-resumption-resume-server] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[18-alpn-preferred-over-npn-resumption-client] +[20-alpn-preferred-over-npn-resumption-client] CipherString = DEFAULT MaxProtocol = TLSv1.2 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem VerifyMode = Peer -[test-18] +[test-20] ExpectedALPNProtocol = foo HandshakeMode = Resume ResumptionExpected = Yes -server = 18-alpn-preferred-over-npn-resumption-server-extra -resume-server = 18-alpn-preferred-over-npn-resumption-resume-server-extra -client = 18-alpn-preferred-over-npn-resumption-client-extra -resume-client = 18-alpn-preferred-over-npn-resumption-client-extra +server = 20-alpn-preferred-over-npn-resumption-server-extra +resume-server = 20-alpn-preferred-over-npn-resumption-resume-server-extra +client = 20-alpn-preferred-over-npn-resumption-client-extra +resume-client = 20-alpn-preferred-over-npn-resumption-client-extra -[18-alpn-preferred-over-npn-resumption-server-extra] +[20-alpn-preferred-over-npn-resumption-server-extra] NPNProtocols = bar -[18-alpn-preferred-over-npn-resumption-resume-server-extra] +[20-alpn-preferred-over-npn-resumption-resume-server-extra] ALPNProtocols = foo NPNProtocols = baz -[18-alpn-preferred-over-npn-resumption-client-extra] +[20-alpn-preferred-over-npn-resumption-client-extra] ALPNProtocols = foo NPNProtocols = bar,baz # =========================================================== -[19-npn-used-if-alpn-not-supported-resumption] -ssl_conf = 19-npn-used-if-alpn-not-supported-resumption-ssl +[21-npn-used-if-alpn-not-supported-resumption] +ssl_conf = 21-npn-used-if-alpn-not-supported-resumption-ssl -[19-npn-used-if-alpn-not-supported-resumption-ssl] -server = 19-npn-used-if-alpn-not-supported-resumption-server -client = 19-npn-used-if-alpn-not-supported-resumption-client -resume-server = 19-npn-used-if-alpn-not-supported-resumption-resume-server -resume-client = 19-npn-used-if-alpn-not-supported-resumption-client +[21-npn-used-if-alpn-not-supported-resumption-ssl] +server = 21-npn-used-if-alpn-not-supported-resumption-server +client = 21-npn-used-if-alpn-not-supported-resumption-client +resume-server = 21-npn-used-if-alpn-not-supported-resumption-resume-server +resume-client = 21-npn-used-if-alpn-not-supported-resumption-client -[19-npn-used-if-alpn-not-supported-resumption-server] +[21-npn-used-if-alpn-not-supported-resumption-server] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[19-npn-used-if-alpn-not-supported-resumption-resume-server] +[21-npn-used-if-alpn-not-supported-resumption-resume-server] Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem CipherString = DEFAULT PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem -[19-npn-used-if-alpn-not-supported-resumption-client] +[21-npn-used-if-alpn-not-supported-resumption-client] CipherString = DEFAULT MaxProtocol = TLSv1.2 VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem VerifyMode = Peer -[test-19] +[test-21] ExpectedNPNProtocol = baz HandshakeMode = Resume ResumptionExpected = Yes -server = 19-npn-used-if-alpn-not-supported-resumption-server-extra -resume-server = 19-npn-used-if-alpn-not-supported-resumption-resume-server-extra -client = 19-npn-used-if-alpn-not-supported-resumption-client-extra -resume-client = 19-npn-used-if-alpn-not-supported-resumption-client-extra +server = 21-npn-used-if-alpn-not-supported-resumption-server-extra +resume-server = 21-npn-used-if-alpn-not-supported-resumption-resume-server-extra +client = 21-npn-used-if-alpn-not-supported-resumption-client-extra +resume-client = 21-npn-used-if-alpn-not-supported-resumption-client-extra -[19-npn-used-if-alpn-not-supported-resumption-server-extra] +[21-npn-used-if-alpn-not-supported-resumption-server-extra] ALPNProtocols = foo NPNProtocols = bar -[19-npn-used-if-alpn-not-supported-resumption-resume-server-extra] +[21-npn-used-if-alpn-not-supported-resumption-resume-server-extra] NPNProtocols = baz -[19-npn-used-if-alpn-not-supported-resumption-client-extra] +[21-npn-used-if-alpn-not-supported-resumption-client-extra] ALPNProtocols = foo NPNProtocols = bar,baz diff --git a/openssl/test/ssl-tests/08-npn.cnf.in b/openssl/test/ssl-tests/08-npn.cnf.in index 30783e45e..0caed2100 100644 --- a/openssl/test/ssl-tests/08-npn.cnf.in +++ b/openssl/test/ssl-tests/08-npn.cnf.in @@ -1,5 +1,5 @@ # -*- mode: perl; -*- -# Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the Apache License 2.0 (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy @@ -110,6 +110,41 @@ our @tests = ( "ExpectedNPNProtocol" => undef, }, }, + { + name => "npn-empty-client-list", + server => { + extra => { + "NPNProtocols" => "foo", + }, + }, + client => { + extra => { + "NPNProtocols" => "", + }, + "MaxProtocol" => "TLSv1.2" + }, + test => { + "ExpectedResult" => "ClientFail", + "ExpectedClientAlert" => "HandshakeFailure" + }, + }, + { + name => "npn-empty-server-list", + server => { + extra => { + "NPNProtocols" => "", + }, + }, + client => { + extra => { + "NPNProtocols" => "foo", + }, + "MaxProtocol" => "TLSv1.2" + }, + test => { + "ExpectedNPNProtocol" => "foo" + }, + }, { name => "npn-with-sni-no-context-switch", server => { diff --git a/openssl/test/ssl-tests/09-alpn.cnf b/openssl/test/ssl-tests/09-alpn.cnf index e7e6cb953..dd668739a 100644 --- a/openssl/test/ssl-tests/09-alpn.cnf +++ b/openssl/test/ssl-tests/09-alpn.cnf @@ -1,6 +1,6 @@ # Generated with generate_ssl_tests.pl -num_tests = 16 +num_tests = 18 test-0 = 0-alpn-simple test-1 = 1-alpn-server-finds-match @@ -18,6 +18,8 @@ test-12 = 12-alpn-client-switch-resumption test-13 = 13-alpn-alert-on-mismatch-resumption test-14 = 14-alpn-no-server-support-resumption test-15 = 15-alpn-no-client-support-resumption +test-16 = 16-alpn-empty-client-list +test-17 = 17-alpn-empty-server-list # =========================================================== [0-alpn-simple] @@ -617,3 +619,65 @@ ALPNProtocols = foo ALPNProtocols = foo +# =========================================================== + +[16-alpn-empty-client-list] +ssl_conf = 16-alpn-empty-client-list-ssl + +[16-alpn-empty-client-list-ssl] +server = 16-alpn-empty-client-list-server +client = 16-alpn-empty-client-list-client + +[16-alpn-empty-client-list-server] +Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem +CipherString = DEFAULT +PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem + +[16-alpn-empty-client-list-client] +CipherString = DEFAULT +VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem +VerifyMode = Peer + +[test-16] +server = 16-alpn-empty-client-list-server-extra +client = 16-alpn-empty-client-list-client-extra + +[16-alpn-empty-client-list-server-extra] +ALPNProtocols = foo + +[16-alpn-empty-client-list-client-extra] +ALPNProtocols = + + +# =========================================================== + +[17-alpn-empty-server-list] +ssl_conf = 17-alpn-empty-server-list-ssl + +[17-alpn-empty-server-list-ssl] +server = 17-alpn-empty-server-list-server +client = 17-alpn-empty-server-list-client + +[17-alpn-empty-server-list-server] +Certificate = ${ENV::TEST_CERTS_DIR}/servercert.pem +CipherString = DEFAULT +PrivateKey = ${ENV::TEST_CERTS_DIR}/serverkey.pem + +[17-alpn-empty-server-list-client] +CipherString = DEFAULT +VerifyCAFile = ${ENV::TEST_CERTS_DIR}/rootcert.pem +VerifyMode = Peer + +[test-17] +ExpectedResult = ServerFail +ExpectedServerAlert = NoApplicationProtocol +server = 17-alpn-empty-server-list-server-extra +client = 17-alpn-empty-server-list-client-extra + +[17-alpn-empty-server-list-server-extra] +ALPNProtocols = + +[17-alpn-empty-server-list-client-extra] +ALPNProtocols = foo + + diff --git a/openssl/test/ssl-tests/09-alpn.cnf.in b/openssl/test/ssl-tests/09-alpn.cnf.in index 81330756c..73e9cbabb 100644 --- a/openssl/test/ssl-tests/09-alpn.cnf.in +++ b/openssl/test/ssl-tests/09-alpn.cnf.in @@ -1,5 +1,5 @@ # -*- mode: perl; -*- -# Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the Apache License 2.0 (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy @@ -322,4 +322,37 @@ our @tests = ( "ExpectedALPNProtocol" => undef, }, }, + { + name => "alpn-empty-client-list", + server => { + extra => { + "ALPNProtocols" => "foo", + }, + }, + client => { + extra => { + "ALPNProtocols" => "", + }, + }, + test => { + "ExpectedALPNProtocol" => undef, + }, + }, + { + name => "alpn-empty-server-list", + server => { + extra => { + "ALPNProtocols" => "", + }, + }, + client => { + extra => { + "ALPNProtocols" => "foo", + }, + }, + test => { + "ExpectedResult" => "ServerFail", + "ExpectedServerAlert" => "NoApplicationProtocol", + }, + }, ); diff --git a/openssl/test/sslapitest.c b/openssl/test/sslapitest.c index 2459c5e81..5a6b8b1d4 100644 --- a/openssl/test/sslapitest.c +++ b/openssl/test/sslapitest.c @@ -11936,6 +11936,367 @@ static int test_multi_resume(int idx) return testresult; } +static struct next_proto_st { + int serverlen; + unsigned char server[40]; + int clientlen; + unsigned char client[40]; + int expected_ret; + size_t selectedlen; + unsigned char selected[40]; +} next_proto_tests[] = { + { + 4, { 3, 'a', 'b', 'c' }, + 4, { 3, 'a', 'b', 'c' }, + OPENSSL_NPN_NEGOTIATED, + 3, { 'a', 'b', 'c' } + }, + { + 7, { 3, 'a', 'b', 'c', 2, 'a', 'b' }, + 4, { 3, 'a', 'b', 'c' }, + OPENSSL_NPN_NEGOTIATED, + 3, { 'a', 'b', 'c' } + }, + { + 7, { 2, 'a', 'b', 3, 'a', 'b', 'c', }, + 4, { 3, 'a', 'b', 'c' }, + OPENSSL_NPN_NEGOTIATED, + 3, { 'a', 'b', 'c' } + }, + { + 4, { 3, 'a', 'b', 'c' }, + 7, { 3, 'a', 'b', 'c', 2, 'a', 'b', }, + OPENSSL_NPN_NEGOTIATED, + 3, { 'a', 'b', 'c' } + }, + { + 4, { 3, 'a', 'b', 'c' }, + 7, { 2, 'a', 'b', 3, 'a', 'b', 'c'}, + OPENSSL_NPN_NEGOTIATED, + 3, { 'a', 'b', 'c' } + }, + { + 7, { 2, 'b', 'c', 3, 'a', 'b', 'c' }, + 7, { 2, 'a', 'b', 3, 'a', 'b', 'c'}, + OPENSSL_NPN_NEGOTIATED, + 3, { 'a', 'b', 'c' } + }, + { + 10, { 2, 'b', 'c', 3, 'a', 'b', 'c', 2, 'a', 'b' }, + 7, { 2, 'a', 'b', 3, 'a', 'b', 'c'}, + OPENSSL_NPN_NEGOTIATED, + 3, { 'a', 'b', 'c' } + }, + { + 4, { 3, 'b', 'c', 'd' }, + 4, { 3, 'a', 'b', 'c' }, + OPENSSL_NPN_NO_OVERLAP, + 3, { 'a', 'b', 'c' } + }, + { + 0, { 0 }, + 4, { 3, 'a', 'b', 'c' }, + OPENSSL_NPN_NO_OVERLAP, + 3, { 'a', 'b', 'c' } + }, + { + -1, { 0 }, + 4, { 3, 'a', 'b', 'c' }, + OPENSSL_NPN_NO_OVERLAP, + 3, { 'a', 'b', 'c' } + }, + { + 4, { 3, 'a', 'b', 'c' }, + 0, { 0 }, + OPENSSL_NPN_NO_OVERLAP, + 0, { 0 } + }, + { + 4, { 3, 'a', 'b', 'c' }, + -1, { 0 }, + OPENSSL_NPN_NO_OVERLAP, + 0, { 0 } + }, + { + 3, { 3, 'a', 'b', 'c' }, + 4, { 3, 'a', 'b', 'c' }, + OPENSSL_NPN_NO_OVERLAP, + 3, { 'a', 'b', 'c' } + }, + { + 4, { 3, 'a', 'b', 'c' }, + 3, { 3, 'a', 'b', 'c' }, + OPENSSL_NPN_NO_OVERLAP, + 0, { 0 } + } +}; + +static int test_select_next_proto(int idx) +{ + struct next_proto_st *np = &next_proto_tests[idx]; + int ret = 0; + unsigned char *out, *client, *server; + unsigned char outlen; + unsigned int clientlen, serverlen; + + if (np->clientlen == -1) { + client = NULL; + clientlen = 0; + } else { + client = np->client; + clientlen = (unsigned int)np->clientlen; + } + if (np->serverlen == -1) { + server = NULL; + serverlen = 0; + } else { + server = np->server; + serverlen = (unsigned int)np->serverlen; + } + + if (!TEST_int_eq(SSL_select_next_proto(&out, &outlen, server, serverlen, + client, clientlen), + np->expected_ret)) + goto err; + + if (np->selectedlen == 0) { + if (!TEST_ptr_null(out) || !TEST_uchar_eq(outlen, 0)) + goto err; + } else { + if (!TEST_mem_eq(out, outlen, np->selected, np->selectedlen)) + goto err; + } + + ret = 1; + err: + return ret; +} + +static const unsigned char fooprot[] = {3, 'f', 'o', 'o' }; +static const unsigned char barprot[] = {3, 'b', 'a', 'r' }; + +#if !defined(OPENSSL_NO_TLS1_2) && !defined(OPENSSL_NO_NEXTPROTONEG) +static int npn_advert_cb(SSL *ssl, const unsigned char **out, + unsigned int *outlen, void *arg) +{ + int *idx = (int *)arg; + + switch (*idx) { + default: + case 0: + *out = fooprot; + *outlen = sizeof(fooprot); + return SSL_TLSEXT_ERR_OK; + + case 1: + *outlen = 0; + return SSL_TLSEXT_ERR_OK; + + case 2: + return SSL_TLSEXT_ERR_NOACK; + } +} + +static int npn_select_cb(SSL *s, unsigned char **out, unsigned char *outlen, + const unsigned char *in, unsigned int inlen, void *arg) +{ + int *idx = (int *)arg; + + switch (*idx) { + case 0: + case 1: + *out = (unsigned char *)(fooprot + 1); + *outlen = *fooprot; + return SSL_TLSEXT_ERR_OK; + + case 3: + *out = (unsigned char *)(barprot + 1); + *outlen = *barprot; + return SSL_TLSEXT_ERR_OK; + + case 4: + *outlen = 0; + return SSL_TLSEXT_ERR_OK; + + default: + case 2: + return SSL_TLSEXT_ERR_ALERT_FATAL; + } +} + +/* + * Test the NPN callbacks + * Test 0: advert = foo, select = foo + * Test 1: advert = , select = foo + * Test 2: no advert + * Test 3: advert = foo, select = bar + * Test 4: advert = foo, select = (should fail) + */ +static int test_npn(int idx) +{ + SSL_CTX *sctx = NULL, *cctx = NULL; + SSL *serverssl = NULL, *clientssl = NULL; + int testresult = 0; + + if (!TEST_true(create_ssl_ctx_pair(libctx, TLS_server_method(), + TLS_client_method(), 0, TLS1_2_VERSION, + &sctx, &cctx, cert, privkey))) + goto end; + + SSL_CTX_set_next_protos_advertised_cb(sctx, npn_advert_cb, &idx); + SSL_CTX_set_next_proto_select_cb(cctx, npn_select_cb, &idx); + + if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL, + NULL))) + goto end; + + if (idx == 4) { + /* We don't allow empty selection of NPN, so this should fail */ + if (!TEST_false(create_ssl_connection(serverssl, clientssl, + SSL_ERROR_NONE))) + goto end; + } else { + const unsigned char *prot; + unsigned int protlen; + + if (!TEST_true(create_ssl_connection(serverssl, clientssl, + SSL_ERROR_NONE))) + goto end; + + SSL_get0_next_proto_negotiated(serverssl, &prot, &protlen); + switch (idx) { + case 0: + case 1: + if (!TEST_mem_eq(prot, protlen, fooprot + 1, *fooprot)) + goto end; + break; + case 2: + if (!TEST_uint_eq(protlen, 0)) + goto end; + break; + case 3: + if (!TEST_mem_eq(prot, protlen, barprot + 1, *barprot)) + goto end; + break; + default: + TEST_error("Should not get here"); + goto end; + } + } + + testresult = 1; + end: + SSL_free(serverssl); + SSL_free(clientssl); + SSL_CTX_free(sctx); + SSL_CTX_free(cctx); + + return testresult; +} +#endif /* !defined(OPENSSL_NO_TLS1_2) && !defined(OPENSSL_NO_NEXTPROTONEG) */ + +static int alpn_select_cb2(SSL *ssl, const unsigned char **out, + unsigned char *outlen, const unsigned char *in, + unsigned int inlen, void *arg) +{ + int *idx = (int *)arg; + + switch (*idx) { + case 0: + *out = (unsigned char *)(fooprot + 1); + *outlen = *fooprot; + return SSL_TLSEXT_ERR_OK; + + case 2: + *out = (unsigned char *)(barprot + 1); + *outlen = *barprot; + return SSL_TLSEXT_ERR_OK; + + case 3: + *outlen = 0; + return SSL_TLSEXT_ERR_OK; + + default: + case 1: + return SSL_TLSEXT_ERR_ALERT_FATAL; + } + return 0; +} + +/* + * Test the ALPN callbacks + * Test 0: client = foo, select = foo + * Test 1: client = , select = none + * Test 2: client = foo, select = bar (should fail) + * Test 3: client = foo, select = (should fail) + */ +static int test_alpn(int idx) +{ + SSL_CTX *sctx = NULL, *cctx = NULL; + SSL *serverssl = NULL, *clientssl = NULL; + int testresult = 0; + const unsigned char *prots = fooprot; + unsigned int protslen = sizeof(fooprot); + + if (!TEST_true(create_ssl_ctx_pair(libctx, TLS_server_method(), + TLS_client_method(), 0, 0, + &sctx, &cctx, cert, privkey))) + goto end; + + SSL_CTX_set_alpn_select_cb(sctx, alpn_select_cb2, &idx); + + if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL, + NULL))) + goto end; + + if (idx == 1) { + prots = NULL; + protslen = 0; + } + + /* SSL_set_alpn_protos returns 0 for success! */ + if (!TEST_false(SSL_set_alpn_protos(clientssl, prots, protslen))) + goto end; + + if (idx == 2 || idx == 3) { + /* We don't allow empty selection of NPN, so this should fail */ + if (!TEST_false(create_ssl_connection(serverssl, clientssl, + SSL_ERROR_NONE))) + goto end; + } else { + const unsigned char *prot; + unsigned int protlen; + + if (!TEST_true(create_ssl_connection(serverssl, clientssl, + SSL_ERROR_NONE))) + goto end; + + SSL_get0_alpn_selected(clientssl, &prot, &protlen); + switch (idx) { + case 0: + if (!TEST_mem_eq(prot, protlen, fooprot + 1, *fooprot)) + goto end; + break; + case 1: + if (!TEST_uint_eq(protlen, 0)) + goto end; + break; + default: + TEST_error("Should not get here"); + goto end; + } + } + + testresult = 1; + end: + SSL_free(serverssl); + SSL_free(clientssl); + SSL_CTX_free(sctx); + SSL_CTX_free(cctx); + + return testresult; +} + OPT_TEST_DECLARE_USAGE("certfile privkeyfile srpvfile tmpfile provider config dhfile\n") int setup_tests(void) @@ -12252,6 +12613,11 @@ int setup_tests(void) ADD_ALL_TESTS(test_handshake_retry, 16); ADD_TEST(test_data_retry); ADD_ALL_TESTS(test_multi_resume, 5); + ADD_ALL_TESTS(test_select_next_proto, OSSL_NELEM(next_proto_tests)); +#if !defined(OPENSSL_NO_TLS1_2) && !defined(OPENSSL_NO_NEXTPROTONEG) + ADD_ALL_TESTS(test_npn, 5); +#endif + ADD_ALL_TESTS(test_alpn, 4); return 1; err: diff --git a/openssl/test/threadstest.c b/openssl/test/threadstest.c index 57bdfe1d0..bc6aa13dd 100644 --- a/openssl/test/threadstest.c +++ b/openssl/test/threadstest.c @@ -435,8 +435,8 @@ static int _torture_rcu(void) writer2_done = 0; rcu_torture_result = 1; - rcu_lock = ossl_rcu_lock_new(1); - if (!rcu_lock) + rcu_lock = ossl_rcu_lock_new(1, NULL); + if (rcu_lock == NULL) goto out; TEST_info("Staring rcu torture"); diff --git a/openssl/test/threadstest.h b/openssl/test/threadstest.h index 9f85cccf8..5b56764b8 100644 --- a/openssl/test/threadstest.h +++ b/openssl/test/threadstest.h @@ -1,5 +1,5 @@ /* - * Copyright 2021 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -145,6 +145,7 @@ static void *thread_run(void *arg) *(void **) (&f) = arg; f(); + OPENSSL_thread_stop(); return NULL; } diff --git a/openssl/test/x509_test.c b/openssl/test/x509_test.c index f5a67c63d..1c6e569a4 100644 --- a/openssl/test/x509_test.c +++ b/openssl/test/x509_test.c @@ -1,5 +1,5 @@ /* - * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2022-2024 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -7,7 +7,14 @@ * https://www.openssl.org/source/license.html */ +#define OPENSSL_SUPPRESS_DEPRECATED /* EVP_PKEY_get1/set1_RSA */ + #include +#include +#include +#include +#include +#include "crypto/x509.h" /* x509_st definition */ #include "testutil.h" static EVP_PKEY *pubkey = NULL; @@ -114,9 +121,73 @@ static int test_x509_crl_tbs_cache(void) return ret; } +static int test_asn1_item_verify(void) +{ + int ret = 0; + BIO *bio = NULL; + X509 *x509 = NULL; + const char *certfile; + const ASN1_BIT_STRING *sig = NULL; + const X509_ALGOR *alg = NULL; + EVP_PKEY *pkey; +#ifndef OPENSSL_NO_DEPRECATED_3_0 + RSA *rsa = NULL; +#endif + + if (!TEST_ptr(certfile = test_get_argument(0)) + || !TEST_ptr(bio = BIO_new_file(certfile, "r")) + || !TEST_ptr(x509 = PEM_read_bio_X509(bio, NULL, NULL, NULL)) + || !TEST_ptr(pkey = X509_get0_pubkey(x509))) + goto err; + +#ifndef OPENSSL_NO_DEPRECATED_3_0 + /* Issue #24575 requires legacy key but the test is useful anyway */ + if (!TEST_ptr(rsa = EVP_PKEY_get1_RSA(pkey))) + goto err; + + if (!TEST_int_gt(EVP_PKEY_set1_RSA(pkey, rsa), 0)) + goto err; +#endif + + X509_get0_signature(&sig, &alg, x509); + + if (!TEST_int_gt(ASN1_item_verify(ASN1_ITEM_rptr(X509_CINF), + (X509_ALGOR *)alg, (ASN1_BIT_STRING *)sig, + &x509->cert_info, pkey), 0)) + goto err; + + ERR_set_mark(); + if (!TEST_int_lt(ASN1_item_verify(ASN1_ITEM_rptr(X509_CINF), + (X509_ALGOR *)alg, (ASN1_BIT_STRING *)sig, + NULL, pkey), 0)) { + ERR_clear_last_mark(); + goto err; + } + ERR_pop_to_mark(); + + ret = 1; + + err: +#ifndef OPENSSL_NO_DEPRECATED_3_0 + RSA_free(rsa); +#endif + X509_free(x509); + BIO_free(bio); + return ret; +} + +OPT_TEST_DECLARE_USAGE("\n") + int setup_tests(void) { const unsigned char *p; + int cnt; + + cnt = test_get_argument_count(); + if (cnt != 1) { + TEST_error("Must specify a certificate file self-signed with RSA-PSS.\n"); + return 0; + } p = pubkeydata; pubkey = d2i_PUBKEY(NULL, &p, sizeof(pubkeydata)); @@ -138,6 +209,7 @@ int setup_tests(void) ADD_TEST(test_x509_tbs_cache); ADD_TEST(test_x509_crl_tbs_cache); + ADD_TEST(test_asn1_item_verify); return 1; } diff --git a/openssl/util/check-format-commit.sh b/openssl/util/check-format-commit.sh new file mode 100755 index 000000000..7e712dc48 --- /dev/null +++ b/openssl/util/check-format-commit.sh @@ -0,0 +1,171 @@ +#!/bin/bash +# Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved. +# +# Licensed under the Apache License 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# You can obtain a copy in the file LICENSE in the source distribution +# or at https://www.openssl.org/source/license.html +# +# This script is a wrapper around check-format.pl. It accepts a commit sha +# value as input, and uses it to identify the files and ranges that were +# changed in that commit, filtering check-format.pl output only to lines that +# fall into the commits change ranges. +# + + +# List of Regexes to use when running check-format.pl. +# Style checks don't apply to any of these +EXCLUDED_FILE_REGEX=("\.pod" \ + "\.pl" \ + "\.pm" \ + "\.t" \ + "\.yml" \ + "\.sh") + +# Exit code for the script +EXIT_CODE=0 + +# Global vars + +# TEMPDIR is used to hold any files this script creates +# And is cleaned on EXIT with a trap function +TEMPDIR=$(mktemp -d /tmp/checkformat.XXXXXX) + +# TOPDIR always points to the root of the git tree we are working in +# used to locate the check-format.pl script +TOPDIR=$(git rev-parse --show-toplevel) + + +# cleanup handler function, returns us to the root of the git tree +# and erases our temp directory +cleanup() { + rm -rf $TEMPDIR + cd $TOPDIR +} + +trap cleanup EXIT + +# Get the canonical sha256 sum for the commit we are checking +# This lets us pass in symbolic ref names like master/etc and +# resolve them to sha256 sums easily +COMMIT=$(git rev-parse $1) + +# Fail gracefully if git rev-parse doesn't produce a valid +# commit +if [ $? -ne 0 ] +then + echo "$1 is not a valid revision" + exit 1 +fi + +# Create a iteratable list of files to check for a +# given commit. It produces output of the format +# , +touch $TEMPDIR/ranges.txt +git show $COMMIT | awk -v mycmt=$COMMIT ' + BEGIN {myfile=""} + /+{3}/ { + gsub(/b\//,"",$2); + myfile=$2 + } + /@@/ { + gsub(/+/,"",$3); + printf mycmt " " myfile " " $3 "\n" + }' >> $TEMPDIR/ranges.txt || true + +# filter out anything that matches on a filter regex +for i in ${EXCLUDED_FILE_REGEX[@]} +do + touch $TEMPDIR/ranges.filter + grep -v "$i" $TEMPDIR/ranges.txt >> $TEMPDIR/ranges.filter || true + REMAINING_FILES=$(wc -l $TEMPDIR/ranges.filter | awk '{print $1}') + if [ $REMAINING_FILES -eq 0 ] + then + echo "This commit has no files that require checking" + exit 0 + fi + mv $TEMPDIR/ranges.filter $TEMPDIR/ranges.txt +done + +# check out the files from the commit level. +# For each file name in ranges, we show that file at the commit +# level we are checking, and redirect it to the same path, relative +# to $TEMPDIR/check-format. This give us the full file to run +# check-format.pl on with line numbers matching the ranges in the +# $TEMPDIR/ranges.txt file +for j in $(grep $COMMIT $TEMPDIR/ranges.txt | awk '{print $2}') +do + FDIR=$(dirname $j) + mkdir -p $TEMPDIR/check-format/$FDIR + git show $COMMIT:$j > $TEMPDIR/check-format/$j +done + +# Now for each file in $TEMPDIR/check-format run check-format.pl +# Note that we use the %P formatter in the find utilty. This strips +# off the $TEMPDIR/check-format path prefix, leaving $j with the +# path to the file relative to the root of the source dir, so that +# output from check-format.pl looks correct, relative to the root +# of the git tree. +for j in $(find $TEMPDIR/check-format -type f -printf "%P\n") +do + range_start=() + range_end=() + + # Get the ranges for this file. Create 2 arrays. range_start contains + # the start lines for valid ranges from the commit. the range_end array + # contains the corresponding end line (note, since diff output gives us + # a line count for a change, the range_end[k] entry is actually + # range_start[k]+line count + for k in $(grep $COMMIT $TEMPDIR/ranges.txt | grep $j | awk '{print $3}') + do + RANGE=$k + RSTART=$(echo $RANGE | awk -F',' '{print $1}') + RLEN=$(echo $RANGE | awk -F',' '{print $2}') + let REND=$RSTART+$RLEN + range_start+=($RSTART) + range_end+=($REND) + done + + # Go to our checked out tree + cd $TEMPDIR/check-format + + # Actually run check-format.pl on the file, capturing the output + # in a temporary file. Note the format of check-patch.pl output is + # ::: + $TOPDIR/util/check-format.pl $j > $TEMPDIR/format-results.txt + + # Now we filter the check-format.pl output based on the changed lines + # captured in the range_start/end arrays + let maxidx=${#range_start[@]}-1 + for k in $(seq 0 1 $maxidx) + do + RSTART=${range_start[$k]} + REND=${range_end[$k]} + + # field 2 of check-format.pl output is the offending line number + # Check here if any line in that output falls between any of the + # start/end ranges defined in the range_start/range_end array. + # If it does fall in that range, print the entire line to stdout + # If anything is printed, have awk exit with a non-zero exit code + awk -v rstart=$RSTART -v rend=$REND -F':' ' + BEGIN {rc=0} + /:/ { + if (($2 >= rstart) && ($2 <= rend)) { + print $0; + rc=1 + } + } + END {exit rc;} + ' $TEMPDIR/format-results.txt + + # If awk exited with a non-zero code, this script will also exit + # with a non-zero code + if [ $? -ne 0 ] + then + EXIT_CODE=1 + fi + done +done + +# Exit with the recorded exit code above +exit $EXIT_CODE diff --git a/openssl/util/check-format-test-negatives.c b/openssl/util/check-format-test-negatives.c index 8b3b75db3..f6b1bfb31 100644 --- a/openssl/util/check-format-test-negatives.c +++ b/openssl/util/check-format-test-negatives.c @@ -1,5 +1,5 @@ /* - * Copyright 2007-2022 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 2007-2024 The OpenSSL Project Authors. All Rights Reserved. * Copyright Siemens AG 2015-2022 * * Licensed under the Apache License 2.0 (the "License"). You may not use @@ -335,9 +335,8 @@ size_t UTIL_url_encode(const char *source, int f() { c; - if (1) { + if (1) c; - } c; if (1) if (2) diff --git a/openssl/util/check-format.pl b/openssl/util/check-format.pl index e1a91bcc5..ef2c1920e 100755 --- a/openssl/util/check-format.pl +++ b/openssl/util/check-format.pl @@ -1,6 +1,6 @@ #! /usr/bin/env perl # -# Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved. # Copyright Siemens AG 2019-2022 # # Licensed under the Apache License 2.0 (the "License"). @@ -167,7 +167,7 @@ my $line_body_start; # number of line where last function body started, or 0 my $line_function_start; # number of line where last function definition started, used for $line_body_start my $last_function_header; # header containing name of last function defined, used if $line_body_start != 0 -my $line_opening_brace; # number of previous line with opening brace after do/while/for, optionally for if/else +my $line_opening_brace; # number of previous line with opening brace after if/do/while/for, optionally for 'else' my $keyword_opening_brace; # name of previous keyword, used if $line_opening_brace != 0 my $block_indent; # currently required normal indentation at block/statement level @@ -972,9 +972,12 @@ sub check_nested_nonblock_indents { # check for code block containing a single line/statement if ($line_before2 > 0 && !$outermost_level && # within function body $in_typedecl == 0 && @nested_indents == 0 && # neither within type declaration nor inside stmt/expr - m/^[\s@]*\}/) { # leading closing brace '}', any preceding blinded comment must not be matched + m/^[\s@]*\}\s*(\w*)/) { # leading closing brace '}', any preceding blinded comment must not be matched # TODO extend detection from single-line to potentially multi-line statement + my $next_word = $1; if ($line_opening_brace > 0 && + ($keyword_opening_brace ne "if" || + $extended_1_stmt || $next_word ne "else") && ($line_opening_brace == $line_before2 || $line_opening_brace == $line_before) && $contents_before =~ m/;/) { # there is at least one terminator ';', so there is some stmt @@ -1132,9 +1135,9 @@ sub check_nested_nonblock_indents { $line_body_start = $contents =~ m/LONG BODY/ ? 0 : $line if $line_function_start != 0; } } else { - $line_opening_brace = $line if $keyword_opening_brace =~ m/do|while|for/; + $line_opening_brace = $line if $keyword_opening_brace =~ m/if|do|while|for/; # using, not assigning, $keyword_opening_brace here because it could be on an earlier line - $line_opening_brace = $line if $keyword_opening_brace =~ m/if|else/ && $extended_1_stmt && + $line_opening_brace = $line if $keyword_opening_brace eq "else" && $extended_1_stmt && # TODO prevent false positives for if/else where braces around single-statement branches # should be avoided but only if all branches have just single statements # The following helps detecting the exception when handling multiple 'if ... else' branches: diff --git a/openssl/util/mkinstallvars.pl b/openssl/util/mkinstallvars.pl index 59a432d28..91d189b0f 100644 --- a/openssl/util/mkinstallvars.pl +++ b/openssl/util/mkinstallvars.pl @@ -1,5 +1,5 @@ #! /usr/bin/env perl -# Copyright 2021 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the Apache License 2.0 (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy @@ -11,44 +11,89 @@ # The result is a Perl module creating the package OpenSSL::safe::installdata. use File::Spec; +use List::Util qw(pairs); # These are expected to be set up as absolute directories -my @absolutes = qw(PREFIX); +my @absolutes = qw(PREFIX libdir); # These may be absolute directories, and if not, they are expected to be set up -# as subdirectories to PREFIX -my @subdirs = qw(BINDIR LIBDIR INCLUDEDIR APPLINKDIR ENGINESDIR MODULESDIR - PKGCONFIGDIR CMAKECONFIGDIR); +# as subdirectories to PREFIX or LIBDIR. The order of the pairs is important, +# since the LIBDIR subdirectories depend on the calculation of LIBDIR from +# PREFIX. +my @subdirs = pairs (PREFIX => [ qw(BINDIR LIBDIR INCLUDEDIR APPLINKDIR) ], + LIBDIR => [ qw(ENGINESDIR MODULESDIR PKGCONFIGDIR + CMAKECONFIGDIR) ]); +# For completeness, other expected variables +my @others = qw(VERSION LDLIBS); + +my %all = ( ); +foreach (@absolutes) { $all{$_} = 1 } +foreach (@subdirs) { foreach (@{$_->[1]}) { $all{$_} = 1 } } +foreach (@others) { $all{$_} = 1 } +print STDERR "DEBUG: all keys: ", join(", ", sort keys %all), "\n"; my %keys = (); +my %values = (); foreach (@ARGV) { (my $k, my $v) = m|^([^=]*)=(.*)$|; $keys{$k} = 1; - $ENV{$k} = $v; + push @{$values{$k}}, $v; } -foreach my $k (sort keys %keys) { - my $v = $ENV{$k}; - $v = File::Spec->rel2abs($v) if $v && grep { $k eq $_ } @absolutes; - $ENV{$k} = $v; +# warn if there are missing values, and also if there are unexpected values +foreach my $k (sort keys %all) { + warn "No value given for $k\n" unless $keys{$k}; } foreach my $k (sort keys %keys) { - my $v = $ENV{$k} || '.'; - - # Absolute paths for the subdir variables are computed. This provides - # the usual form of values for names that have become norm, known as GNU - # installation paths. - # For the benefit of those that need it, the subdirectories are preserved - # as they are, using the same variable names, suffixed with '_REL', if they - # are indeed subdirectories. - if (grep { $k eq $_ } @subdirs) { - if (File::Spec->file_name_is_absolute($v)) { - $ENV{"${k}_REL"} = File::Spec->abs2rel($v, $ENV{PREFIX}); - } else { - $ENV{"${k}_REL"} = $v; - $v = File::Spec->rel2abs($v, $ENV{PREFIX}); + warn "Unknown variable $k\n" unless $all{$k}; +} + +# This shouldn't be needed, but just in case we get relative paths that +# should be absolute, make sure they actually are. +foreach my $k (@absolutes) { + my $v = $values{$k} || [ '.' ]; + die "Can't have more than one $k\n" if scalar @$v > 1; + print STDERR "DEBUG: $k = $v->[0] => "; + $v = [ map { File::Spec->rel2abs($_) } @$v ]; + $values{$k} = $v; + print STDERR "$k = $v->[0]\n"; +} + +# Absolute paths for the subdir variables are computed. This provides +# the usual form of values for names that have become norm, known as GNU +# installation paths. +# For the benefit of those that need it, the subdirectories are preserved +# as they are, using the same variable names, suffixed with '_REL_{var}', +# if they are indeed subdirectories. The '{var}' part of the name tells +# which other variable value they are relative to. +foreach my $pair (@subdirs) { + my ($var, $subdir_vars) = @$pair; + foreach my $k (@$subdir_vars) { + my $kr = "${k}_REL_${var}"; + my $v2 = $values{$k} || [ '.' ]; + $values{$k} = []; # We're rebuilding it + print STDERR "DEBUG: $k = ", + (scalar @$v2 > 1 ? "[ " . join(", ", @$v2) . " ]" : $v2->[0]), + " => "; + foreach my $v (@$v2) { + if (File::Spec->file_name_is_absolute($v)) { + push @{$values{$k}}, $v; + push @{$values{$kr}}, + File::Spec->abs2rel($v, $values{$var}->[0]); + } else { + push @{$values{$kr}}, $v; + push @{$values{$k}}, + File::Spec->rel2abs($v, $values{$var}->[0]); + } } + print STDERR join(", ", + map { + my $v = $values{$_}; + "$_ = " . (scalar @$v > 1 + ? "[ " . join(", ", @$v) . " ]" + : $v->[0]); + } ($k, $kr)), + "\n"; } - $ENV{$k} = $v; } print <<_____; @@ -58,38 +103,51 @@ package OpenSSL::safe::installdata; use warnings; use Exporter; our \@ISA = qw(Exporter); -our \@EXPORT = qw(\$PREFIX - \$BINDIR \$BINDIR_REL - \$LIBDIR \$LIBDIR_REL - \$INCLUDEDIR \$INCLUDEDIR_REL - \$APPLINKDIR \$APPLINKDIR_REL - \$ENGINESDIR \$ENGINESDIR_REL - \$MODULESDIR \$MODULESDIR_REL - \$PKGCONFIGDIR \$PKGCONFIGDIR_REL - \$CMAKECONFIGDIR \$CMAKECONFIGDIR_REL - \$VERSION \@LDLIBS); - -our \$PREFIX = '$ENV{PREFIX}'; -our \$BINDIR = '$ENV{BINDIR}'; -our \$BINDIR_REL = '$ENV{BINDIR_REL}'; -our \$LIBDIR = '$ENV{LIBDIR}'; -our \$LIBDIR_REL = '$ENV{LIBDIR_REL}'; -our \$INCLUDEDIR = '$ENV{INCLUDEDIR}'; -our \$INCLUDEDIR_REL = '$ENV{INCLUDEDIR_REL}'; -our \$APPLINKDIR = '$ENV{APPLINKDIR}'; -our \$APPLINKDIR_REL = '$ENV{APPLINKDIR_REL}'; -our \$ENGINESDIR = '$ENV{ENGINESDIR}'; -our \$ENGINESDIR_REL = '$ENV{ENGINESDIR_REL}'; -our \$MODULESDIR = '$ENV{MODULESDIR}'; -our \$MODULESDIR_REL = '$ENV{MODULESDIR_REL}'; -our \$PKGCONFIGDIR = '$ENV{PKGCONFIGDIR}'; -our \$PKGCONFIGDIR_REL = '$ENV{PKGCONFIGDIR_REL}'; -our \$CMAKECONFIGDIR = '$ENV{CMAKECONFIGDIR}'; -our \$CMAKECONFIGDIR_REL = '$ENV{CMAKECONFIGDIR_REL}'; -our \$VERSION = '$ENV{VERSION}'; -our \@LDLIBS = +our \@EXPORT = qw( +_____ + +foreach my $k (@absolutes) { + print " \@$k\n"; +} +foreach my $pair (@subdirs) { + my ($var, $subdir_vars) = @$pair; + foreach my $k (@$subdir_vars) { + my $k2 = "${k}_REL_${var}"; + print " \@$k \@$k2\n"; + } +} + +print <<_____; + \$VERSION \@LDLIBS +); + +_____ + +foreach my $k (@absolutes) { + print "our \@$k" . ' ' x (27 - length($k)) . "= ( '", + join("', '", @{$values{$k}}), + "' );\n"; +} +foreach my $pair (@subdirs) { + my ($var, $subdir_vars) = @$pair; + foreach my $k (@$subdir_vars) { + my $k2 = "${k}_REL_${var}"; + print "our \@$k" . ' ' x (27 - length($k)) . "= ( '", + join("', '", @{$values{$k}}), + "' );\n"; + print "our \@$k2" . ' ' x (27 - length($k2)) . "= ( '", + join("', '", @{$values{$k2}}), + "' );\n"; + } +} + +print <<_____; +our \$VERSION = '$values{VERSION}->[0]'; +our \@LDLIBS = # Unix and Windows use space separation, VMS uses comma separation - split(/ +| *, */, '$ENV{LDLIBS}'); + \$^O eq 'VMS' + ? split(/ *, */, '$values{LDLIBS}->[0]') + : split(/ +/, '$values{LDLIBS}->[0]'); 1; _____ diff --git a/openssl/util/perl/OpenSSL/Test/Utils.pm b/openssl/util/perl/OpenSSL/Test/Utils.pm index dcff6a5c9..34eafc465 100644 --- a/openssl/util/perl/OpenSSL/Test/Utils.pm +++ b/openssl/util/perl/OpenSSL/Test/Utils.pm @@ -1,4 +1,4 @@ -# Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2016-2024 The OpenSSL Project Authors. All Rights Reserved. # # Licensed under the Apache License 2.0 (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy @@ -72,6 +72,8 @@ Returns an item from the %config hash in \$TOP/configdata.pm. =item B Return true if IPv4 / IPv6 is possible to use on the current system. +Additionally, B also checks how OpenSSL was configured, +i.e. if IPv6 was explicitly disabled with -DOPENSSL_USE_IPv6=0. =back @@ -80,6 +82,7 @@ Return true if IPv4 / IPv6 is possible to use on the current system. our %available_protocols; our %disabled; our %config; +our %target; my $configdata_loaded = 0; sub load_configdata { @@ -91,6 +94,7 @@ sub load_configdata { %available_protocols = %configdata::available_protocols; %disabled = %configdata::disabled; %config = %configdata::config; + %target = %configdata::target; }; $configdata_loaded = 1; } @@ -221,6 +225,18 @@ sub have_IPv4 { } sub have_IPv6 { + if ($have_IPv6 < 0) { + load_configdata() unless $configdata_loaded; + # If OpenSSL is configured with IPv6 explicitly disabled, no IPv6 + # related tests should be performed. In other words, pretend IPv6 + # isn't present. + $have_IPv6 = 0 + if grep { $_ eq 'OPENSSL_USE_IPV6=0' } @{$config{CPPDEFINES}}; + # Similarly, if a config target has explicitly disabled IPv6, no + # IPv6 related tests should be performed. + $have_IPv6 = 0 + if grep { $_ eq 'OPENSSL_USE_IPV6=0' } @{$target{defines}}; + } if ($have_IPv6 < 0) { $have_IPv6 = check_IP("::1"); } diff --git a/openssl/util/perl/TLSProxy/Message.pm b/openssl/util/perl/TLSProxy/Message.pm index 5f304a2cf..d1b108f5d 100644 --- a/openssl/util/perl/TLSProxy/Message.pm +++ b/openssl/util/perl/TLSProxy/Message.pm @@ -464,6 +464,19 @@ sub create_message ); } $message->parse(); + } elsif ($mt == MT_NEXT_PROTO) { + $message = TLSProxy::NextProto->new( + $isdtls, + $server, + $msgseq, + $msgfrag, + $msgfragoffs, + $data, + [@message_rec_list], + $startoffset, + [@message_frag_lens] + ); + $message->parse(); } else { #Unknown message type $message = TLSProxy::Message->new( diff --git a/openssl/util/perl/TLSProxy/NextProto.pm b/openssl/util/perl/TLSProxy/NextProto.pm new file mode 100644 index 000000000..0825ea744 --- /dev/null +++ b/openssl/util/perl/TLSProxy/NextProto.pm @@ -0,0 +1,62 @@ +# Copyright 2024 The OpenSSL Project Authors. All Rights Reserved. +# +# Licensed under the Apache License 2.0 (the "License"). You may not use +# this file except in compliance with the License. You can obtain a copy +# in the file LICENSE in the source distribution or at +# https://www.openssl.org/source/license.html + +use strict; + +package TLSProxy::NextProto; + +use vars '@ISA'; +push @ISA, 'TLSProxy::Message'; + +sub new +{ + my $class = shift; + my ($isdtls, + $server, + $msgseq, + $msgfrag, + $msgfragoffs, + $data, + $records, + $startoffset, + $message_frag_lens) = @_; + + my $self = $class->SUPER::new( + $isdtls, + $server, + TLSProxy::Message::MT_NEXT_PROTO, + $msgseq, + $msgfrag, + $msgfragoffs, + $data, + $records, + $startoffset, + $message_frag_lens); + + return $self; +} + +sub parse +{ + # We don't support parsing at the moment +} + +# This is supposed to reconstruct the on-the-wire message data following changes. +# For now though since we don't support parsing we just create an empty NextProto +# message - this capability is used in test_npn +sub set_message_contents +{ + my $self = shift; + my $data; + + $data = pack("C32", 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00); + $self->data($data); +} +1; diff --git a/openssl/util/perl/TLSProxy/Proxy.pm b/openssl/util/perl/TLSProxy/Proxy.pm index 06ee7c117..429dc8154 100644 --- a/openssl/util/perl/TLSProxy/Proxy.pm +++ b/openssl/util/perl/TLSProxy/Proxy.pm @@ -25,6 +25,7 @@ use TLSProxy::CertificateRequest; use TLSProxy::CertificateVerify; use TLSProxy::ServerKeyExchange; use TLSProxy::NewSessionTicket; +use TLSProxy::NextProto; my $have_IPv6; my $IP_factory;