srtp_test_util.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright 2017 The WebRTC project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef PC_TEST_SRTP_TEST_UTIL_H_
  11. #define PC_TEST_SRTP_TEST_UTIL_H_
  12. #include <string>
  13. namespace rtc {
  14. extern const char CS_AES_CM_128_HMAC_SHA1_32[];
  15. extern const char CS_AEAD_AES_128_GCM[];
  16. extern const char CS_AEAD_AES_256_GCM[];
  17. static const uint8_t kTestKey1[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234";
  18. static const uint8_t kTestKey2[] = "4321ZYXWVUTSRQPONMLKJIHGFEDCBA";
  19. static const int kTestKeyLen = 30;
  20. static int rtp_auth_tag_len(const std::string& cs) {
  21. if (cs == CS_AES_CM_128_HMAC_SHA1_32) {
  22. return 4;
  23. } else if (cs == CS_AEAD_AES_128_GCM || cs == CS_AEAD_AES_256_GCM) {
  24. return 16;
  25. } else {
  26. return 10;
  27. }
  28. }
  29. static int rtcp_auth_tag_len(const std::string& cs) {
  30. if (cs == CS_AEAD_AES_128_GCM || cs == CS_AEAD_AES_256_GCM) {
  31. return 16;
  32. } else {
  33. return 10;
  34. }
  35. }
  36. } // namespace rtc
  37. #endif // PC_TEST_SRTP_TEST_UTIL_H_