[or-cvs] first steps toward a WANTWRITE SSL_write tls bug fix
Roger Dingledine
arma at mit.edu
Sat Oct 18 08:48:11 UTC 2003
On Sat, Oct 18, 2003 at 04:00:21AM -0400, Roger Dingledine wrote:
> Update of /home/or/cvsroot/src/common
> In directory moria.mit.edu:/home2/arma/work/onion/dev/src/common
>
> Modified Files:
> tortls.c
> Log Message:
> first steps toward a WANTWRITE SSL_write tls bug fix
>
> how exactly the same do the arguments need to be? :(
I finally found the problem.
Short synopsis of symptoms: we added some code to dynamically shrink
bufs when they're not being used, to save space. But it turns out that
it broke SSL, because SSL_write wants exactly the same parameters when
it's repeating a write -- including the location of the buf.
(Don't worry, this problem isn't in 0.0.2pre12. But don't upgrade yet :)
When we realloc the buf, the pointer-to-char that we hand SSL_write is
not the same parameter as we used last time.
We obviously can't stick with our 1MB buffers on each connection. And
I don't want to add two layers of bufs in the main application.
So I'm going to add a 16KB internal outbuf to the tor_tls_st struct. When
we tls write, we move 16KB from the mainbuf onto that outbuf, and try
to write it. We loop this until something goes wrong or we're out of
bytes to write. I chose 16KB because that's the max size of an SSL record.
Sound good? Any better ideas?
--Roger
More information about the tor-dev
mailing list