[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [or-cvs] first steps toward a WANTWRITE SSL_write tls bug fix
- To: or-dev@freehaven.net
- Subject: Re: [or-cvs] first steps toward a WANTWRITE SSL_write tls bug fix
- From: Roger Dingledine <arma@mit.edu>
- Date: Sat, 18 Oct 2003 04:48:11 -0400
- Delivered-to: archiver@seul.org
- Delivered-to: or-dev-outgoing@seul.org
- Delivered-to: or-dev@seul.org
- Delivery-date: Sat, 18 Oct 2003 04:48:21 -0400
- In-reply-to: <20031018080021.72D4733DF2@moria.seul.org>; from arma@seul.org on Sat, Oct 18, 2003 at 04:00:21AM -0400
- References: <20031018080021.72D4733DF2@moria.seul.org>
- Reply-to: or-dev@freehaven.net
- Sender: owner-or-dev@freehaven.net
- User-agent: Mutt/1.2.5.1i
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