Some checks failed
dev release / build (push) Failing after 12s
Builds out the full v1 scope: a vendored+patched openscreen subset for low-latency Cast Streaming (Mirroring receiver 0F5096E8) alongside the existing Cast V2/HLS and new DLNA/AVTransport casting paths, breadcastd's Idle/Casting state machine with a private IPC socket, the breadcast GTK4 popup as a thin IPC client, and bread.cast.*/bread.command.cast.* breadd integration (device discovery, start/stop, mirroring lifecycle events). Also adds bakery/systemd/Forgejo CI packaging. Validated end-to-end against a real Chromecast/Google TV: negotiated Cast Streaming session, live pipeline playback, and daemon+GUI click-to-cast/ stop through the actual popup.
61 lines
2.4 KiB
C++
61 lines
2.4 KiB
C++
// Copyright 2019 The Chromium Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef UTIL_CRYPTO_OPENSSL_UTIL_H_
|
|
#define UTIL_CRYPTO_OPENSSL_UTIL_H_
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <cstring>
|
|
|
|
#include "platform/base/error.h"
|
|
#include "platform/base/location.h"
|
|
|
|
// LOCAL PATCH (breadcast): dropped SSLErrorCodeToError()/GetSSLError(),
|
|
// which format an SSL_get_error() result and reference BoringSSL's
|
|
// SSL_error_description() (not part of system OpenSSL's public API). Unused
|
|
// here -- the TLS CASTV2 control channel is handled by the existing
|
|
// rust_cast-based Rust code, not this vendored openscreen subset, which only
|
|
// needs the general ERR_*/AES pieces. See vendor/openscreen/PATCHES.md.
|
|
|
|
namespace openscreen {
|
|
// Initialize OpenSSL if it isn't already initialized. This must be called
|
|
// before any other OpenSSL functions though it is safe and cheap to call this
|
|
// multiple times.
|
|
// This function is thread-safe, and OpenSSL will only ever be initialized once.
|
|
// OpenSSL will be properly shut down on program exit.
|
|
// Multiple sequential calls to EnsureOpenSSLInit or EnsureOpenSSLCleanup are
|
|
// ignored by OpenSSL itself.
|
|
void EnsureOpenSSLInit();
|
|
|
|
// Drains the OpenSSL ERR_get_error stack. On a debug build the error codes
|
|
// are send to VLOG(1), on a release build they are disregarded. In most
|
|
// cases you should pass CURRENT_LOCATION as the `location`.
|
|
void ClearOpenSSLERRStack(const Location& location);
|
|
|
|
// Place an instance of this class on the call stack to automatically clear
|
|
// the OpenSSL error stack on function exit.
|
|
class OpenSSLErrStackTracer {
|
|
public:
|
|
// Pass CURRENT_LOCATION as `location`, to help track the source of OpenSSL
|
|
// error messages. Note any diagnostic emitted will be tagged with the
|
|
// location of the constructor call as it's not possible to trace a
|
|
// destructor's callsite.
|
|
explicit OpenSSLErrStackTracer(const Location& location)
|
|
: location_(location) {
|
|
EnsureOpenSSLInit();
|
|
}
|
|
OpenSSLErrStackTracer(const OpenSSLErrStackTracer&) = delete;
|
|
OpenSSLErrStackTracer(OpenSSLErrStackTracer&&) noexcept = delete;
|
|
OpenSSLErrStackTracer& operator=(const OpenSSLErrStackTracer&) = delete;
|
|
OpenSSLErrStackTracer& operator=(OpenSSLErrStackTracer&&) = delete;
|
|
~OpenSSLErrStackTracer() { ClearOpenSSLERRStack(location_); }
|
|
|
|
private:
|
|
const Location location_;
|
|
};
|
|
|
|
} // namespace openscreen
|
|
|
|
#endif // UTIL_CRYPTO_OPENSSL_UTIL_H_
|