OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 #include "webrtc/base/opensslstreamadapter.h" | 11 #include "webrtc/base/opensslstreamadapter.h" |
12 | 12 |
13 #include <openssl/bio.h> | 13 #include <openssl/bio.h> |
14 #include <openssl/crypto.h> | 14 #include <openssl/crypto.h> |
15 #include <openssl/err.h> | 15 #include <openssl/err.h> |
16 #include <openssl/rand.h> | 16 #include <openssl/rand.h> |
17 #include <openssl/tls1.h> | 17 #include <openssl/tls1.h> |
18 #include <openssl/x509v3.h> | 18 #include <openssl/x509v3.h> |
19 #ifndef OPENSSL_IS_BORINGSSL | 19 #ifndef OPENSSL_IS_BORINGSSL |
20 #include <openssl/dtls1.h> | 20 #include <openssl/dtls1.h> |
21 #include <openssl/ssl.h> | 21 #include <openssl/ssl.h> |
22 #endif | 22 #endif |
23 | 23 |
24 #include <memory> | 24 #include <memory> |
25 #include <vector> | 25 #include <vector> |
26 | 26 |
27 #include "webrtc/base/checks.h" | 27 #include "webrtc/base/checks.h" |
28 #include "webrtc/base/common.h" | |
29 #include "webrtc/base/logging.h" | 28 #include "webrtc/base/logging.h" |
30 #include "webrtc/base/safe_conversions.h" | 29 #include "webrtc/base/safe_conversions.h" |
31 #include "webrtc/base/stream.h" | 30 #include "webrtc/base/stream.h" |
32 #include "webrtc/base/openssl.h" | 31 #include "webrtc/base/openssl.h" |
33 #include "webrtc/base/openssladapter.h" | 32 #include "webrtc/base/openssladapter.h" |
34 #include "webrtc/base/openssldigest.h" | 33 #include "webrtc/base/openssldigest.h" |
35 #include "webrtc/base/opensslidentity.h" | 34 #include "webrtc/base/opensslidentity.h" |
36 #include "webrtc/base/stringutils.h" | 35 #include "webrtc/base/stringutils.h" |
37 #include "webrtc/base/timeutils.h" | 36 #include "webrtc/base/timeutils.h" |
38 #include "webrtc/base/thread.h" | 37 #include "webrtc/base/thread.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 BIO_set_retry_write(b); | 245 BIO_set_retry_write(b); |
247 } | 246 } |
248 return -1; | 247 return -1; |
249 } | 248 } |
250 | 249 |
251 static int stream_puts(BIO* b, const char* str) { | 250 static int stream_puts(BIO* b, const char* str) { |
252 return stream_write(b, str, checked_cast<int>(strlen(str))); | 251 return stream_write(b, str, checked_cast<int>(strlen(str))); |
253 } | 252 } |
254 | 253 |
255 static long stream_ctrl(BIO* b, int cmd, long num, void* ptr) { | 254 static long stream_ctrl(BIO* b, int cmd, long num, void* ptr) { |
256 RTC_UNUSED(num); | |
257 RTC_UNUSED(ptr); | |
258 | |
259 switch (cmd) { | 255 switch (cmd) { |
260 case BIO_CTRL_RESET: | 256 case BIO_CTRL_RESET: |
261 return 0; | 257 return 0; |
262 case BIO_CTRL_EOF: | 258 case BIO_CTRL_EOF: |
263 return b->num; | 259 return b->num; |
264 case BIO_CTRL_WPENDING: | 260 case BIO_CTRL_WPENDING: |
265 case BIO_CTRL_PENDING: | 261 case BIO_CTRL_PENDING: |
266 return 0; | 262 return 0; |
267 case BIO_CTRL_FLUSH: | 263 case BIO_CTRL_FLUSH: |
268 return 1; | 264 return 1; |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 } | 1226 } |
1231 | 1227 |
1232 return false; | 1228 return false; |
1233 } | 1229 } |
1234 | 1230 |
1235 void OpenSSLStreamAdapter::enable_time_callback_for_testing() { | 1231 void OpenSSLStreamAdapter::enable_time_callback_for_testing() { |
1236 g_use_time_callback_for_testing = true; | 1232 g_use_time_callback_for_testing = true; |
1237 } | 1233 } |
1238 | 1234 |
1239 } // namespace rtc | 1235 } // namespace rtc |
OLD | NEW |