| 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 #ifndef RUNTIME_BIN_SECURE_SOCKET_UTILS_H_ | 5 #ifndef RUNTIME_BIN_SECURE_SOCKET_UTILS_H_ |
| 6 #define RUNTIME_BIN_SECURE_SOCKET_UTILS_H_ | 6 #define RUNTIME_BIN_SECURE_SOCKET_UTILS_H_ |
| 7 | 7 |
| 8 #include <openssl/bio.h> | 8 #include <openssl/bio.h> |
| 9 #include <openssl/err.h> | 9 #include <openssl/err.h> |
| 10 #include <openssl/pkcs12.h> | 10 #include <openssl/pkcs12.h> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 static bool NoPEMStartLine() { | 42 static bool NoPEMStartLine() { |
| 43 uint32_t last_error = ERR_peek_last_error(); | 43 uint32_t last_error = ERR_peek_last_error(); |
| 44 return (ERR_GET_LIB(last_error) == ERR_LIB_PEM) && | 44 return (ERR_GET_LIB(last_error) == ERR_LIB_PEM) && |
| 45 (ERR_GET_REASON(last_error) == PEM_R_NO_START_LINE); | 45 (ERR_GET_REASON(last_error) == PEM_R_NO_START_LINE); |
| 46 } | 46 } |
| 47 | 47 |
| 48 static void FetchErrorString(const SSL* ssl, TextBuffer* text_buffer); | 48 static void FetchErrorString(const SSL* ssl, TextBuffer* text_buffer); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 | |
| 52 // Where the argument to the constructor is the handle for an object | 51 // Where the argument to the constructor is the handle for an object |
| 53 // implementing List<int>, this class creates a scope in which a memory-backed | 52 // implementing List<int>, this class creates a scope in which a memory-backed |
| 54 // BIO is allocated. Leaving the scope cleans up the BIO and the buffer that | 53 // BIO is allocated. Leaving the scope cleans up the BIO and the buffer that |
| 55 // was used to create it. | 54 // was used to create it. |
| 56 // | 55 // |
| 57 // Do not make Dart_ API calls while in a ScopedMemBIO. | 56 // Do not make Dart_ API calls while in a ScopedMemBIO. |
| 58 // Do not call Dart_PropagateError while in a ScopedMemBIO. | 57 // Do not call Dart_PropagateError while in a ScopedMemBIO. |
| 59 class ScopedMemBIO { | 58 class ScopedMemBIO { |
| 60 public: | 59 public: |
| 61 explicit ScopedMemBIO(Dart_Handle object) { | 60 explicit ScopedMemBIO(Dart_Handle object) { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 return result; | 161 return result; |
| 163 } | 162 } |
| 164 | 163 |
| 165 private: | 164 private: |
| 166 T* obj_; | 165 T* obj_; |
| 167 | 166 |
| 168 DISALLOW_ALLOCATION(); | 167 DISALLOW_ALLOCATION(); |
| 169 DISALLOW_COPY_AND_ASSIGN(ScopedSSLStackType); | 168 DISALLOW_COPY_AND_ASSIGN(ScopedSSLStackType); |
| 170 }; | 169 }; |
| 171 | 170 |
| 172 | |
| 173 typedef ScopedSSLType<PKCS12, PKCS12_free> ScopedPKCS12; | 171 typedef ScopedSSLType<PKCS12, PKCS12_free> ScopedPKCS12; |
| 174 typedef ScopedSSLType<X509, X509_free> ScopedX509; | 172 typedef ScopedSSLType<X509, X509_free> ScopedX509; |
| 175 typedef ScopedSSLStackType<STACK_OF(X509), X509, X509_free> ScopedX509Stack; | 173 typedef ScopedSSLStackType<STACK_OF(X509), X509, X509_free> ScopedX509Stack; |
| 176 | 174 |
| 177 } // namespace bin | 175 } // namespace bin |
| 178 } // namespace dart | 176 } // namespace dart |
| 179 | 177 |
| 180 #endif // RUNTIME_BIN_SECURE_SOCKET_UTILS_H_ | 178 #endif // RUNTIME_BIN_SECURE_SOCKET_UTILS_H_ |
| OLD | NEW |