Debdiff for Noble

** Changed in: openssl (Ubuntu)
       Status: New => Triaged

** Changed in: openssl (Ubuntu)
     Assignee: (unassigned) => Ponnuvel Palaniyappan (pponnuvel)

** Also affects: openssl (Ubuntu Stonking)
   Importance: Undecided
       Status: New

** Also affects: openssl (Ubuntu Jammy)
   Importance: Undecided
       Status: New

** Also affects: openssl (Ubuntu Resolute)
   Importance: Undecided
       Status: New

** Also affects: openssl (Ubuntu Noble)
   Importance: Undecided
       Status: New

** Also affects: openssl (Ubuntu Tenacious)
   Importance: Undecided
     Assignee: Ponnuvel Palaniyappan (pponnuvel)
       Status: Triaged

** Changed in: openssl (Ubuntu Tenacious)
       Status: Triaged => Fix Released

** Changed in: openssl (Ubuntu Stonking)
       Status: New => Fix Released

** Changed in: openssl (Ubuntu Resolute)
       Status: New => Fix Released

** Changed in: openssl (Ubuntu Noble)
       Status: New => Triaged

** Changed in: openssl (Ubuntu Jammy)
       Status: New => Triaged

** Changed in: openssl (Ubuntu Jammy)
     Assignee: (unassigned) => Ponnuvel Palaniyappan (pponnuvel)

** Changed in: openssl (Ubuntu Noble)
     Assignee: (unassigned) => Ponnuvel Palaniyappan (pponnuvel)

** Changed in: openssl (Ubuntu Tenacious)
     Assignee: Ponnuvel Palaniyappan (pponnuvel) => (unassigned)

** Description changed:

+ [Impact]
+ 
+ On Jammy (OpenSSL 3.0.2) and Noble (OpenSSL 3.0.13),
+ EVP_get_digestbyname() and EVP_get_cipherbyname() return NULL for valid
+ algorithm names that are only known to the providers. Examples are
+ "SHA2-256", "SHA2-384" and "AES-256-WRAP". The lookup only succeeds
+ after the process has fetched the algorithm explicitly (e.g. with
+ EVP_MD_fetch()), because that is what adds the name to the namemap. This
+ happens with and without FIPS.
+ 
+ Applications that use the legacy lookup API with provider-style names
+ therefore fail, or behave differently depending on what the process
+ happened to fetch earlier. One reported consequence is CMS with the FIPS
+ provider: RSA-OAEP/MGF1 digest parameters come out wrong, which affects
+ CMS clients such as certmonger. With the default provider this symptom
+ is often hidden, because other code has usually fetched the digests
+ already.
+ 
+ This is upstream OpenSSL issue #19338. It was fixed in OpenSSL 3.0.15 by
+ commit 1dc48db3c76b (cherry-picked from 454ca902c7d5), and Debian
+ bookworm carries the fix in 3.0.15-1~deb12u1. If the name isn't in the
+ namemap, the fixed code fetches the algorithm once, discards it, and
+ looks the name up again.
+ 
+ [Test Plan]
+ 
+ 1. On a fresh Jammy or Noble system (or LXD container), install python3
+ and the current libssl3 / libssl3t64.
+ 
+ 2. Download reproduce-digest-alias.py from this bug and run it in a fresh,
+    isolated process:
+ 
+      python3 -I -S reproduce-digest-alias.py; echo $?
+ 
+    For each name, the script calls EVP_get_digestbyname() before any explicit
+    fetch, then fetches with EVP_MD_fetch(), then looks the name up again.
+    Exit codes: 1 = bug reproduced, 0 = not reproduced, 2 = inconclusive.
+ 
+    Output before the fix (seen on jammy 3.0.2-0ubuntu1.30 and noble
+    3.0.13-0ubuntu3.16):
+ 
+      SHA2-256: before=NULL; fetch=default; after=resolved
+      SHA2-384: before=NULL; fetch=default; after=resolved
+      BUG REPRODUCED: valid digest aliases fail until explicitly fetched.
+      exit 1
+ 
+ 3. Enable -proposed and install the libssl3 / libssl3t64 and openssl packages
+    from it. Re-run the script. Expected:
+ 
+      SHA2-256: before=resolved; fetch=default; after=resolved
+      SHA2-384: before=resolved; fetch=default; after=resolved
+      NOT REPRODUCED: both aliases resolve before any explicit fetch.
+      exit 0
+ 
+ 4. On a FIPS-enabled system (Ubuntu Pro FIPS, where the FIPS provider is
+ active by default), repeat step 3 and check the output says fetch=fips
+ and exits 0.
+ 
+ 5. The package build runs the new upstream unit test,
+    test/recipes/30-test_evp_byname.t (evp_byname_test), which checks that
+    EVP_get_digestbyname("SHA2-256") and EVP_get_cipherbyname("AES-256-WRAP")
+    resolve in a fresh process. The build log for each architecture must show
+    this test and the rest of the test suite passing.
+ 
+ 6. Basic regression checks:
+ 
+      openssl dgst -sha256 /etc/hostname
+      openssl dgst -SHA2-256 /etc/hostname
+      echo test | openssl enc -aes-256-cbc -pbkdf2 -k x | openssl enc -d 
-aes-256-cbc -pbkdf2 -k x
+      python3 -c 'import hashlib, ssl; print(hashlib.sha256(b"x").hexdigest(), 
ssl.OPENSSL_VERSION)'
+ 
+ [Where problems could occur]
+ 
+ The change only affects the case where evp_get_digestbyname_ex() /
+ evp_get_cipherbyname_ex() can't find a name in the namemap. Before, they 
returned NULL straight away. Now they make one EVP_MD_fetch() / 
EVP_CIPHER_fetch() call with the same library context, free the result, and 
look the name up once more. A do_retry flag stops this from looping.
+ 
+ Possible regressions:
+  * Unknown names now cost an extra provider fetch before returning NULL. Code
+    that calls these functions repeatedly with names that don't exist could 
slow down slightly.
+  * Errors from the extra fetch are hidden with 
ERR_set_mark()/ERR_pop_to_mark(), so the error queue looks as it did before. A 
mistake here would show up as unexpected entries on the error queue.
+  * Lookups that used to fail now succeed. An application could depend on the 
old failure, for example by falling back to a different algorithm when the 
lookup returned NULL. It will now get the requested algorithm instead. This is 
the intended upstream behaviour.
+  * The fetch uses the default property query, so with FIPS enabled it goes
+    through the FIPS provider. An algorithm the FIPS provider doesn't offer 
still returns NULL, as before.
+ 
+ [Other Info]
+ 
+  * Upstream fix: 
https://github.com/openssl/openssl/commit/1dc48db3c76b7d36be34c3b707d084d364f41c83
+  * Upstream issue: https://github.com/openssl/openssl/issues/19338
+  * Debian: https://lists.debian.org/debian-release/2024/11/msg00238.html
+  * This bug exists only on Noble and Jammy; newer versions already contain 
the commit that fixes this.
+ 
+ ---
+ 
+ Original description:
+ 
  Ubuntu 24.04 LTS (Noble), `openssl` / `libssl3t64` `3.0.13-0ubuntu3.16`.
  
  In a fresh process, `EVP_get_digestbyname("SHA2-256")` and
  `EVP_get_digestbyname("SHA2-384")` return NULL. Both digests are
  available: explicit `EVP_MD_fetch()` calls succeed, after which the
  legacy lookups resolve correctly. Expected: both aliases resolve before
  an explicit fetch.
  
  This reproduces **with and without FIPS**. Run the attached direct
  reproducer:
  
-     python3 -I -S reproduce-digest-alias.py
+     python3 -I -S reproduce-digest-alias.py
  
  Exit 1 means reproduced; 0 means not reproduced; 2 means inconclusive.
  The identical script detects the defect using byte-identical Noble
  libcrypto binaries in native FIPS mode and a non-FIPS container. An
  OpenSSL 3.5.5 control resolves both aliases immediately. See `digest-
  alias-validation.txt`.
  
  Please disregard `reproduce-native-oaep-roundtrip.sh` as the primary
  reproducer. That script tested a downstream CMS symptom: incorrect
  OAEP/MGF1 digest parameters with the FIPS provider. Default-provider CMS
  operations can mask the underlying lookup defect. The original
  `validation-evidence.txt` remains historical evidence of that downstream
  failure, which can affect CMS-based clients such as certmonger.
  
  Please backport [OpenSSL fix
  
1dc48db3](https://github.com/openssl/openssl/commit/1dc48db3c76b7d36be34c3b707d084d364f41c83)
  for [issue #19338](https://github.com/openssl/openssl/issues/19338). It
  is included in OpenSSL 3.0.15; [Debian applied
  it](https://lists.debian.org/debian-release/2024/11/msg00238.html) in
  `3.0.15-1~deb12u1`. The inspected Noble source lacks it.
  
  Primary attachments: `reproduce-digest-alias.py`, `digest-alias-
  validation.txt`.

** Patch added: "lp2172322-noble.debdiff"
   
https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/2172322/+attachment/6017076/+files/lp2172322-noble.debdiff

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2172322

Title:
  Noble OpenSSL: digest aliases fail before an explicit fetch

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/2172322/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to