| 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 #ifndef BIN_SECURE_SOCKET_BORINGSSL_H_ | 5 #ifndef BIN_SECURE_SOCKET_BORINGSSL_H_ |
| 6 #define BIN_SECURE_SOCKET_BORINGSSL_H_ | 6 #define BIN_SECURE_SOCKET_BORINGSSL_H_ |
| 7 | 7 |
| 8 #if !defined(BIN_SECURE_SOCKET_H_) | 8 #if !defined(BIN_SECURE_SOCKET_H_) |
| 9 #error Do not include secure_socket_boringssl.h directly. Use secure_socket.h. | 9 #error Do not include secure_socket_boringssl.h directly. Use secure_socket.h. |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include <stdio.h> | 12 #include <stdio.h> |
| 13 #include <stdlib.h> | 13 #include <stdlib.h> |
| 14 #include <string.h> | 14 #include <string.h> |
| 15 #include <sys/types.h> | 15 #include <sys/types.h> |
| 16 | 16 |
| 17 #include <openssl/bio.h> | 17 #include <openssl/bio.h> |
| 18 #include <openssl/err.h> | 18 #include <openssl/err.h> |
| 19 #include <openssl/ssl.h> | 19 #include <openssl/ssl.h> |
| 20 #include <openssl/x509.h> | 20 #include <openssl/x509.h> |
| 21 | 21 |
| 22 #include "bin/builtin.h" | 22 #include "bin/builtin.h" |
| 23 #include "bin/dartutils.h" | 23 #include "bin/dartutils.h" |
| 24 #include "bin/reference_counting.h" |
| 24 #include "bin/socket.h" | 25 #include "bin/socket.h" |
| 25 #include "bin/thread.h" | 26 #include "bin/thread.h" |
| 26 #include "bin/utils.h" | 27 #include "bin/utils.h" |
| 27 | 28 |
| 28 namespace dart { | 29 namespace dart { |
| 29 namespace bin { | 30 namespace bin { |
| 30 | 31 |
| 31 /* These are defined in root_certificates.cc. */ | 32 /* These are defined in root_certificates.cc. */ |
| 32 extern const unsigned char* root_certificates_pem; | 33 extern const unsigned char* root_certificates_pem; |
| 33 extern unsigned int root_certificates_pem_length; | 34 extern unsigned int root_certificates_pem_length; |
| 34 | 35 |
| 35 /* | 36 /* |
| 36 * SSLFilter encapsulates the NSS SSL(TLS) code in a filter, that communicates | 37 * SSLFilter encapsulates the NSS SSL(TLS) code in a filter, that communicates |
| 37 * with the containing _SecureFilterImpl Dart object through four shared | 38 * with the containing _SecureFilterImpl Dart object through four shared |
| 38 * ExternalByteArray buffers, for reading and writing plaintext, and | 39 * ExternalByteArray buffers, for reading and writing plaintext, and |
| 39 * reading and writing encrypted text. The filter handles handshaking | 40 * reading and writing encrypted text. The filter handles handshaking |
| 40 * and certificate verification. | 41 * and certificate verification. |
| 41 */ | 42 */ |
| 42 class SSLFilter { | 43 class SSLFilter : public ReferenceCounted<SSLFilter> { |
| 43 public: | 44 public: |
| 44 // These enums must agree with those in sdk/lib/io/secure_socket.dart. | 45 // These enums must agree with those in sdk/lib/io/secure_socket.dart. |
| 45 enum BufferIndex { | 46 enum BufferIndex { |
| 46 kReadPlaintext, | 47 kReadPlaintext, |
| 47 kWritePlaintext, | 48 kWritePlaintext, |
| 48 kReadEncrypted, | 49 kReadEncrypted, |
| 49 kWriteEncrypted, | 50 kWriteEncrypted, |
| 50 kNumBuffers, | 51 kNumBuffers, |
| 51 kFirstEncrypted = kReadEncrypted | 52 kFirstEncrypted = kReadEncrypted |
| 52 }; | 53 }; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 Dart_Handle InitializeBuffers(Dart_Handle dart_this); | 125 Dart_Handle InitializeBuffers(Dart_Handle dart_this); |
| 125 void InitializePlatformData(); | 126 void InitializePlatformData(); |
| 126 | 127 |
| 127 DISALLOW_COPY_AND_ASSIGN(SSLFilter); | 128 DISALLOW_COPY_AND_ASSIGN(SSLFilter); |
| 128 }; | 129 }; |
| 129 | 130 |
| 130 } // namespace bin | 131 } // namespace bin |
| 131 } // namespace dart | 132 } // namespace dart |
| 132 | 133 |
| 133 #endif // BIN_SECURE_SOCKET_BORINGSSL_H_ | 134 #endif // BIN_SECURE_SOCKET_BORINGSSL_H_ |
| OLD | NEW |