net/tls: Fix implementation of VERIFY_OPTIONAL verification mode
net/tls: Fix implementation of VERIFY_OPTIONAL verification mode

This commit changes the behaviour of mbedtls_ssl_parse_certificate
to make the two authentication modes MBEDTLS_SSL_VERIFY_REQUIRED and
MBEDTLS_SSL_VERIFY_OPTIONAL be in the following relationship:

    Mode == MBEDTLS_SSL_VERIFY_REQUIRED
<=> Mode == MBEDTLS_SSL_VERIFY_OPTIONAL + check verify result

Also, it changes the behaviour to perform the certificate chain
verification even if the trusted CA chain is empty. Previously, the
function failed in this case, even when using optional verification,
which was brought up in #864.
(#864 https://github.com/ARMmbed/mbedtls/issues/864)

Change-Id: I02c37457f68d8d2b7623c63d22e40f0136ddfda6
Signed-off-by: Joohwan Kim <d8eb2057d34b4ed71c8b9c3943d864bbf0a7d8e6@samsung.com>

JunhwanPark/TizenRT,JunhwanPark/TizenRT,JunhwanPark/TizenRT,JunhwanPark/TizenRT,JunhwanPark/TizenRT,JunhwanPark/TizenRT