Differences From Artifact [96b9c1a36c]:
- File src/tls/OFGnuTLSTLSStream.m — part of check-in [26ddd2e4e4] at 2024-01-02 17:17:25 on branch trunk — Update copyright (user: js, size: 9133) [annotate] [blame] [check-ins using]
To Artifact [570186048d]:
- File
src/tls/OFGnuTLSTLSStream.m
— part of check-in
[11b2a17595]
at
2024-01-06 00:52:48
on branch trunk
— Initial support for Mbed TLS
Mbed TLS is never automatically picked as a TLS implementation and
always needs to be manually enabled using --with-tls=mbedtls. (user: js, size: 9052) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
123 124 125 126 127 128 129 | if (!_initialized) @throw [OFNotOpenException exceptionWithObject: self]; if (_handshakeDone) gnutls_bye(_session, GNUTLS_SHUT_WR); gnutls_deinit(_session); | | | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | if (!_initialized) @throw [OFNotOpenException exceptionWithObject: self]; if (_handshakeDone) gnutls_bye(_session, GNUTLS_SHUT_WR); gnutls_deinit(_session); _initialized = _handshakeDone = false; [_host release]; _host = nil; [super close]; } |
︙ | ︙ | |||
235 236 237 238 239 240 241 | if (_verifiesCertificates) gnutls_session_set_verify_cert(_session, _host.UTF8String, 0); status = gnutls_handshake(_session); if (status == GNUTLS_E_INTERRUPTED || status == GNUTLS_E_AGAIN) { if (gnutls_record_get_direction(_session) == 1) | | < | | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | if (_verifiesCertificates) gnutls_session_set_verify_cert(_session, _host.UTF8String, 0); status = gnutls_handshake(_session); if (status == GNUTLS_E_INTERRUPTED || status == GNUTLS_E_AGAIN) { if (gnutls_record_get_direction(_session) == 1) [_underlyingStream asyncWriteData: [OFData data] runLoopMode: runLoopMode]; else [_underlyingStream asyncReadIntoBuffer: (void *)"" length: 0 runLoopMode: runLoopMode]; [_delegate retain]; return; |
︙ | ︙ | |||
266 267 268 269 270 271 272 | didPerformClientHandshakeWithHost: host exception: exception]; } - (bool)stream: (OFStream *)stream didReadIntoBuffer: (void *)buffer length: (size_t)length | | < < | | 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | didPerformClientHandshakeWithHost: host exception: exception]; } - (bool)stream: (OFStream *)stream didReadIntoBuffer: (void *)buffer length: (size_t)length exception: (id)exception { if (exception == nil) { int status = gnutls_handshake(_session); if (status == GNUTLS_E_INTERRUPTED || status == GNUTLS_E_AGAIN) { if (gnutls_record_get_direction(_session) == 1) { OFRunLoopMode runLoopMode = [OFRunLoop currentRunLoop].currentMode; [_underlyingStream asyncWriteData: [OFData data] runLoopMode: runLoopMode]; return false; } else return true; } if (status == GNUTLS_E_SUCCESS) |
︙ | ︙ |