tls: Align set and usage check for PSK
Check that the identity length is not
zero in ssl_conf_set_psk_identity()
as it is done in
mbedtls_ssl_conf_has_static_psk().
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index 4678f53..a3586e7 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -1654,6 +1654,7 @@
{
/* Identity len will be encoded on two bytes */
if( psk_identity == NULL ||
+ psk_identity_len == 0 ||
( psk_identity_len >> 16 ) != 0 ||
psk_identity_len > MBEDTLS_SSL_OUT_CONTENT_LEN )
{