From 8ff17c544c19592e013518df8c2b0173d5775fad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Fri, 11 Apr 2014 17:27:48 +0200 Subject: [PATCH] Add missing DEBUG_RET on cipher failures --- library/ssl_tls.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 62ed9a007..783b00c90 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -1159,12 +1159,14 @@ static int ssl_encrypt_buf( ssl_context *ssl ) ssl->transform_out->ivlen ) ) != 0 || ( ret = cipher_reset( &ssl->transform_out->cipher_ctx_enc ) ) != 0 ) { + SSL_DEBUG_RET( 1, "cipher_reset", ret ); return( ret ); } if( ( ret = cipher_update_ad( &ssl->transform_out->cipher_ctx_enc, add_data, 13 ) ) != 0 ) { + SSL_DEBUG_RET( 1, "cipher_update_ad", ret ); return( ret ); } @@ -1172,6 +1174,7 @@ static int ssl_encrypt_buf( ssl_context *ssl ) enc_msg, enc_msglen, enc_msg, &olen ) ) != 0 ) { + SSL_DEBUG_RET( 1, "cipher_update", ret ); return( ret ); } totlen = olen; @@ -1179,6 +1182,7 @@ static int ssl_encrypt_buf( ssl_context *ssl ) if( ( ret = cipher_finish( &ssl->transform_out->cipher_ctx_enc, enc_msg + olen, &olen ) ) != 0 ) { + SSL_DEBUG_RET( 1, "cipher_finish", ret ); return( ret ); } totlen += olen; @@ -1197,6 +1201,7 @@ static int ssl_encrypt_buf( ssl_context *ssl ) if( ( ret = cipher_write_tag( &ssl->transform_out->cipher_ctx_enc, enc_msg + enc_msglen, 16 ) ) != 0 ) { + SSL_DEBUG_RET( 1, "cipher_write_tag", ret ); return( ret ); } @@ -1450,12 +1455,14 @@ static int ssl_decrypt_buf( ssl_context *ssl ) ssl->transform_in->ivlen ) ) != 0 || ( ret = cipher_reset( &ssl->transform_in->cipher_ctx_dec ) ) != 0 ) { + SSL_DEBUG_RET( 1, "cipher_reset", ret ); return( ret ); } if( ( ret = cipher_update_ad( &ssl->transform_in->cipher_ctx_dec, add_data, 13 ) ) != 0 ) { + SSL_DEBUG_RET( 1, "cipher_update_ad", ret ); return( ret ); } @@ -1463,6 +1470,7 @@ static int ssl_decrypt_buf( ssl_context *ssl ) dec_msg, dec_msglen, dec_msg_result, &olen ) ) != 0 ) { + SSL_DEBUG_RET( 1, "cipher_update", ret ); return( ret ); } totlen = olen; @@ -1470,6 +1478,7 @@ static int ssl_decrypt_buf( ssl_context *ssl ) if( ( ret = cipher_finish( &ssl->transform_in->cipher_ctx_dec, dec_msg_result + olen, &olen ) ) != 0 ) { + SSL_DEBUG_RET( 1, "cipher_finish", ret ); return( ret ); } totlen += olen;