OLD | NEW |
1 // Copyright (c) 2016, the Fletch project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 import 'dart:fletch.ffi'; | 5 import 'dart:dartino.ffi'; |
6 import 'dart:fletch'; | 6 import 'dart:dartino'; |
7 import 'dart:typed_data'; | 7 import 'dart:typed_data'; |
8 import 'package:os/os.dart'; | 8 import 'package:os/os.dart'; |
9 import 'package:socket/socket.dart'; | 9 import 'package:socket/socket.dart'; |
10 import 'package:ffi/ffi.dart'; | 10 import 'package:ffi/ffi.dart'; |
11 | 11 |
12 final String mbedtlsLibraryName = ForeignLibrary.bundleLibraryName('mbedtls'); | 12 final String mbedtlsLibraryName = ForeignLibrary.bundleLibraryName('mbedtls'); |
13 final ForeignLibrary lib = new ForeignLibrary.fromName(mbedtlsLibraryName); | 13 final ForeignLibrary lib = new ForeignLibrary.fromName(mbedtlsLibraryName); |
14 | 14 |
15 // The functions below are named the same as their c counterpart. | 15 // The functions below are named the same as their c counterpart. |
16 final ForeignFunction entropy_context_sizeof = | 16 final ForeignFunction entropy_context_sizeof = |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 final cacert = | 120 final cacert = |
121 new ForeignMemory.allocatedFinalized(x509_crt_sizeof.icall$0()); | 121 new ForeignMemory.allocatedFinalized(x509_crt_sizeof.icall$0()); |
122 final ctr_drbg = | 122 final ctr_drbg = |
123 new ForeignMemory.allocatedFinalized(ctr_drbg_context_sizeof.icall$0()); | 123 new ForeignMemory.allocatedFinalized(ctr_drbg_context_sizeof.icall$0()); |
124 final entropy = | 124 final entropy = |
125 new ForeignMemory.allocatedFinalized(entropy_context_sizeof.icall$0()); | 125 new ForeignMemory.allocatedFinalized(entropy_context_sizeof.icall$0()); |
126 | 126 |
127 final buf = | 127 final buf = |
128 new ForeignMemory.allocatedFinalized(1024); | 128 new ForeignMemory.allocatedFinalized(1024); |
129 final pers = | 129 final pers = |
130 new ForeignMemory.fromStringAsUTF8('ssl_client_fletch'); | 130 new ForeignMemory.fromStringAsUTF8('ssl_client_dartino'); |
131 | 131 |
132 // The fletch socket we use to do the actual network communication. | 132 // The dartino socket we use to do the actual network communication. |
133 Socket _socket; | 133 Socket _socket; |
134 | 134 |
135 final String server; | 135 final String server; |
136 final int port; | 136 final int port; |
137 | 137 |
138 CircularByteBuffer _sendBuffer; | 138 CircularByteBuffer _sendBuffer; |
139 CircularByteBuffer _recvBuffer; | 139 CircularByteBuffer _recvBuffer; |
140 ForeignMemory _foreignBuffers; | 140 ForeignMemory _foreignBuffers; |
141 | 141 |
142 int _getSize_tValue(ForeignPointer ptr) { | 142 int _getSize_tValue(ForeignPointer ptr) { |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 } | 393 } |
394 } | 394 } |
395 | 395 |
396 class TLSException implements Exception { | 396 class TLSException implements Exception { |
397 final String message; | 397 final String message; |
398 | 398 |
399 TLSException(this.message); | 399 TLSException(this.message); |
400 | 400 |
401 String toString() => "TLSException: $message"; | 401 String toString() => "TLSException: $message"; |
402 } | 402 } |
OLD | NEW |