List Info

Thread: OpenSSL: OpenSSL_0_9_8-stable: openssl/ssl/ d1_clnt.c d1_pkt.c d...




OpenSSL: OpenSSL_0_9_8-stable: openssl/ssl/ d1_clnt.c d1_pkt.c d...
country flaguser name
Germany
2007-09-30 13:56:00
  OpenSSL CVS Repository
  http://cvs.openssl.org/
 
____________________________________________________________
________________

  Server: cvs.openssl.org                  Name:   Andy
Polyakov
  Root:   /v/openssl/cvs                   Email:  approopenssl.org
  Module: openssl                          Date:  
30-Sep-2007 20:56:00
  Branch: OpenSSL_0_9_8-stable             Handle:
2007093019555900

  Modified files:           (Branch: OpenSSL_0_9_8-stable)
    openssl/ssl             d1_clnt.c d1_pkt.c d1_srvr.c
dtls1.h s3_srvr.c

  Log:
    Switch for RFC-compliant version encoding in DTLS. From
HEAD with a twist:
    server accepts even non-compliant encoding in order to
enable interop with
    pre-0.9.8f clients.

  Summary:
    Revision    Changes     Path
    1.3.2.7     +2  -2      openssl/ssl/d1_clnt.c
    1.4.2.6     +12 -7      openssl/ssl/d1_pkt.c
    1.2.2.9     +21 -12     openssl/ssl/d1_srvr.c
    1.4.2.2     +2  -3      openssl/ssl/dtls1.h
    1.126.2.15  +6  -4      openssl/ssl/s3_srvr.c
 
____________________________________________________________
________________

  patch -p0 <<' .'
  Index: openssl/ssl/d1_clnt.c
 
============================================================
================
  $ cvs diff -u -r1.3.2.6 -r1.3.2.7 d1_clnt.c
  --- openssl/ssl/d1_clnt.c	5 Dec 2005 17:32:19
-0000	1.3.2.6
  +++ openssl/ssl/d1_clnt.c	30 Sep 2007 18:55:59
