I am using SDK 3.3.1 and calling wiced_https_get to connect to a web server using SSL. Sometimes it fails to connect when there is not enough memory available on the heap. However, it returns the wrong error code 5035 (WICED_TLS_UNTRUSTED_CERTIFICATE).
wiced_https_get calls wiced_tcp_connect, which calls wiced_tcp_start_tls, which calls calls ssl_handshake_client_async in the BESL library. ssl_handshake_client_async is returning the 5035 code.
In this case there is not really a problem with the certificate; if I make more heap memory available it works. It probably should be returning 5003 (WICED_TLS_ERROR_OUT_OF_MEMORY). If the certificate really is incorrect then the function does correctly return the 5035 code.