From 8cc7e03ae0528d9485e78ad82da3e6c62c44ca37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 25 Sep 2014 12:59:05 +0200 Subject: [PATCH] udp_proxy: show encrypted messages as encrypted --- programs/test/udp_proxy.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/programs/test/udp_proxy.c b/programs/test/udp_proxy.c index 89dfcee1b..ad05b4880 100644 --- a/programs/test/udp_proxy.c +++ b/programs/test/udp_proxy.c @@ -222,7 +222,15 @@ static const char *msg_type( unsigned char *msg, size_t len ) default: return( "Unknown" ); } - if( len < 13 ) return( "Invalid handshake" ); + if( len < 13 + 12 ) return( "Invalid handshake" ); + + /* + * Our handshake message are less than 2^16 bytes long, so they should + * have 0 as the first byte of length, frag_offset and frag_length. + * Otherwise, assume they are encrypted. + */ + if( msg[14] || msg[19] || msg[22] ) return( "Encrypted handshake" ); + switch( msg[13] ) { case SSL_HS_HELLO_REQUEST: return( "HelloRequest" );