1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00
curl/lib/vtls
Jay Satiro 3e7ec1e849 schannel: schannel_recv overhaul
This commit is several drafts squashed together. The changes from each
draft are noted below. If any changes are similar and possibly
contradictory the change in the latest draft takes precedence.

Bug: https://github.com/bagder/curl/issues/244
Reported-by: Chris Araman

%%
%% Draft 1
%%
- return 0 if len == 0. that will have to be documented.
- continue on and process the caches regardless of raw recv
- if decrypted data will be returned then set the error code to CURLE_OK
and return its count
- if decrypted data will not be returned and the connection has closed
(eg nread == 0) then return 0 and CURLE_OK
- if decrypted data will not be returned and the connection *hasn't*
closed then set the error code to CURLE_AGAIN --only if an error code
isn't already set-- and return -1
- narrow the Win2k workaround to only Win2k

%%
%% Draft 2
%%
- Trying out a change in flow to handle corner cases.

%%
%% Draft 3
%%
- Back out the lazier decryption change made in draft2.

%%
%% Draft 4
%%
- Some formatting and branching changes
- Decrypt all encrypted cached data when len == 0
- Save connection closed state
- Change special Win2k check to use connection closed state

%%
%% Draft 5
%%
- Default to CURLE_AGAIN in cleanup if an error code wasn't set and the
connection isn't closed.

%%
%% Draft 6
%%
- Save the last error only if it is an unrecoverable error.

Prior to this I saved the last error state in all cases; unfortunately
the logic to cover that in all cases would lead to some muddle and I'm
concerned that could then lead to a bug in the future so I've replaced
it by only recording an unrecoverable error and that state will persist.

- Do not recurse on renegotiation.

Instead we'll continue on to process any trailing encrypted data
received during the renegotiation only.

- Move the err checks in cleanup after the check for decrypted data.

In either case decrypted data is always returned but I think it's easier
to understand when those err checks come after the decrypted data check.

%%
%% Draft 7
%%
- Regardless of len value go directly to cleanup if there is an
unrecoverable error or a close_notify was already received. Prior to
this change we only acknowledged those two states if len != 0.

- Fix a bug in connection closed behavior: Set the error state in the
cleanup, because we don't know for sure it's an error until that time.

- (Related to above) In the case the connection is closed go "greedy"
with the decryption to make sure all remaining encrypted data has been
decrypted even if it is not needed at that time by the caller. This is
necessary because we can only tell if the connection closed gracefully
(close_notify) once all encrypted data has been decrypted.

- Do not renegotiate when an unrecoverable error is pending.

%%
%% Draft 8
%%
- Don't show 'server closed the connection' info message twice.

- Show an info message if server closed abruptly (missing close_notify).
2015-06-17 00:17:03 -04:00
..
axtls.c axtls: add timeout within Curl_axtls_connect 2015-03-31 02:04:22 +02:00
axtls.h vtls: Removed unimplemented overrides of curlssl_close_all() 2015-01-17 16:41:03 +00:00
cyassl.c cyassl: Implement public key pinning 2015-04-22 17:07:19 -04:00
cyassl.h cyassl: CTX callback cosmetic changes and doc fix 2015-03-28 16:41:51 +01:00
darwinssl.c darwinsssl: add support for TLS False Start 2015-03-21 12:22:56 -05:00
darwinssl.h darwinsssl: add support for TLS False Start 2015-03-21 12:22:56 -05:00
gskit.c vtls: use curl_printf.h all over 2015-03-03 23:17:43 +01:00
gskit.h gskit.h: Code policing of function pointer arguments 2015-01-17 17:02:01 +00:00
gtls.c curl_setup: Add macros for FOPEN_READTEXT, FOPEN_WRITETEXT 2015-06-01 03:21:23 -04:00
gtls.h gtls: implement CURLOPT_CERTINFO 2015-03-20 19:03:53 +01:00
nss.c nss: fix compilation failure with old versions of NSS 2015-04-27 15:37:16 +02:00
nssg.h nss: add support for TLS False Start 2015-03-20 20:14:35 +01:00
openssl.c openssl: LibreSSL and BoringSSL do not use TLS_client_method 2015-06-08 23:45:26 -04:00
openssl.h openssl: use colons properly in the ciphers list 2015-03-12 23:29:46 +01:00
polarssl_threadlock.c vtls: use curl_printf.h all over 2015-03-03 23:17:43 +01:00
polarssl_threadlock.h vtls: moved all TLS/SSL source and header files into subdir 2013-12-20 17:12:42 +01:00
polarssl.c polarssl: called mbedTLS in 1.3.10 and later 2015-03-25 09:19:57 +01:00
polarssl.h vtls: Removed unimplemented overrides of curlssl_close_all() 2015-01-17 16:41:03 +00:00
schannel.c schannel: schannel_recv overhaul 2015-06-17 00:17:03 -04:00
schannel.h schannel: schannel_recv overhaul 2015-06-17 00:17:03 -04:00
vtls.c vtls: Don't accept unknown CURLOPT_SSLVERSION values 2015-03-27 09:32:23 +01:00
vtls.h Curl_ssl_md5sum: return CURLcode 2015-03-25 08:32:12 +01:00