| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #if !defined(DART_IO_SECURE_SOCKET_DISABLED) | 5 #if !defined(DART_IO_SECURE_SOCKET_DISABLED) |
| 6 | 6 |
| 7 #include "bin/security_context.h" | 7 #include "bin/security_context.h" |
| 8 | 8 |
| 9 #include <openssl/bio.h> | 9 #include <openssl/bio.h> |
| 10 #include <openssl/err.h> | 10 #include <openssl/err.h> |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 } | 316 } |
| 317 | 317 |
| 318 SecureSocketUtils::CheckStatus(status, "TlsException", | 318 SecureSocketUtils::CheckStatus(status, "TlsException", |
| 319 "Failure in setClientAuthoritiesBytes"); | 319 "Failure in setClientAuthoritiesBytes"); |
| 320 } | 320 } |
| 321 | 321 |
| 322 void SSLCertContext::LoadRootCertFile(const char* file) { | 322 void SSLCertContext::LoadRootCertFile(const char* file) { |
| 323 if (SSL_LOG_STATUS) { | 323 if (SSL_LOG_STATUS) { |
| 324 Log::Print("Looking for trusted roots in %s\n", file); | 324 Log::Print("Looking for trusted roots in %s\n", file); |
| 325 } | 325 } |
| 326 if (!File::Exists(file)) { | 326 if (!File::Exists(NULL, file)) { |
| 327 SecureSocketUtils::ThrowIOException(-1, "TlsException", | 327 SecureSocketUtils::ThrowIOException(-1, "TlsException", |
| 328 "Failed to find root cert file", NULL); | 328 "Failed to find root cert file", NULL); |
| 329 } | 329 } |
| 330 int status = SSL_CTX_load_verify_locations(context(), file, NULL); | 330 int status = SSL_CTX_load_verify_locations(context(), file, NULL); |
| 331 SecureSocketUtils::CheckStatus(status, "TlsException", | 331 SecureSocketUtils::CheckStatus(status, "TlsException", |
| 332 "Failure trusting builtin roots"); | 332 "Failure trusting builtin roots"); |
| 333 if (SSL_LOG_STATUS) { | 333 if (SSL_LOG_STATUS) { |
| 334 Log::Print("Trusting roots from: %s\n", file); | 334 Log::Print("Trusting roots from: %s\n", file); |
| 335 } | 335 } |
| 336 } | 336 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 362 // If there is an error here, it must be the error indicating that we are done | 362 // If there is an error here, it must be the error indicating that we are done |
| 363 // reading PEM certificates. | 363 // reading PEM certificates. |
| 364 ASSERT((ERR_peek_error() == 0) || SecureSocketUtils::NoPEMStartLine()); | 364 ASSERT((ERR_peek_error() == 0) || SecureSocketUtils::NoPEMStartLine()); |
| 365 ERR_clear_error(); | 365 ERR_clear_error(); |
| 366 } | 366 } |
| 367 | 367 |
| 368 void SSLCertContext::LoadRootCertCache(const char* cache) { | 368 void SSLCertContext::LoadRootCertCache(const char* cache) { |
| 369 if (SSL_LOG_STATUS) { | 369 if (SSL_LOG_STATUS) { |
| 370 Log::Print("Looking for trusted roots in %s\n", cache); | 370 Log::Print("Looking for trusted roots in %s\n", cache); |
| 371 } | 371 } |
| 372 if (Directory::Exists(cache) != Directory::EXISTS) { | 372 if (Directory::Exists(NULL, cache) != Directory::EXISTS) { |
| 373 SecureSocketUtils::ThrowIOException(-1, "TlsException", | 373 SecureSocketUtils::ThrowIOException(-1, "TlsException", |
| 374 "Failed to find root cert cache", NULL); | 374 "Failed to find root cert cache", NULL); |
| 375 } | 375 } |
| 376 int status = SSL_CTX_load_verify_locations(context(), NULL, cache); | 376 int status = SSL_CTX_load_verify_locations(context(), NULL, cache); |
| 377 SecureSocketUtils::CheckStatus(status, "TlsException", | 377 SecureSocketUtils::CheckStatus(status, "TlsException", |
| 378 "Failure trusting builtin roots"); | 378 "Failure trusting builtin roots"); |
| 379 if (SSL_LOG_STATUS) { | 379 if (SSL_LOG_STATUS) { |
| 380 Log::Print("Trusting roots from: %s\n", cache); | 380 Log::Print("Trusting roots from: %s\n", cache); |
| 381 } | 381 } |
| 382 } | 382 } |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 } else { | 810 } else { |
| 811 Dart_ThrowException(DartUtils::NewDartArgumentError( | 811 Dart_ThrowException(DartUtils::NewDartArgumentError( |
| 812 "Non-boolean is_server argument passed to SetAlpnProtocols")); | 812 "Non-boolean is_server argument passed to SetAlpnProtocols")); |
| 813 } | 813 } |
| 814 } | 814 } |
| 815 | 815 |
| 816 } // namespace bin | 816 } // namespace bin |
| 817 } // namespace dart | 817 } // namespace dart |
| 818 | 818 |
| 819 #endif // !defined(DART_IO_SECURE_SOCKET_DISABLED) | 819 #endif // !defined(DART_IO_SECURE_SOCKET_DISABLED) |
| OLD | NEW |