From d27680bd5e1da333bc319a8d4554e79c068a2ec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Tue, 8 Jul 2014 14:15:55 +0200 Subject: [PATCH] Clarify code using PSK callback --- library/ssl_srv.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/library/ssl_srv.c b/library/ssl_srv.c index e647a9a43..8c8fa2cbf 100644 --- a/library/ssl_srv.c +++ b/library/ssl_srv.c @@ -2635,11 +2635,10 @@ static int ssl_parse_client_psk_identity( ssl_context *ssl, unsigned char **p, if( ssl->f_psk != NULL ) { - if( ( ret != ssl->f_psk( ssl->p_psk, ssl, *p, n ) ) != 0 ) + if( ssl->f_psk( ssl->p_psk, ssl, *p, n ) != 0 ) ret = POLARSSL_ERR_SSL_UNKNOWN_IDENTITY; } - - if( ret == 0 ) + else { /* Identity is not a big secret since clients send it in the clear, * but treat it carefully anyway, just in case */ @@ -2664,9 +2663,8 @@ static int ssl_parse_client_psk_identity( ssl_context *ssl, unsigned char **p, } *p += n; - ret = 0; - return( ret ); + return( 0 ); } #endif /* POLARSSL_KEY_EXCHANGE__SOME__PSK_ENABLED */