boringssl/ssl
David Benjamin 87c8a643e1 Use TCP sockets rather than socketpairs in the SSL tests.
This involves more synchronization with child exits as the kernel no longer
closes the pre-created pipes for free, but it works on Windows. As long as
TCP_NODELAY is set, the performance seems comparable. Though it does involve
dealing with graceful socket shutdown. I couldn't get that to work on Windows
without draining the socket; not even SO_LINGER worked. Current (untested)
theory is that Windows refuses to gracefully shutdown a socket if the peer
sends data after we've stopped reading.

cmd.ExtraFiles doesn't work on Windows; it doesn't use fds natively, so you
can't pass fds 4 and 5. (stdin/stdout/stderr are special slots in
CreateProcess.) We can instead use the syscall module directly and mark handles
as inheritable (and then pass the numerical values out-of-band), but that
requires synchronizing all of our shim.Start() calls and assuming no other
thread is spawning a process.

PROC_THREAD_ATTRIBUTE_HANDLE_LIST fixes threading problems, but requires
wrapping more syscalls.  exec.Cmd also doesn't let us launch the process
ourselves. Plus it still requires every handle in the list be marked
inheritable, so it doesn't help if some other thread is launching a process
with bInheritHandles TRUE but NOT using PROC_THREAD_ATTRIBUTE_HANDLE_LIST.
(Like Go, though we can take syscall.ForkLock there.)

http://blogs.msdn.com/b/oldnewthing/archive/2011/12/16/10248328.aspx

The more natively Windows option seems to be named pipes, but that too requires
wrapping more system calls. (To be fair, that isn't too painful.) They also
involve a listening server, so we'd still have to synchronize with shim.Wait()
a la net.TCPListener.

Then there's DuplicateHandle, but then we need an out-of-band signal.

All in all, one cross-platform implementation with a TCP sockets seems
simplest.

Change-Id: I38233e309a0fa6814baf61e806732138902347c0
Reviewed-on: https://boringssl-review.googlesource.com/3563
Reviewed-by: Adam Langley <agl@google.com>
2015-02-23 19:59:06 +00:00
..
pqueue Fix memory leak in pqueue_test. 2015-02-11 23:18:45 +00:00
test Use TCP sockets rather than socketpairs in the SSL tests. 2015-02-23 19:59:06 +00:00
CMakeLists.txt Precompute sorted array for error strings. 2015-02-09 17:35:31 -08:00
d1_both.c Pass fragment to dtls1_retransmit_message. 2015-02-20 19:58:14 +00:00
d1_clnt.c Remove BIO_should_retry checks in DTLS state machines. 2015-02-23 19:32:27 +00:00
d1_lib.c Handle failures in ssl3_finish_mac. 2015-02-17 21:01:37 +00:00
d1_meth.c
d1_pkt.c Tidy up the alert-parsing code. 2015-02-23 19:34:52 +00:00
d1_srtp.c Store SRTP_PROTECTION_PROFILES as const. 2015-01-14 22:10:08 +00:00
d1_srvr.c Remove BIO_should_retry checks in DTLS state machines. 2015-02-23 19:32:27 +00:00
s3_both.c Handle failures in ssl3_finish_mac. 2015-02-17 21:01:37 +00:00
s3_clnt.c Handle failures in ssl3_finish_mac. 2015-02-17 21:01:37 +00:00
s3_enc.c Handle failures in ssl3_finish_mac. 2015-02-17 21:01:37 +00:00
s3_lib.c Use SSL_MODE_SEND_FALLBACK_SCSV. 2015-02-20 23:44:09 +00:00
s3_meth.c
s3_pkt.c Tidy up the alert-parsing code. 2015-02-23 19:34:52 +00:00
s3_srvr.c Handle failures in ssl3_finish_mac. 2015-02-17 21:01:37 +00:00
ssl_algs.c Precompute sorted array for error strings. 2015-02-09 17:35:31 -08:00
ssl_asn1.c
ssl_cert.c Add in missing curly braces part 3. 2015-02-11 15:14:46 -08:00
ssl_ciph.c Add SSL_CIPHER_get_rfc_name. 2015-02-09 17:31:28 -08:00
ssl_lib.c Add SSL_get_cipher_by_value. 2015-02-20 23:44:17 +00:00
ssl_locl.h Pass fragment to dtls1_retransmit_message. 2015-02-20 19:58:14 +00:00
ssl_rsa.c Don't EVP_PKEY_copy_parameters when configuring cert and key. 2015-02-17 21:03:29 +00:00
ssl_sess.c Remove server-side HelloVerifyRequest support. 2015-02-17 20:50:08 +00:00
ssl_stat.c Remove server-side HelloVerifyRequest support. 2015-02-17 20:50:08 +00:00
ssl_test.c Use SSL_get_cipher_by_value in cipher_get_rfc_name tests. 2015-02-23 19:33:02 +00:00
ssl_txt.c Add in missing curly braces part 3. 2015-02-11 15:14:46 -08:00
t1_enc.c Add some missing error failure checks. 2015-02-17 20:55:56 +00:00
t1_lib.c Add some missing error failure checks. 2015-02-17 20:55:56 +00:00
t1_reneg.c