-0000	1.3.2.7
   -732,7 +732,7 
   			s->session->master_key_length=sizeof tmp_buf;
   
   			q=p;
  -			/* Fix buf for TLS and beyond */
  +			/* Fix buf for TLS and [incidentally] DTLS */
   			if (s->version > SSL3_VERSION)
   				p+=2;
   			n=RSA_public_encrypt(sizeof tmp_buf,
   -747,7 +747,7 
   				goto err;
   				}
   
  -			/* Fix buf for TLS and beyond */
  +			/* Fix buf for TLS and [incidentally] DTLS */
   			if (s->version > SSL3_VERSION)
   				{
   				s2n(n,q);
   .
  patch -p0 <<' .'
  Index: openssl/ssl/d1_pkt.c
 
============================================================
================
  $ cvs diff -u -r1.4.2.5 -r1.4.2.6 d1_pkt.c
  --- openssl/ssl/d1_pkt.c	29 Nov 2006 14:45:13
-0000	1.4.2.5
  +++ openssl/ssl/d1_pkt.c	30 Sep 2007 18:55:59
-0000	1.4.2.6
   -486,9 +486,9 
   	SSL3_RECORD *rr;
   	SSL_SESSION *sess;
   	unsigned char *p;
  -	short version;
  +	unsigned short version;
   	DTLS1_BITMAP *bitmap;
  -    unsigned int is_next_epoch;
  +	unsigned int is_next_epoch;
   
   	rr= &(s->s3->rrec);
   	sess=s->session;
   -524,7 +524,7 
   		ssl_minor= *(p++);
   		version=(ssl_major<<8)|ssl_minor;
   
  -        /* sequence number is 64 bits, with top 2 bytes =
epoch */ 
  +		/* sequence number is 64 bits, with top 2 bytes = epoch
*/ 
   		n2s(p,rr->epoch);
   
   		memcpy(&(s->s3->read_sequence[2]), p, 6);
   -535,7 +535,7 
   		/* Lets check version */
   		if (!s->first_packet)
   			{
  -			if (version != s->version)
  +			if (version != s->version && version !=
DTLS1_BAD_VER)
   				{
  
				SSLerr(SSL_F_DTLS1_GET_RECORD,SSL_R_WRONG_VERSION_NUMBER
);
   				/* Send back error using their
   -546,7 +546,8 
   				}
   			}
   
  -		if ((version & 0xff00) != (DTLS1_VERSION &
0xff00))
  +		if ((version & 0xff00) != (DTLS1_VERSION &
0xff00) &&
  +		    (version & 0xff00) != (DTLS1_BAD_VER &
0xff00))
   			{
  
			SSLerr(SSL_F_DTLS1_GET_RECORD,SSL_R_WRONG_VERSION_NUMBER)
;
   			goto err;
   -1341,8 +1342,12 
   	*(p++)=type&0xff;
   	wr->type=type;
   
  -	*(p++)=(s->version>>8);
  -	*(p++)=s->version&0xff;
  +	if (s->client_version == DTLS1_BAD_VER)
  +		*(p++) = DTLS1_BAD_VER>>8,
  +		*(p++) = DTLS1_BAD_VER&0xff;
  +	else
  +		*(p++)=(s->version>>8),
  +		*(p++)=s->version&0xff;
   
   	/* field where we are to write out packet epoch, seq num
and len */
   	pseq=p; 
   .
  patch -p0 <<' .'
  Index: openssl/ssl/d1_srvr.c
 
============================================================
================
  $ cvs diff -u -r1.2.2.8 -r1.2.2.9 d1_srvr.c
  --- openssl/ssl/d1_srvr.c	28 Sep 2007 16:29:24
-0000	1.2.2.8
  +++ openssl/ssl/d1_srvr.c	30 Sep 2007 18:55:59
-0000	1.2.2.9
   -620,19 +620,24 
   		buf = (unsigned char *)s->init_buf->data;
   
   		msg = p = &(buf[DTLS1_HM_HEADER_LENGTH]);
  -		*(p++) = s->version >> 8;
  -		*(p++) = s->version & 0xFF;
  +		if (s->client_version == DTLS1_BAD_VER)
  +			*(p++) = DTLS1_BAD_VER>>8,
  +			*(p++) = DTLS1_BAD_VER&0xff;
  +		else
  +			*(p++) = s->version >> 8,
  +			*(p++) = s->version & 0xFF;
   
   		*(p++) = (unsigned char) s->d1->cookie_len;
  -        if ( s->ctx->app_gen_cookie_cb != NULL
&&
  -            s->ctx->app_gen_cookie_cb(s,
s->d1->cookie, 
  -                &(s->d1->cookie_len)) == 0)
  -            {
  +
  +		if (s->ctx->app_gen_cookie_cb != NULL &&
  +		    s->ctx->app_gen_cookie_cb(s,
s->d1->cookie, 
  +		    &(s->d1->cookie_len)) == 0)
  +			{
  
			SSLerr(SSL_F_DTLS1_SEND_HELLO_VERIFY_REQUEST,ERR_R_INTERN
AL_ERROR);
  -            return 0;
  -            }
  -        /* else the cookie is assumed to have 
  -         * been initialized by the application */
  +			return 0;
  +			}
  +		/* else the cookie is assumed to have 
  +		 * been initialized by the application */
   
   		memcpy(p, s->d1->cookie,
s->d1->cookie_len);
   		p += s->d1->cookie_len;
   -672,8 +677,12 
   		/* Do the message type and length last */
   		d=p= &(buf[DTLS1_HM_HEADER_LENGTH]);
   
  -		*(p++)=s->version>>8;
  -		*(p++)=s->version&0xff;
  +		if (s->client_version == DTLS1_BAD_VER)
  +			*(p++)=DTLS1_BAD_VER>>8,
  +			*(p++)=DTLS1_BAD_VER&0xff;
  +		else
  +			*(p++)=s->version>>8,
  +			*(p++)=s->version&0xff;
   
   		/* Random stuff */
   		memcpy(p,s->s3->server_random,SSL3_RANDOM_SIZE);
   .
  patch -p0 <<' .'
  Index: openssl/ssl/dtls1.h
 
============================================================
================
  $ cvs diff -u -r1.4.2.1 -r1.4.2.2 dtls1.h
  --- openssl/ssl/dtls1.h	30 May 2005 22:34:27
-0000	1.4.2.1
  +++ openssl/ssl/dtls1.h	30 Sep 2007 18:55:59
-0000	1.4.2.2
   -67,9 +67,8 
   extern "C" {
   #endif
   
  -#define DTLS1_VERSION			0x0100
  -#define DTLS1_VERSION_MAJOR		0x01
  -#define DTLS1_VERSION_MINOR		0x00
  +#define DTLS1_VERSION			0xFEFF
  +#define DTLS1_BAD_VER			0x0100
   
   #define DTLS1_AD_MISSING_HANDSHAKE_MESSAGE    110
   
   .
  patch -p0 <<' .'
  Index: openssl/ssl/s3_srvr.c
 
============================================================
================
  $ cvs diff -u -r1.126.2.14 -r1.126.2.15 s3_srvr.c
  --- openssl/ssl/s3_srvr.c	20 Aug 2007 12:44:22
-0000	1.126.2.14
  +++ openssl/ssl/s3_srvr.c	30 Sep 2007 18:55:59
-0000	1.126.2.15
   -714,7 +714,8 
   	s->client_version=(((int)p[0])<<8)|(int)p[1];
   	p+=2;
   
  -	if (s->client_version < s->version)
  +	if ((s->version == DTLS1_VERSION &&
s->client_version > s->version) ||
  +	    (s->version != DTLS1_VERSION &&
s->client_version < s->version))
   		{
   		SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,
SSL_R_WRONG_VERSION_NUMBER);
   		if ((s->client_version>>8) ==
SSL3_VERSION_MAJOR) 
   -765,7 +766,7 
   
   	p+=j;
   
  -	if (SSL_version(s) == DTLS1_VERSION)
  +	if (s->version == DTLS1_VERSION)
   		{
   		/* cookie stuff */
   		cookie_len = *(p++);
   -1748,8 +1749,9 
   			rsa=pkey->pkey.rsa;
   			}
   
  -		/* TLS */
  -		if (s->version > SSL3_VERSION)
  +		/* TLS and [incidentally] DTLS, including pre-0.9.8f
*/
  +		if (s->version > SSL3_VERSION &&
  +		    s->client_version != DTLS1_BAD_VER)
   			{
   			n2s(p,i);
   			if (n != i+2)
   .
____________________________________________________________
__________
OpenSSL Project                                 http://www.openssl.org
CVS Repository Commit List                    
openssl-cvsopenssl.org
Automated List Manager                          
majordomoopenssl.org

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )