Remove untested and unused SetSrtpSend/ReceiveKey functions

These functions had no callers and no tests.
Under YAGNI principles, they need to be deleted.

Bug: None
Change-Id: I8b5d74678b804ef2be70409d05a5237f1637eaea
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/327024
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41134}
This commit is contained in:
Harald Alvestrand 2023-11-11 08:25:36 +00:00 committed by WebRTC LUCI CQ
parent 369111bf30
commit 0cb9b28e5b
3 changed files with 0 additions and 92 deletions

View File

@ -49,15 +49,6 @@ class DtlsSrtpTransport : public SrtpTransport {
void SetOnDtlsStateChange(std::function<void(void)> callback);
RTCError SetSrtpSendKey(const cricket::CryptoParams& params) override {
return RTCError(RTCErrorType::UNSUPPORTED_OPERATION,
"Set SRTP keys for DTLS-SRTP is not supported.");
}
RTCError SetSrtpReceiveKey(const cricket::CryptoParams& params) override {
return RTCError(RTCErrorType::UNSUPPORTED_OPERATION,
"Set SRTP keys for DTLS-SRTP is not supported.");
}
// If `active_reset_srtp_params_` is set to be true, the SRTP parameters will
// be reset whenever the DtlsTransports are reset.
void SetActiveResetSrtpParams(bool active_reset_srtp_params) {

View File

@ -37,86 +37,6 @@ SrtpTransport::SrtpTransport(bool rtcp_mux_enabled,
const FieldTrialsView& field_trials)
: RtpTransport(rtcp_mux_enabled), field_trials_(field_trials) {}
RTCError SrtpTransport::SetSrtpSendKey(const cricket::CryptoParams& params) {
if (send_params_) {
LOG_AND_RETURN_ERROR(
webrtc::RTCErrorType::UNSUPPORTED_OPERATION,
"Setting the SRTP send key twice is currently unsupported.");
}
if (recv_params_ && recv_params_->crypto_suite != params.crypto_suite) {
LOG_AND_RETURN_ERROR(
webrtc::RTCErrorType::UNSUPPORTED_OPERATION,
"The send key and receive key must have the same cipher suite.");
}
send_crypto_suite_ = rtc::SrtpCryptoSuiteFromName(params.crypto_suite);
if (*send_crypto_suite_ == rtc::kSrtpInvalidCryptoSuite) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
"Invalid SRTP crypto suite");
}
int send_key_len, send_salt_len;
if (!rtc::GetSrtpKeyAndSaltLengths(*send_crypto_suite_, &send_key_len,
&send_salt_len)) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
"Could not get lengths for crypto suite(s):"
" send crypto_suite ");
}
send_key_ = rtc::ZeroOnFreeBuffer<uint8_t>(send_key_len + send_salt_len);
if (!ParseKeyParams(params.key_params, send_key_.data(), send_key_.size())) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
"Failed to parse the crypto key params");
}
if (!MaybeSetKeyParams()) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
"Failed to set the crypto key params");
}
send_params_ = params;
return RTCError::OK();
}
RTCError SrtpTransport::SetSrtpReceiveKey(const cricket::CryptoParams& params) {
if (recv_params_) {
LOG_AND_RETURN_ERROR(
webrtc::RTCErrorType::UNSUPPORTED_OPERATION,
"Setting the SRTP send key twice is currently unsupported.");
}
if (send_params_ && send_params_->crypto_suite != params.crypto_suite) {
LOG_AND_RETURN_ERROR(
webrtc::RTCErrorType::UNSUPPORTED_OPERATION,
"The send key and receive key must have the same cipher suite.");
}
recv_crypto_suite_ = rtc::SrtpCryptoSuiteFromName(params.crypto_suite);
if (*recv_crypto_suite_ == rtc::kSrtpInvalidCryptoSuite) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
"Invalid SRTP crypto suite");
}
int recv_key_len, recv_salt_len;
if (!rtc::GetSrtpKeyAndSaltLengths(*recv_crypto_suite_, &recv_key_len,
&recv_salt_len)) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
"Could not get lengths for crypto suite(s):"
" recv crypto_suite ");
}
recv_key_ = rtc::ZeroOnFreeBuffer<uint8_t>(recv_key_len + recv_salt_len);
if (!ParseKeyParams(params.key_params, recv_key_.data(), recv_key_.size())) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
"Failed to parse the crypto key params");
}
if (!MaybeSetKeyParams()) {
return RTCError(RTCErrorType::INVALID_PARAMETER,
"Failed to set the crypto key params");
}
recv_params_ = params;
return RTCError::OK();
}
bool SrtpTransport::SendRtpPacket(rtc::CopyOnWriteBuffer* packet,
const rtc::PacketOptions& options,
int flags) {

View File

@ -41,9 +41,6 @@ class SrtpTransport : public RtpTransport {
virtual ~SrtpTransport() = default;
virtual RTCError SetSrtpSendKey(const cricket::CryptoParams& params);
virtual RTCError SetSrtpReceiveKey(const cricket::CryptoParams& params);
bool SendRtpPacket(rtc::CopyOnWriteBuffer* packet,
const rtc::PacketOptions& options,
int flags) override;