webrtc/pc/test/srtp_test_util.h
Philipp Hancke db519e75b7 Reland "Clean up SRTP helper functions"
This is a reland of commit c47f649e67

Original change's description:
> Clean up SRTP helper functions
>
> BUG=None
>
> Change-Id: If1df1828a09aef2e335c028cf4425c9507906aac
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/354649
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Harald Alvestrand <hta@webrtc.org>
> Commit-Queue: Philipp Hancke <phancke@meta.com>
> Cr-Commit-Position: refs/heads/main@{#42525}

Bug: None
Change-Id: Ib98842407b1c15b4e4b72a3ce2f0833f07f60da6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/355540
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42603}
2024-07-08 15:33:47 +00:00

51 lines
1.3 KiB
C++

/*
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef PC_TEST_SRTP_TEST_UTIL_H_
#define PC_TEST_SRTP_TEST_UTIL_H_
#include "rtc_base/ssl_stream_adapter.h"
namespace rtc {
static const uint8_t kTestKey1[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234";
static const uint8_t kTestKey2[] = "4321ZYXWVUTSRQPONMLKJIHGFEDCBA";
static const int kTestKeyLen = 30;
static int rtp_auth_tag_len(int crypto_suite) {
switch (crypto_suite) {
case kSrtpAes128CmSha1_32:
return 4;
case kSrtpAes128CmSha1_80:
return 10;
case kSrtpAeadAes128Gcm:
case kSrtpAeadAes256Gcm:
return 16;
default:
RTC_CHECK_NOTREACHED();
}
}
static int rtcp_auth_tag_len(int crypto_suite) {
switch (crypto_suite) {
case kSrtpAes128CmSha1_32:
case kSrtpAes128CmSha1_80:
return 10;
case kSrtpAeadAes128Gcm:
case kSrtpAeadAes256Gcm:
return 16;
default:
RTC_CHECK_NOTREACHED();
}
}
} // namespace rtc
#endif // PC_TEST_SRTP_TEST_UTIL_H_