| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2008 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2008 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 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include <openssl/err.h> | 24 #include <openssl/err.h> |
| 25 #include <openssl/opensslv.h> | 25 #include <openssl/opensslv.h> |
| 26 #include <openssl/rand.h> | 26 #include <openssl/rand.h> |
| 27 #include <openssl/x509.h> | 27 #include <openssl/x509.h> |
| 28 #include <openssl/x509v3.h> | 28 #include <openssl/x509v3.h> |
| 29 | 29 |
| 30 #if HAVE_CONFIG_H | 30 #if HAVE_CONFIG_H |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #endif // HAVE_CONFIG_H | 32 #endif // HAVE_CONFIG_H |
| 33 | 33 |
| 34 #include "webrtc/base/arraysize.h" |
| 34 #include "webrtc/base/common.h" | 35 #include "webrtc/base/common.h" |
| 35 #include "webrtc/base/logging.h" | 36 #include "webrtc/base/logging.h" |
| 36 #include "webrtc/base/openssl.h" | 37 #include "webrtc/base/openssl.h" |
| 37 #include "webrtc/base/safe_conversions.h" | 38 #include "webrtc/base/safe_conversions.h" |
| 38 #include "webrtc/base/sslroots.h" | 39 #include "webrtc/base/sslroots.h" |
| 39 #include "webrtc/base/stringutils.h" | 40 #include "webrtc/base/stringutils.h" |
| 40 #include "webrtc/base/thread.h" | 41 #include "webrtc/base/thread.h" |
| 41 | 42 |
| 42 #ifndef OPENSSL_IS_BORINGSSL | 43 #ifndef OPENSSL_IS_BORINGSSL |
| 43 | 44 |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 LOG(LS_WARNING) << "Ignoring cert error while verifying cert chain"; | 909 LOG(LS_WARNING) << "Ignoring cert error while verifying cert chain"; |
| 909 ok = 1; | 910 ok = 1; |
| 910 } | 911 } |
| 911 | 912 |
| 912 return ok; | 913 return ok; |
| 913 } | 914 } |
| 914 | 915 |
| 915 bool OpenSSLAdapter::ConfigureTrustedRootCertificates(SSL_CTX* ctx) { | 916 bool OpenSSLAdapter::ConfigureTrustedRootCertificates(SSL_CTX* ctx) { |
| 916 // Add the root cert that we care about to the SSL context | 917 // Add the root cert that we care about to the SSL context |
| 917 int count_of_added_certs = 0; | 918 int count_of_added_certs = 0; |
| 918 for (int i = 0; i < ARRAY_SIZE(kSSLCertCertificateList); i++) { | 919 for (size_t i = 0; i < arraysize(kSSLCertCertificateList); i++) { |
| 919 const unsigned char* cert_buffer = kSSLCertCertificateList[i]; | 920 const unsigned char* cert_buffer = kSSLCertCertificateList[i]; |
| 920 size_t cert_buffer_len = kSSLCertCertificateSizeList[i]; | 921 size_t cert_buffer_len = kSSLCertCertificateSizeList[i]; |
| 921 X509* cert = d2i_X509(NULL, &cert_buffer, | 922 X509* cert = d2i_X509(NULL, &cert_buffer, |
| 922 checked_cast<long>(cert_buffer_len)); | 923 checked_cast<long>(cert_buffer_len)); |
| 923 if (cert) { | 924 if (cert) { |
| 924 int return_value = X509_STORE_add_cert(SSL_CTX_get_cert_store(ctx), cert); | 925 int return_value = X509_STORE_add_cert(SSL_CTX_get_cert_store(ctx), cert); |
| 925 if (return_value == 0) { | 926 if (return_value == 0) { |
| 926 LOG(LS_WARNING) << "Unable to add certificate."; | 927 LOG(LS_WARNING) << "Unable to add certificate."; |
| 927 } else { | 928 } else { |
| 928 count_of_added_certs++; | 929 count_of_added_certs++; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 if (ssl_mode_ == SSL_MODE_DTLS) { | 961 if (ssl_mode_ == SSL_MODE_DTLS) { |
| 961 SSL_CTX_set_read_ahead(ctx, 1); | 962 SSL_CTX_set_read_ahead(ctx, 1); |
| 962 } | 963 } |
| 963 | 964 |
| 964 return ctx; | 965 return ctx; |
| 965 } | 966 } |
| 966 | 967 |
| 967 } // namespace rtc | 968 } // namespace rtc |
| 968 | 969 |
| 969 #endif // HAVE_OPENSSL_SSL_H | 970 #endif // HAVE_OPENSSL_SSL_H |
| OLD | NEW |