Improve interop by not writing ext_len in ClientHello when 0
The RFC also indicates that without any extensions, we should write a
struct {} (empty) not an array of length zero.
diff --git a/library/ssl_cli.c b/library/ssl_cli.c
index 2a15da1..15fc554 100644
--- a/library/ssl_cli.c
+++ b/library/ssl_cli.c
@@ -212,8 +212,11 @@
SSL_DEBUG_MSG( 3, ( "client hello, total extension length: %d",
ext_len ) );
- *p++ = (unsigned char)( ( ext_len >> 8 ) & 0xFF );
- *p++ = (unsigned char)( ( ext_len ) & 0xFF );
+ if( ext_len > 0 )
+ {
+ *p++ = (unsigned char)( ( ext_len >> 8 ) & 0xFF );
+ *p++ = (unsigned char)( ( ext_len ) & 0xFF );
+ }
if ( ssl->hostname != NULL )
{