Fix bug where RTCTransportStats.dtlsCipher was missing when using OpenSSL

A bug in the id being searched for inside OpenSSLStreamAdapter::SslCipherSuiteToName prevented the lookup from ever succeeding.

This resulted in this stat being unavailable when calling PeerConnection::GetStats(). To fix the problem, look for (0x03000000L | cipher_suite) which matches what the BoringSSL codepath is doing.

Bug: webrtc:14596
Change-Id: Ic36d77dbc4c2378fbde1e2f21a9f5bd735b36741
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/280100
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38460}
This commit is contained in:
Joachim Reiersen
2022-10-21 12:08:22 -07:00
committed by WebRTC LUCI CQ
parent ea59abe44e
commit e457e43836
2 changed files with 3 additions and 1 deletions

View File

@ -146,6 +146,7 @@ HyperConnect Inc. <*@hpcnt.com>
Intel Corporation <*@intel.com>
LG Electronics, Inc. <*@lge.com>
Life On Air Inc. <*@lifeonair.com>
Meta Platforms, Inc. <*@meta.com>
Microsoft Corporation <*@microsoft.com>
MIPS Technologies <*@mips.com>
Mozilla Foundation <*@mozilla.com>

View File

@ -390,9 +390,10 @@ std::string OpenSSLStreamAdapter::SslCipherSuiteToName(int cipher_suite) {
}
return SSL_CIPHER_standard_name(ssl_cipher);
#else
const int openssl_cipher_id = 0x03000000L | cipher_suite;
for (const SslCipherMapEntry* entry = kSslCipherMap; entry->rfc_name;
++entry) {
if (cipher_suite == static_cast<int>(entry->openssl_id)) {
if (openssl_cipher_id == static_cast<int>(entry->openssl_id)) {
return entry->rfc_name;
}
}