OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #if defined(HAVE_SRTP) && defined(ENABLE_EXTERNAL_AUTH) | |
12 | |
13 #include "webrtc/pc/externalhmac.h" | 11 #include "webrtc/pc/externalhmac.h" |
14 | 12 |
15 #include <stdlib.h> // For malloc/free. | 13 #include <stdlib.h> // For malloc/free. |
16 | 14 |
| 15 #ifdef HAVE_SRTP |
17 extern "C" { | 16 extern "C" { |
18 #ifdef SRTP_RELATIVE_PATH | 17 #ifdef SRTP_RELATIVE_PATH |
19 #include "crypto_kernel.h" // NOLINT | 18 #include "crypto_kernel.h" // NOLINT |
20 #include "srtp.h" // NOLINT | 19 #include "srtp.h" // NOLINT |
21 #else | 20 #else |
22 #include "third_party/libsrtp/srtp/crypto/include/crypto_kernel.h" | 21 #include "third_party/libsrtp/crypto/include/crypto_kernel.h" |
23 #include "third_party/libsrtp/srtp/include/srtp.h" | 22 #include "third_party/libsrtp/include/srtp.h" |
24 #endif // SRTP_RELATIVE_PATH | 23 #endif // SRTP_RELATIVE_PATH |
25 } | 24 } |
| 25 #endif // HAVE_SRTP |
26 | 26 |
27 #include "webrtc/base/logging.h" | 27 #include "webrtc/base/logging.h" |
28 | 28 |
| 29 #if defined(HAVE_SRTP) && defined(ENABLE_EXTERNAL_AUTH) |
| 30 |
29 // Begin test case 0 */ | 31 // Begin test case 0 */ |
30 static const uint8_t kExternalHmacTestCase0Key[20] = { | 32 static const uint8_t kExternalHmacTestCase0Key[20] = { |
31 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, | 33 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, |
32 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, | 34 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, |
33 0x0b, 0x0b, 0x0b, 0x0b | 35 0x0b, 0x0b, 0x0b, 0x0b |
34 }; | 36 }; |
35 | 37 |
36 static const uint8_t kExternalHmacTestCase0Data[8] = { | 38 static const uint8_t kExternalHmacTestCase0Data[8] = { |
37 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65 // "Hi There" | 39 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65 // "Hi There" |
38 }; | 40 }; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 const_cast<auth_type_t*>(&external_hmac), EXTERNAL_HMAC_SHA1); | 153 const_cast<auth_type_t*>(&external_hmac), EXTERNAL_HMAC_SHA1); |
152 if (status) { | 154 if (status) { |
153 LOG(LS_ERROR) << "Error in replacing default auth module, error: " | 155 LOG(LS_ERROR) << "Error in replacing default auth module, error: " |
154 << status; | 156 << status; |
155 return err_status_fail; | 157 return err_status_fail; |
156 } | 158 } |
157 return err_status_ok; | 159 return err_status_ok; |
158 } | 160 } |
159 | 161 |
160 #endif // defined(HAVE_SRTP) && defined(ENABLE_EXTERNAL_AUTH) | 162 #endif // defined(HAVE_SRTP) && defined(ENABLE_EXTERNAL_AUTH) |
OLD | NEW |