From 3aac1daf1d04b3875d5a8c600cf763ec22e6cf77 Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Tue, 8 May 2012 13:12:27 +0000 Subject: [PATCH] - Added exception error parsing when FATAL ssl message is received --- library/error.c | 3 +++ scripts/generate_errors.pl | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/library/error.c b/library/error.c index 195a25506..4528ea197 100644 --- a/library/error.c +++ b/library/error.c @@ -255,7 +255,10 @@ void error_strerror( int ret, char *buf, size_t buflen ) if( use_ret == -(POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE) ) snprintf( buf, buflen, "SSL - An unexpected message was received from our peer" ); if( use_ret == -(POLARSSL_ERR_SSL_FATAL_ALERT_MESSAGE) ) + { snprintf( buf, buflen, "SSL - A fatal alert message was received from our peer" ); + return; + } if( use_ret == -(POLARSSL_ERR_SSL_PEER_VERIFY_FAILED) ) snprintf( buf, buflen, "SSL - Verification of our peer failed" ); if( use_ret == -(POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY) ) diff --git a/scripts/generate_errors.pl b/scripts/generate_errors.pl index 362534ef9..91dafd6c3 100755 --- a/scripts/generate_errors.pl +++ b/scripts/generate_errors.pl @@ -93,8 +93,19 @@ while (my $line = ) ${$old_define} = $define_name; } - ${$code_check} .= "${white_space}if( use_ret == -($error_name) )\n". - "${white_space} snprintf( buf, buflen, \"$module_name - $description\" );\n" + if ($error_name eq "POLARSSL_ERR_SSL_FATAL_ALERT_MESSAGE") + { + ${$code_check} .= "${white_space}if( use_ret == -($error_name) )\n". + "${white_space}\{\n". + "${white_space} snprintf( buf, buflen, \"$module_name - $description\" );\n". + "${white_space} return;\n". + "${white_space}}\n" + } + else + { + ${$code_check} .= "${white_space}if( use_ret == -($error_name) )\n". + "${white_space} snprintf( buf, buflen, \"$module_name - $description\" );\n" + } }; if ($ll_old_define ne "")