Skip to content

deps.ffmpeg: Update Mbed TLS to 3.6.7 - #3

Merged
zackees merged 1 commit into
obs-rust:masterfrom
rdoupe:deps/mbedtls-3.6.7
Oct 25, 2026
Merged

zackees merged 1 commit into
obs-rust:masterfrom
rdoupe:deps/mbedtls-3.6.7

Conversation

@rdoupe

@rdoupe rdoupe commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Description

Update Mbed TLS from 3.6.4 to 3.6.7 in deps.ffmpeg (macOS/Linux 60-mbedtls.zsh, Windows 60-mbedtls.ps1), and build librist on Windows against that Mbed TLS instead of the old copy bundled with librist (70-librist.ps1).

  • The pin moves from c765c831e5c2 (mbedtls-3.6.4) to 068ff080b369adfac81509f9b57b2afabaf82dc5, the commit the mbedtls-3.6.7 and v3.6.7 tags point to. The source is still the git repository at a fixed commit, as before.
  • 0001-enable-posix-threading-support.patch (macOS/Linux): rebased. The change is the same (MBEDTLS_THREADING_PTHREAD and MBEDTLS_THREADING_C on). The old second hunk applied only with fuzz 2, on 3.6.4 as well, because a context line changed from "mbed TLS" to "Mbed TLS". The new file applies with no fuzz and gives exactly the same mbedtls_config.h as the old one did with fuzz. Both hash entries in 60-mbedtls.zsh are updated.
  • 0002-enable-dtls-srtp-support.patch and 0001-enable-dtls-srtp-support-windows.patch: unchanged. They apply with no fuzz (offset only). Both are still needed: 3.6.7 still ships with MBEDTLS_SSL_DTLS_SRTP off, and libdatachannel needs it for WHIP/WebRTC.
  • librist on Windows. 70-librist.ps1 passed -Dbuiltin_mbedtls=true, which compiles the Mbed TLS sources bundled in librist 0.2.7's contrib/mbedtls. That copy is Mbed TLS 2.26.0 (2021, from the end-of-life 2.x line), so Windows RIST encryption was not using obs-deps' Mbed TLS at all. librist now builds against the Mbed TLS from 60-mbedtls.ps1, as it already does on macOS:
    • -Dbuiltin_mbedtls=false, plus -Dfallback_builtin=false. Without the second option, librist silently falls back to the bundled 2.26.0 copy when it can't find Mbed TLS (checked: it does exactly that). With it, configure fails instead.
    • A second meson cross file, mbedtls-<target>.txt, written by Configure, gives the include and library paths and bcrypt. The obs-deps Mbed TLS is static on Windows, and its entropy source calls BCryptGenRandom, which needs bcrypt.lib (Mbed TLS's own CMake adds it the same way, and so did the libsrt Windows patches).
    • Why this and not bumping the bundled copy: replacing librist's contrib/mbedtls would mean a multi-megabyte patch with a rewritten source list for the 3.x layout, carried until librist itself is updated, and it would still need its own bump next time. The switch is a few lines, matches macOS, and future Mbed TLS updates in obs-deps then cover librist too. librist 0.2.7 already builds against Mbed TLS 3.x on macOS and in the Linux AppImage.
  • Configure options are unchanged for Mbed TLS, libsrt, libdatachannel and FFmpeg. They are rebuilt by the release that contains this change.

Motivation and Context

Mbed TLS 3.6.7 (and 3.6.5/3.6.6 before it) fixes public advisories on the RTMPS client path (obs-outputs librtmp: certificate and handshake checks). Tracked in obs-rust/obs-studio#1121:

  • CVE-2026-49300: a malformed basicConstraints extension could make a certificate parse as a CA certificate.
  • CVE-2026-25832: the TLS 1.3 client accepted a HelloRetryRequest for a group it never offered.
  • CVE-2026-50581: TLS 1.2 extended master secret errors could be ignored.
  • CVE-2026-50583: a 1-byte overread when parsing a malformed ECC public key.
  • CVE-2026-25834: the TLS 1.2 client accepted a ServerKeyExchange signed with a signature algorithm it had disallowed.
  • CVE-2026-25833: a buffer underflow in x509_inet_pton_ipv6() (IPv6 server addresses).

The same Mbed TLS also serves libsrt, libdatachannel (WHIP DTLS) and, on macOS and now Windows, librist. The Linux AppImage gets the same Mbed TLS update through obs-rust/obs-studio-libs, validated A/B with the full app (RTMPS certificate cases, SRT and RIST encryption).

How Has This Been Tested?

Source. mbedtls-3.6.7 resolves to 068ff080b369adfac81509f9b57b2afabaf82dc5 on github.com/Mbed-TLS/mbedtls, the same commit as v3.6.7, and mbedtls-3.6.4 is an ancestor of it. The official release file mbedtls-3.6.7.tar.bz2 matches the release's mbedtls-3.6.7-sha256sum.txt (a7e8bcbe…12d11f6), and its tree is identical to the tag checkout with its framework submodule (diff -r, no differences). The tags are unsigned and Mbed TLS publishes no release signature, so that comparison is the check available.

Patches. Each patch was applied to a fresh export of the tag with GNU patch, using the same steps as apply_patch and Safe-Patch: the hash check, a reverse dry run, then -g 0 -f -p1. All three apply with --fuzz=0, and after applying, the reverse dry run detects them, so a second run skips them. The Windows patch was applied with --binary to a CRLF copy of mbedtls_config.h, the way patch.exe --binary sees it. The patched header defines MBEDTLS_THREADING_PTHREAD, MBEDTLS_THREADING_C (macOS/Linux) and MBEDTLS_SSL_DTLS_SRTP (all).

Build (Linux x86_64, clang 22, CMake 4.4, Ninja, meson 1.12). obs-deps does not build Linux packages, and the host has no zsh, so the linux-x86_64 Release path of 60-mbedtls.zsh, 60-srt.zsh and 70-librist.zsh was reproduced in bash with the same flags and options. Each set was built with Mbed TLS 3.6.4 (the current pin and patches) and 3.6.7 (this PR):

  • Mbed TLS, shared and static, with the patches above.
  • libsrt 1.5.7 (the deps.ffmpeg: Update libsrt to v1.5.7 #1 recipe) and libsrt 1.5.2 (the current master recipe). Both find Mbed TLS, enable encryption with it, and link it.
  • librist 0.2.7, three ways:
    • the macOS/Linux recipe (pkg-config): mbedcrypto found: YES 3.6.7;
    • the new Windows discovery (builtin_mbedtls=false, fallback_builtin=false, pkg-config disabled, paths only from the extra machine file): Library mbedcrypto found: YES, and librist NEEDs libmbedcrypto.so.16 from the obs-deps prefix. It also works when the file is passed as a second --cross-file, as the Windows script does, and with only the static libmbedcrypto.a present, the Windows situation: then librist embeds 3.6.7 code (3.6.7-only symbols such as psa_random_reseed) and nothing from 2.26.0;
    • the old Windows options (builtin_mbedtls=true): the library contains "mbed TLS 2.26.0" and 2.x-only functions such as mbedtls_arc4_crypt. Its static librist.a also exports 560 global mbedtls_* functions, the same names as obs-deps' own mbedcrypto.

ABI, 3.6.4 → 3.6.7 (obs-deps configuration). The sonames are unchanged (libmbedcrypto.so.16, libmbedx509.so.7, libmbedtls.so.21). Nothing is removed; 15, 2 and 2 functions are added. Every mbedtls_/psa_ symbol that libsrt 1.5.7 (14), libsrt 1.5.2 (14) and librist (40) import is exported by 3.6.7, and ldd -r reports no undefined symbols. libeverest and libp256m are still built, which build-deps.zsh expects.

Test suites, run on this build configuration (threading and DTLS-SRTP on, which the Linux AppImage's own validation didn't cover):

  • Mbed TLS (ctest, every test_suite_*, ENABLE_TESTING with the obs-deps patches): 3.6.7 passes 140/140 (43989 test cases, 0 failed, 11673 skipped by configuration); 3.6.4 passes 135/135.
  • libsrt 1.5.7 test-srt against Mbed TLS 3.6.7: 277/277 passed (including the mbedTLS CRYSPR crypto tests). The result is the same against 3.6.4.
  • librist 0.2.7 meson test, with Mbed TLS found the new Windows way, run serially 3 times each: 13/13 pass plus the 4 expected failures, on 3.6.7, on 3.6.4 and with the bundled 2.26.0. That covers the encryption tests (AES-128 and AES-256, both connection directions), the four mismatched-encryption cases that must fail, and unicast with 0/10/25 % packet loss.
    • The multicast suite was left out: it times out on this host, which has no multicast route, with every build.
    • Run in parallel, the packet-loss tests fail intermittently with every build, including 2.26.0, because of timing under load.

Not tested here. No Windows or macOS build was run: the Windows test machine was not available, and there is no macOS machine. The MSVC side of the librist change (cl/link with the extra cross file and bcrypt.lib) has therefore not been compiled. The meson logic it relies on was checked on Linux as above, and meson translates -L/-l to /LIBPATH: and .lib for MSVC. If Mbed TLS isn't found, the Windows librist build now stops at configure instead of falling back.

Follow-ups

  1. Cut a new obs-deps release that contains this change, so the CI-built Windows and macOS packages exist. On Windows, check in the librist configure log that it reports Library mbedcrypto found: YES.
  2. In obs-studio, bump the deps version and hashes in CMakePresets.json to that release.
  3. Windows and macOS A/B product checks with the full app, comparing the current deps against the new release, as on Linux: RTMPS against a local TLS server (good and bad certificates, a long stream), WHIP to a local endpoint (DTLS-SRTP through libdatachannel), SRT with encryption, and RIST with encryption (on Windows this is the first build where RIST uses obs-deps' Mbed TLS).

This change is independent of the libsrt update in #1 and the FFmpeg update in #2. It touches different files, and they can merge in any order.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

AI note: Claude Code (Claude Opus 5.5) wrote the patch and script changes, the checks, the commit message and this text under the submitter's direction, and ran the builds and tests above on the submitter's machines.

🤖 Generated with Claude Code

@rdoupe

rdoupe commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor Author

The failing "Build FFmpeg for Windows (x64)" job stopped inside libvpx 1.14.1, which this PR doesn't change. The linker reported LNK1136: invalid or corrupt file for two assembly objects (vpx_dsp_x86_add_noise_sse2_asm.obj, vp8_common_x86_dequantize_mmx_asm.obj) while make -j4 was building the Debug and Release libvpx configurations together. That looks like a parallel-build race on those objects, not a code problem. libvpx (30-) builds before Mbed TLS (60-) and librist (70-), so this run never got to the parts this PR changes. A rerun of the job is needed to see them build. If the rerun fails the same way, I'll look into the libvpx step.

@rdoupe

rdoupe commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

The Windows x64 blocker (libvpx with NASM 3.02) is fixed on master by #5 (6d86aef). This branch predates it, so its Windows FFmpeg jobs still build the old libvpx. A rebase onto master, or a re-run after merging master, should clear them. This is the Mbed TLS 3.6.7 update for the public advisories in obs-rust/obs-studio#1121 (RTMPS certificate checks), so it's the one to take first; #1 and #2 have the same stale base.

Update Mbed TLS from 3.6.4 to 3.6.7 (commit 068ff080b369, tag
mbedtls-3.6.7) to fix public advisories that affect the RTMPS client
(certificate and handshake checks), among them:
 * CVE-2026-49300: malformed basicConstraints could make a certificate
   parse as a CA certificate
   https://mbed-tls.readthedocs.io/en/latest/security-advisories/mbedtls-security-advisory-2026-07-x509-ca-bit-forgery-invalid-basicconstraints
 * CVE-2026-25832: TLS 1.3 client accepted a HelloRetryRequest for a
   group it never offered
   https://nvd.nist.gov/vuln/detail/CVE-2026-25832
 * CVE-2026-50581: TLS 1.2 extended master secret errors could be
   ignored
   https://nvd.nist.gov/vuln/detail/CVE-2026-50581
 * CVE-2026-50583: 1-byte overread parsing a malformed ECC public key
   https://nvd.nist.gov/vuln/detail/CVE-2026-50583
 * CVE-2026-25834: TLS 1.2 client accepted a ServerKeyExchange signed
   with a disallowed signature algorithm
   https://nvd.nist.gov/vuln/detail/CVE-2026-25834
 * CVE-2026-25833: buffer underflow in x509_inet_pton_ipv6() (IPv6
   server addresses)
   https://nvd.nist.gov/vuln/detail/CVE-2026-25833

Patch changes:
 * 0001-enable-posix-threading-support: Rebase onto 3.6.7. The change
   is the same (MBEDTLS_THREADING_PTHREAD and MBEDTLS_THREADING_C). The
   old second hunk only applied with fuzz 2, on 3.6.4 as well, because
   a context line now says "Mbed TLS" instead of "mbed TLS".
 * 0002-enable-dtls-srtp-support and
   0001-enable-dtls-srtp-support-windows: Unchanged. They apply with
   no fuzz, only an offset. Both are still needed: 3.6.7 still ships
   with MBEDTLS_SSL_DTLS_SRTP off, and libdatachannel needs it for
   WebRTC.

librist on Windows was built with -Dbuiltin_mbedtls=true, which
compiles the copy of Mbed TLS bundled with librist 0.2.7. That copy is
Mbed TLS 2.26.0. Build librist against the Mbed TLS from 60-mbedtls.ps1
instead, as macOS already does. Pass the include and library paths and
bcrypt (for the static mbedcrypto entropy source) through a second
meson cross file, and set -Dfallback_builtin=false so that librist
fails to configure instead of silently falling back to the bundled
copy if Mbed TLS is not found.

Refs obs-rust/obs-studio#1121

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zackees
zackees force-pushed the deps/mbedtls-3.6.7 branch from 58f6233 to 44af41c Compare October 23, 2026 04:12
@zackees

zackees commented Oct 23, 2026

Copy link
Copy Markdown
Member

Coordinator: rebased onto master, which now has the libvpx/NASM fix from #5, so the Windows FFmpeg build reruns (per obs-rust/obs-studio#1121).

@zackees zackees left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coordinator review: LGTM. Mbed TLS 3.6.4 -> 3.6.7 on all three platforms with the re-hashed threading patch. librist on Windows now links the Mbed TLS from 60-mbedtls.ps1 (builtin off, fallback off, -lbcrypt for the static mbedcrypto entropy source) so only one Mbed TLS ships. CI green after the rebase. Verdict: approve.

@zackees
zackees merged commit 2c71092 into obs-rust:master Oct 25, 2026
22 checks passed
@obs-rust-project-manager obs-rust-project-manager Bot moved this from Ready to merge to Done in obs-rust Multiview Oct 25, 2026
zackees added a commit to obs-rust/obs-deps-buildstream that referenced this pull request Oct 25, 2026
* Update libsrt to v1.5.7

Update libsrt from v1.5.3 to v1.5.7 (commit 899348d8318e, tag v1.5.7)
for three critical public advisories:
 * GHSA-6xg9-784j-24rm (CVE-2026-55869): KMREQ/KMRSP stack-based
   buffer overflow, fixed in v1.5.6
 * GHSA-4mc6-qmpp-g7gw (CVE-2026-55868): encryption state machine
   downgrade, fixed in v1.5.6
 * GHSA-m96h-3rc9-xx6h: heap buffer overflow, fixed in v1.5.7

0001-enable-proper-cmake-build-types.patch does not apply to v1.5.7.
It is now the same file as in obs-rust/obs-deps (rebased onto v1.5.7
in obs-rust/obs-deps#1), so both repositories carry one patch. The
change is the same for the non-Debug build types; for Debug it keeps
v1.5.7's rule that _DEBUG needs ENABLE_ASSERT.

The build options are unchanged.

Refs obs-rust/obs-studio#2372

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Update Mbed TLS to 3.6.7

Update Mbed TLS from 3.6.4 to 3.6.7 (release tarball
mbedtls-3.6.7.tar.bz2, SHA-256 a7e8bcbec0e6...) for the public
advisories that affect the RTMPS client, as obs-rust/obs-deps#3 did
for Windows and macOS. 0001-array-bounds-error-fix.patch still
applies.

Refs obs-rust/obs-studio#1121

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Zachary Vorhies <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants