Repository navigation
cmake: Add OpenSSL as an alternative to MbedTLS - #13676
connor-cihula wants to merge 1 commit into
Conversation
3cf488e to
096bdb2
Compare
Give Linux builds the option to choose OpenSSL as the crypto backend with `-DCRYPTO_BACKEND=openssl`. MbedTLS remains the default, but can be explicitly set with `-DCRYPTO_BACKEND=mbedtls`. MbedTLS updates have introduced breaking changes in minor releases, leading to issues like obsproject#11020. OpenSSL tends not to have this problem. Upstream librtmp added OpenSSL RTMPS support in commit 8251927. This is a backport from upstream, along with modifications to use non-deprecated OpenSSL APIs, per-RTMP TLS state, certificate verification, and frontend signature verification.
096bdb2 to
e448eb4
Compare
|
Thanks for reviewing @loqs, good catches. |
|
Note that downstream in Fedora, I explicitly indicated OpenSSL is a bad fit due to the high chance of collisions between OpenSSL, BoringSSL, and other OpenSSL forks embedded in libraries (such as with CEF). I have explicitly attempted to avoid OpenSSL as a dependency in the OBS Studio direct dependency chain for this reason. If things turn out to be fine, that would be nice, but I'm very cautious about that. I have recommended previously to use GnuTLS or something else that is equally validated but doesn't have these problems. |
So libcrypto is already pulled into the process via libcurl, we specifically chose this to avoid a dependency, so the concerns around it breaking seem incorrect unless im missing something. |
|
This PR is becoming more relevant as mbedtls will possibly stop maintenance in April 2027: https://lists.trustedfirmware.org/archives/list/mbed-tls@lists.trustedfirmware.org/thread/YPIGCB7WN6GCHOGEGKOJXUYAP7OK527W/#BSRM3JY6JFNWWEHKMY4JQQON5QB3LP5U |
|
And we did not stop working on it. Folks asked us to switch it to GnuTLS, which I have working locally. I am finishing the patch up and we should have it up for review shortly. Thanks. |
|
gnutls/nettle PR here: #14059 |
|
Firstly thinking that adding multiple TLS backend would benefit is a not a good thinking:
Also opening another PR for other TLS stacks is neither convincing nor helpful. |
For the "relevant" part, no. |
Really? As someone who maintains tpm2-software project, supporting different crypto backends has been pretty simple, and lets the project scale easily to different environments. The crypto heavy lifting is in rtmp, which already has support for 3 different backends, this is merely utilizing that. The only obs-specific crypto code is signature verification which is pretty trivial to do with almost any crypto stack. So I don't really see the maintenance cost, and if the project wants, I can help support it. |
Being simple from your point of view does not always mean that it should be considered, OBS Studio is a complex app and I don't think expanding CI to test if the project builds for every supported TLS lib is an idea to consider. There is also all of our bundled dependencies using MbedTLS on Windows and macOS that needs to be considered too. So trying to support and bundle only one TLS library is simpler.
This part of the fork has never been maintained, so I consider that this librtmp has only proper support for MbedTLS. |
It doesn't need too support every TLS stack[1], but having two options for different environments would be nice. Especially when one of those futures is uncertain.
See our various patches, that's the maintenance. I have also offered to help support the gnutls backend to relieve any perceived maintenance burden. This would only affect users that opt into the different backend, which is mostly going to be all the linux distributions that package this. So if we/you do decide to have another backend supported, If it's openssl, let me re-spin the CMake files, after doing the gnutls CMake files, I prefer what I did over there. I will be away for about 10 days, so please don't perceive my silence as ignoring you. I would love to continue this discussion on my return and see what other comments folks leave. Thanks. |
|
Appreciate the insight and context. We're considering opening a discussion post for this topic, but as it's not critical right now that we make a choice, and not even clear what the future of mbedtls is going to be, we can leave this PR (and the other, though it being Linux-only is probably a non-starter for something we'd want to accept support for) open for now. I'll ask for patience as we work through our initial thoughts. |
Description
Give Linux builds the option to choose OpenSSL as the crypto backend
with
-DCRYPTO_BACKEND=openssl. MbedTLS remains the default, but canbe explicitly set with
-DCRYPTO_BACKEND=mbedtls.Upstream librtmp added OpenSSL RTMPS support in commit 8251927. This is
a backport from upstream, along with modifications to use non-deprecated
OpenSSL APIs, per-RTMP TLS state, certificate verification, and frontend
signature verification.
Motivation and Context
MbedTLS updates have introduced breaking changes in minor releases, leading to issues like #11020. OpenSSL tends not to have this problem.
How Has This Been Tested?
Tested on Fedora 44 ARM64.
Each following test was executed building against both MbedTLS and OpenSSL. Each one functions identically, regardless of which backend was used.
realdelf.ffmpeg. Verifies RTMPS changes left RTMP functional.ffmpegandsocatsuccessfully.VerifySignature()accepts a valid RSA/SHA256 signature.VerifySignature()rejects altered content, signature, and public key.Types of changes
Checklist: