Commit a224fe14 authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

PR: 1751

Submitted by: David Woodhouse <dwmw2@infradead.org>
Approved by: steve@openssl.org

Compatibility patches for Cisco VPN client DTLS.
parent 00d5a5ff
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ static int dtls1_get_hello_verify(SSL *s);

static SSL_METHOD *dtls1_get_client_method(int ver)
	{
	if (ver == DTLS1_VERSION)
	if (ver == DTLS1_VERSION || ver == DTLS1_BAD_VER)
		return(DTLSv1_client_method());
	else
		return(NULL);
@@ -181,7 +181,8 @@ int dtls1_connect(SSL *s)
			s->server=0;
			if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_START,1);

			if ((s->version & 0xff00 ) != (DTLS1_VERSION & 0xff00))
			if ((s->version & 0xff00 ) != (DTLS1_VERSION & 0xff00) &&
			    (s->version & 0xff00 ) != (DTLS1_BAD_VER & 0xff00))
				{
				SSLerr(SSL_F_DTLS1_CONNECT, ERR_R_INTERNAL_ERROR);
				ret = -1;
+4 −1
Original line number Diff line number Diff line
@@ -198,6 +198,9 @@ void dtls1_free(SSL *s)
void dtls1_clear(SSL *s)
	{
	ssl3_clear(s);
	if (s->options & SSL_OP_CISCO_ANYCONNECT)
		s->version=DTLS1_BAD_VER;
	else
		s->version=DTLS1_VERSION;
	}

+6 −4
Original line number Diff line number Diff line
@@ -1024,15 +1024,17 @@ start:
	if (rr->type == SSL3_RT_CHANGE_CIPHER_SPEC)
		{
		struct ccs_header_st ccs_hdr;
		int ccs_hdr_len = DTLS1_CCS_HEADER_LENGTH;

		dtls1_get_ccs_header(rr->data, &ccs_hdr);

		/* 'Change Cipher Spec' is just a single byte, so we know
		 * exactly what the record payload has to look like */
		/* XDTLS: check that epoch is consistent */
		if (	(s->client_version == DTLS1_BAD_VER && rr->length != 3) ||
			(s->client_version != DTLS1_BAD_VER && rr->length != DTLS1_CCS_HEADER_LENGTH) || 
			(rr->off != 0) || (rr->data[0] != SSL3_MT_CCS))
		if (s->client_version == DTLS1_BAD_VER || s->version == DTLS1_BAD_VER)
			ccs_hdr_len = 3;

		if ((rr->length != ccs_hdr_len) || (rr->off != 0) || (rr->data[0] != SSL3_MT_CCS))
			{
			i=SSL_AD_ILLEGAL_PARAMETER;
			SSLerr(SSL_F_DTLS1_READ_BYTES,SSL_R_BAD_CHANGE_CIPHER_SPEC);
@@ -1358,7 +1360,7 @@ int do_dtls1_write(SSL *s, int type, const unsigned char *buf, unsigned int len,
#if 0
	/* 'create_empty_fragment' is true only when this function calls itself */
	if (!clear && !create_empty_fragment && !s->s3->empty_fragment_done
		&& SSL_version(s) != DTLS1_VERSION)
	    && SSL_version(s) != DTLS1_VERSION && SSL_version(s) != DTLS1_BAD_VER)
		{
		/* countermeasure against known-IV weakness in CBC ciphersuites
		 * (see http://www.openssl.org/~bodo/tls-cbc.txt) 
+1 −1
Original line number Diff line number Diff line
@@ -708,7 +708,7 @@ int ssl3_get_server_hello(SSL *s)

	if (!ok) return((int)n);

	if ( SSL_version(s) == DTLS1_VERSION)
	if ( SSL_version(s) == DTLS1_VERSION || SSL_version(s) == DTLS1_BAD_VER)
		{
		if ( s->s3->tmp.message_type == DTLS1_MT_HELLO_VERIFY_REQUEST)
			{
+2 −0
Original line number Diff line number Diff line
@@ -510,6 +510,8 @@ typedef struct ssl_session_st
#define SSL_OP_COOKIE_EXCHANGE              0x00002000L
/* Don't use RFC4507 ticket extension */
#define SSL_OP_NO_TICKET	            0x00004000L
/* Use Cisco's "speshul" version of DTLS_BAD_VER (as client)  */
#define SSL_OP_CISCO_ANYCONNECT		    0x00008000L

/* As server, disallow session resumption on renegotiation */
#define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION	0x00010000L
Loading