[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gnutls-dev
Subject:    Re: [gnutls-dev] a few questions
From:       Nikos Mavroyanopoulos <nmav () hellug ! gr>
Date:       2001-10-30 19:34:12
[Download RAW message or body]

On Tue, 30 Oct 2001 09:00:28 -0600 Jon Nelson <jnelson@securepipe.com> wrote:

> gnutls_record.c, in gnutls_send_int, if there is data remaining to be sent
> from a previous interrupted write, you set cipher to NULL and cipher_size
> to state->gnutls_internals.send_buffer.size +
> state->gnutls_internals.send_buffer_prev_size  
> /* 1st test */
> if (state->gnutls_internals.send_buffer.size > 0 && iptr != NULL) {
> 		gnutls_assert();
> 		return GNUTLS_E_INVALID_PARAMETERS;
> 	}
> 	/* If data in the buffer exist
> 	 */
> /* second test */
> if (iptr == NULL) {
> 		if ( state->gnutls_internals.send_buffer.size == 0) {
> 			gnutls_assert();
> 			return GNUTLS_E_INVALID_PARAMETERS;
> 		} else {
> 			ptr = state->gnutls_internals.send_buffer.data;
> 			n = state->gnutls_internals.send_buffer.size;
> 		}
> 	}
> Technically, the first test is superior on the off-chance that
> gnutls_internals.send_buffer.size is < 0
Yes the second test had no real effect. I've removed that in the
cvs. Negative values, are not valid (since the types used are unsigned).

> However, here you set n (which was cipher_size) to
> state->gnutls_internals.send_buffer.size;
> Which is more appropriate?  
> As a precaution, perhaps "n" (cipher_size) could be passed in as -1 from
> gnutls_buffers.c in the case of handling a previously blocked write -- it
> might help debugging in the future.
These functions are a bit complex... I've done some cleanups in the cvs, but
there is more to be done.

> -- 
> Jon Nelson                \|/ ____ \|/   Gort,
> jnelson@securepipe.com    "@'/ ,. \`@"   Klaatu
> C and Python Programmer   /_| \__/ |_\   barada
> Motorcycle Enthusiast        \__U_/      nikto.

-- 
Nikos Mavroyanopoulos
mailto:nmav@hellug.gr

_______________________________________________
Gnutls-dev mailing list
Gnutls-dev@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnutls-dev

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic