Add a few #ifdefs

This commit is contained in:
Manuel Pégourié-Gonnard 2014-10-09 17:35:53 +02:00 committed by Paul Bakker
parent ba958b8bdc
commit 8a7cf2543a
2 changed files with 17 additions and 6 deletions

View file

@ -1182,7 +1182,10 @@ read_record_header:
buf = ssl->in_hdr;
#if defined(POLARSSL_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO)
if( ssl->transport == SSL_TRANSPORT_STREAM && ( buf[0] & 0x80 ) != 0 )
#if defined(POLARSSL_SSL_PROTO_DTLS)
if( ssl->transport == SSL_TRANSPORT_STREAM )
#endif
if( ( buf[0] & 0x80 ) != 0 )
return ssl_parse_client_hello_v2( ssl );
#endif

View file

@ -5302,13 +5302,21 @@ const char *ssl_get_alpn_protocol( const ssl_context *ssl )
static int ssl_check_version( const ssl_context *ssl, int major, int minor )
{
if( major < SSL_MIN_MAJOR_VERSION || major > SSL_MAX_MAJOR_VERSION ||
minor < SSL_MIN_MINOR_VERSION || minor > SSL_MAX_MINOR_VERSION ||
( ssl->transport == SSL_TRANSPORT_DATAGRAM &&
minor < SSL_MINOR_VERSION_2 ) )
minor < SSL_MIN_MINOR_VERSION || minor > SSL_MAX_MINOR_VERSION )
{
return( -1 );
}
#if defined(POLARSSL_SSL_PROTO_DTLS)
if( ssl->transport == SSL_TRANSPORT_DATAGRAM &&
minor < SSL_MINOR_VERSION_2 )
{
return( -1 );
}
#else
((void) ssl);
#endif
return( 0 );
}
@ -5788,8 +5796,8 @@ int ssl_read( ssl_context *ssl, unsigned char *buf, size_t len )
}
else
{
#if defined(POLARSSL_SSL_PROTO_DTLS)
/* DTLS clients need to know renego is server-initiated */
#if defined(POLARSSL_SSL_PROTO_DTLS)
if( ssl->transport == SSL_TRANSPORT_DATAGRAM &&
ssl->endpoint == SSL_IS_CLIENT )
{