mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +01:00
44 lines
1.2 KiB
C++
44 lines
1.2 KiB
C++
/*
|
|
* Copyright 2019-2024 Signal Messenger, LLC
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
// RingRTC change: Struct to carry SRTP crypto parameters to RTP transport.
|
|
|
|
#ifndef API_CRYPTO_PARAMS_H_
|
|
#define API_CRYPTO_PARAMS_H_
|
|
|
|
#include <algorithm>
|
|
|
|
#include "rtc_base/buffer.h"
|
|
#include "rtc_base/ssl_stream_adapter.h" // kSrtpInvalidCryptoSuite
|
|
|
|
namespace cricket {
|
|
|
|
// Parameters for propagating SRTP params to RTP transport.
|
|
struct CryptoParams {
|
|
CryptoParams() = default;
|
|
|
|
// Manually define a copy constructor because ZeroOnFreeBuffer assumes its
|
|
// contents might be quite large, and wants us to be explicit. However, keys
|
|
// won't be extremely large, so allow copies.
|
|
CryptoParams(const CryptoParams& other)
|
|
: crypto_suite(other.crypto_suite),
|
|
key_params(other.key_params.data(), other.key_params.size()) {}
|
|
|
|
// Similarly define an assignment constructor.
|
|
CryptoParams& operator=(CryptoParams other) {
|
|
std::swap(crypto_suite, other.crypto_suite);
|
|
// ZeroOnFreeBuffer defines a swap()
|
|
std::swap(key_params, other.key_params);
|
|
return *this;
|
|
}
|
|
|
|
int crypto_suite = rtc::kSrtpInvalidCryptoSuite;
|
|
// Key and salt.
|
|
rtc::ZeroOnFreeBuffer<uint8_t> key_params;
|
|
};
|
|
|
|
} // namespace cricket
|
|
|
|
#endif // API_CRYPTO_PARAMS_H_
|