Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(726)

Side by Side Diff: runtime/bin/secure_socket_boringssl.cc

Issue 2211453002: Clear the error bit after reading the default trusted certs (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix date Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/standalone/io/issue_26954_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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_DISABLED) && !defined(DART_IO_SECURE_SOCKET_DISABLED) 5 #if !defined(DART_IO_DISABLED) && !defined(DART_IO_SECURE_SOCKET_DISABLED)
6 6
7 #include "platform/globals.h" 7 #include "platform/globals.h"
8 #if defined(TARGET_OS_ANDROID) || \ 8 #if defined(TARGET_OS_ANDROID) || \
9 defined(TARGET_OS_LINUX) || \ 9 defined(TARGET_OS_LINUX) || \
10 defined(TARGET_OS_WINDOWS) 10 defined(TARGET_OS_WINDOWS)
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 CheckStatus(status, "TlsException", "Failure trusting builtint roots"); 793 CheckStatus(status, "TlsException", "Failure trusting builtint roots");
794 #else 794 #else
795 X509_STORE* store = SSL_CTX_get_cert_store(context); 795 X509_STORE* store = SSL_CTX_get_cert_store(context);
796 BIO* roots_bio = 796 BIO* roots_bio =
797 BIO_new_mem_buf(const_cast<unsigned char*>(root_certificates_pem), 797 BIO_new_mem_buf(const_cast<unsigned char*>(root_certificates_pem),
798 root_certificates_pem_length); 798 root_certificates_pem_length);
799 X509* root_cert; 799 X509* root_cert;
800 // PEM_read_bio_X509 reads PEM-encoded certificates from a bio (in our case, 800 // PEM_read_bio_X509 reads PEM-encoded certificates from a bio (in our case,
801 // backed by a memory buffer), and returns X509 objects, one by one. 801 // backed by a memory buffer), and returns X509 objects, one by one.
802 // When the end of the bio is reached, it returns null. 802 // When the end of the bio is reached, it returns null.
803 while ((root_cert = PEM_read_bio_X509(roots_bio, NULL, NULL, NULL))) { 803 while ((root_cert = PEM_read_bio_X509(roots_bio, NULL, NULL, NULL)) != NULL) {
804 X509_STORE_add_cert(store, root_cert); 804 X509_STORE_add_cert(store, root_cert);
805 } 805 }
806 BIO_free(roots_bio); 806 BIO_free(roots_bio);
807 // If there is an error here, it must be the error indicating that we are done
808 // reading PEM certificates.
809 ASSERT((ERR_peek_error() == 0) || NoPEMStartLine());
810 ERR_clear_error();
807 #endif // defined(TARGET_OS_ANDROID) 811 #endif // defined(TARGET_OS_ANDROID)
808 } 812 }
809 813
810 814
811 static int UseChainBytesPKCS12(SSL_CTX* context, 815 static int UseChainBytesPKCS12(SSL_CTX* context,
812 BIO* bio, 816 BIO* bio,
813 const char* password) { 817 const char* password) {
814 ScopedPKCS12 p12(d2i_PKCS12_bio(bio, NULL)); 818 ScopedPKCS12 p12(d2i_PKCS12_bio(bio, NULL));
815 if (p12.get() == NULL) { 819 if (p12.get() == NULL) {
816 return 0; 820 return 0;
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 return bytes_processed; 1688 return bytes_processed;
1685 } 1689 }
1686 1690
1687 } // namespace bin 1691 } // namespace bin
1688 } // namespace dart 1692 } // namespace dart
1689 1693
1690 #endif // defined(TARGET_OS_LINUX) 1694 #endif // defined(TARGET_OS_LINUX)
1691 1695
1692 #endif // !defined(DART_IO_DISABLED) && 1696 #endif // !defined(DART_IO_DISABLED) &&
1693 // !defined(DART_IO_SECURE_SOCKET_DISABLED) 1697 // !defined(DART_IO_SECURE_SOCKET_DISABLED)
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/issue_26954_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698