Add separate SSL_COOKIE_C define

This commit is contained in:
Manuel Pégourié-Gonnard 2014-07-23 18:30:45 +02:00 committed by Paul Bakker
parent 7d38d215b1
commit a64acd4f84
4 changed files with 22 additions and 6 deletions

View File

@ -263,6 +263,10 @@
#error "Illegal protocol selection" #error "Illegal protocol selection"
#endif #endif
#if defined(POLARSSL_SSL_COOKIE_C) && !defined(POLARSSL_SSL_DTLS_HELLO_VERIFY)
#error "POLARSSL_SSL_COOKIE_C defined, but not all prerequisites"
#endif
#if defined(POLARSSL_SSL_DTLS_HELLO_VERIFY) && \ #if defined(POLARSSL_SSL_DTLS_HELLO_VERIFY) && \
( !defined(POLARSSL_SSL_SRV_C) || !defined(POLARSSL_SSL_PROTO_DTLS) ) ( !defined(POLARSSL_SSL_SRV_C) || !defined(POLARSSL_SSL_PROTO_DTLS) )
#error "POLARSSL_SSL_DTLS_HELLO_VERIFY defined, but not all prerequisites" #error "POLARSSL_SSL_DTLS_HELLO_VERIFY defined, but not all prerequisites"

View File

@ -1930,6 +1930,18 @@
*/ */
#define POLARSSL_SSL_CACHE_C #define POLARSSL_SSL_CACHE_C
/**
* \def POLARSSL_SSL_COOKIE_C
*
* Enable basic implementation of DTLS cookies for hello verification.
*
* Module: library/ssl_cookie.c
* Caller:
*
* Requires: POLARSSL_SSL_DTLS_HELLO_VERIFY
*/
#define POLARSSL_SSL_COOKIE_C
/** /**
* \def POLARSSL_SSL_CLI_C * \def POLARSSL_SSL_CLI_C
* *

View File

@ -33,7 +33,7 @@
#include POLARSSL_CONFIG_FILE #include POLARSSL_CONFIG_FILE
#endif #endif
#if defined(POLARSSL_SSL_DTLS_HELLO_VERIFY) #if defined(POLARSSL_SSL_COOKIE_C)
#include "polarssl/ssl_cookie.h" #include "polarssl/ssl_cookie.h"

View File

@ -81,7 +81,7 @@ int main( int argc, char *argv[] )
#include "polarssl/ssl_cache.h" #include "polarssl/ssl_cache.h"
#endif #endif
#if defined(POLARSSL_SSL_DTLS_HELLO_VERIFY) #if defined(POLARSSL_SSL_COOKIE_C)
#include "polarssl/ssl_cookie.h" #include "polarssl/ssl_cookie.h"
#endif #endif
@ -605,7 +605,7 @@ int main( int argc, char *argv[] )
#endif #endif
const char *pers = "ssl_server2"; const char *pers = "ssl_server2";
unsigned char client_ip[16] = { 0 }; unsigned char client_ip[16] = { 0 };
#if defined(POLARSSL_SSL_DTLS_HELLO_VERIFY) #if defined(POLARSSL_SSL_COOKIE_C)
ssl_cookie_ctx cookie_ctx; ssl_cookie_ctx cookie_ctx;
#endif #endif
@ -665,7 +665,7 @@ int main( int argc, char *argv[] )
#if defined(POLARSSL_SSL_ALPN) #if defined(POLARSSL_SSL_ALPN)
memset( (void *) alpn_list, 0, sizeof( alpn_list ) ); memset( (void *) alpn_list, 0, sizeof( alpn_list ) );
#endif #endif
#if defined(POLARSSL_SSL_DTLS_HELLO_VERIFY) #if defined(POLARSSL_SSL_COOKIE_C)
ssl_cookie_init( &cookie_ctx ); ssl_cookie_init( &cookie_ctx );
#endif #endif
@ -1354,7 +1354,7 @@ int main( int argc, char *argv[] )
ssl_set_session_ticket_lifetime( &ssl, opt.ticket_timeout ); ssl_set_session_ticket_lifetime( &ssl, opt.ticket_timeout );
#endif #endif
#if defined(POLARSSL_SSL_DTLS_HELLO_VERIFY) #if defined(POLARSSL_SSL_COOKIE_C)
if( opt.transport == SSL_TRANSPORT_DATAGRAM ) if( opt.transport == SSL_TRANSPORT_DATAGRAM )
{ {
if( ( ret = ssl_cookie_setup( &cookie_ctx, if( ( ret = ssl_cookie_setup( &cookie_ctx,
@ -1860,7 +1860,7 @@ exit:
#if defined(POLARSSL_SSL_CACHE_C) #if defined(POLARSSL_SSL_CACHE_C)
ssl_cache_free( &cache ); ssl_cache_free( &cache );
#endif #endif
#if defined(POLARSSL_SSL_DTLS_HELLO_VERIFY) #if defined(POLARSSL_SSL_COOKIE_C)
ssl_cookie_free( &cookie_ctx ); ssl_cookie_free( &cookie_ctx );
#endif #endif