OLD | NEW |
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 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_ANDROID) || \ |
| 7 defined(TARGET_OS_LINUX) || \ |
| 8 defined(TARGET_OS_WINDOWS) |
| 9 |
5 #include "bin/secure_socket.h" | 10 #include "bin/secure_socket.h" |
| 11 #include "bin/secure_socket_boringssl.h" |
6 | 12 |
7 #include <errno.h> | 13 #include <errno.h> |
8 #include <fcntl.h> | 14 #include <fcntl.h> |
9 #include <stdio.h> | 15 #include <stdio.h> |
10 #include <string.h> | 16 #include <string.h> |
11 #include <sys/stat.h> | 17 #include <sys/stat.h> |
12 | 18 |
13 #include <openssl/bio.h> | 19 #include <openssl/bio.h> |
14 #include <openssl/err.h> | 20 #include <openssl/err.h> |
15 #include <openssl/pkcs12.h> | 21 #include <openssl/pkcs12.h> |
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 { | 759 { |
754 ScopedMemBIO bio(ThrowIfError(Dart_GetNativeArgument(args, 1))); | 760 ScopedMemBIO bio(ThrowIfError(Dart_GetNativeArgument(args, 1))); |
755 status = SetTrustedCertificatesBytes(context, bio.bio(), password); | 761 status = SetTrustedCertificatesBytes(context, bio.bio(), password); |
756 } | 762 } |
757 CheckStatus(status, | 763 CheckStatus(status, |
758 "TlsException", | 764 "TlsException", |
759 "Failure in setTrustedCertificatesBytes"); | 765 "Failure in setTrustedCertificatesBytes"); |
760 } | 766 } |
761 | 767 |
762 | 768 |
| 769 void FUNCTION_NAME(SecurityContext_AlpnSupported)(Dart_NativeArguments args) { |
| 770 Dart_SetReturnValue(args, Dart_NewBoolean(true)); |
| 771 } |
| 772 |
| 773 |
763 void FUNCTION_NAME(SecurityContext_TrustBuiltinRoots)( | 774 void FUNCTION_NAME(SecurityContext_TrustBuiltinRoots)( |
764 Dart_NativeArguments args) { | 775 Dart_NativeArguments args) { |
765 SSL_CTX* context = GetSecurityContext(args); | 776 SSL_CTX* context = GetSecurityContext(args); |
766 X509_STORE* store = SSL_CTX_get_cert_store(context); | 777 X509_STORE* store = SSL_CTX_get_cert_store(context); |
767 BIO* roots_bio = | 778 BIO* roots_bio = |
768 BIO_new_mem_buf(const_cast<unsigned char*>(root_certificates_pem), | 779 BIO_new_mem_buf(const_cast<unsigned char*>(root_certificates_pem), |
769 root_certificates_pem_length); | 780 root_certificates_pem_length); |
770 X509* root_cert; | 781 X509* root_cert; |
771 // PEM_read_bio_X509 reads PEM-encoded certificates from a bio (in our case, | 782 // PEM_read_bio_X509 reads PEM-encoded certificates from a bio (in our case, |
772 // backed by a memory buffer), and returns X509 objects, one by one. | 783 // backed by a memory buffer), and returns X509 objects, one by one. |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1647 } else { | 1658 } else { |
1648 if (SSL_LOG_DATA) Log::Print( | 1659 if (SSL_LOG_DATA) Log::Print( |
1649 "WriteEncrypted BIO_read wrote %d bytes\n", bytes_processed); | 1660 "WriteEncrypted BIO_read wrote %d bytes\n", bytes_processed); |
1650 } | 1661 } |
1651 } | 1662 } |
1652 return bytes_processed; | 1663 return bytes_processed; |
1653 } | 1664 } |
1654 | 1665 |
1655 } // namespace bin | 1666 } // namespace bin |
1656 } // namespace dart | 1667 } // namespace dart |
| 1668 |
| 1669 #endif // defined(TARGET_OS_LINUX) |
OLD | NEW |