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 <sys/stat.h> | 15 #include <sys/stat.h> |
10 #include <stdio.h> | 16 #include <stdio.h> |
11 #include <string.h> | 17 #include <string.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 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 { | 763 { |
758 ScopedMemBIO bio(ThrowIfError(Dart_GetNativeArgument(args, 1))); | 764 ScopedMemBIO bio(ThrowIfError(Dart_GetNativeArgument(args, 1))); |
759 status = SetTrustedCertificatesBytes(context, bio.bio(), password); | 765 status = SetTrustedCertificatesBytes(context, bio.bio(), password); |
760 } | 766 } |
761 CheckStatus(status, | 767 CheckStatus(status, |
762 "TlsException", | 768 "TlsException", |
763 "Failure in setTrustedCertificatesBytes"); | 769 "Failure in setTrustedCertificatesBytes"); |
764 } | 770 } |
765 | 771 |
766 | 772 |
| 773 void FUNCTION_NAME(SecurityContext_AlpnSupported)(Dart_NativeArguments args) { |
| 774 Dart_SetReturnValue(args, Dart_NewBoolean(true)); |
| 775 } |
| 776 |
| 777 |
767 void FUNCTION_NAME(SecurityContext_TrustBuiltinRoots)( | 778 void FUNCTION_NAME(SecurityContext_TrustBuiltinRoots)( |
768 Dart_NativeArguments args) { | 779 Dart_NativeArguments args) { |
769 SSL_CTX* context = GetSecurityContext(args); | 780 SSL_CTX* context = GetSecurityContext(args); |
770 X509_STORE* store = SSL_CTX_get_cert_store(context); | 781 X509_STORE* store = SSL_CTX_get_cert_store(context); |
771 BIO* roots_bio = | 782 BIO* roots_bio = |
772 BIO_new_mem_buf(const_cast<unsigned char*>(root_certificates_pem), | 783 BIO_new_mem_buf(const_cast<unsigned char*>(root_certificates_pem), |
773 root_certificates_pem_length); | 784 root_certificates_pem_length); |
774 X509* root_cert; | 785 X509* root_cert; |
775 // PEM_read_bio_X509 reads PEM-encoded certificates from a bio (in our case, | 786 // PEM_read_bio_X509 reads PEM-encoded certificates from a bio (in our case, |
776 // backed by a memory buffer), and returns X509 objects, one by one. | 787 // 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... |
1651 } else { | 1662 } else { |
1652 if (SSL_LOG_DATA) Log::Print( | 1663 if (SSL_LOG_DATA) Log::Print( |
1653 "WriteEncrypted BIO_read wrote %d bytes\n", bytes_processed); | 1664 "WriteEncrypted BIO_read wrote %d bytes\n", bytes_processed); |
1654 } | 1665 } |
1655 } | 1666 } |
1656 return bytes_processed; | 1667 return bytes_processed; |
1657 } | 1668 } |
1658 | 1669 |
1659 } // namespace bin | 1670 } // namespace bin |
1660 } // namespace dart | 1671 } // namespace dart |
| 1672 |
| 1673 #endif // defined(TARGET_OS_LINUX) |
OLD | NEW |