- /* Set the public key */
- tls_set_peer_pubkey(ctx->hdsk, certs);
+ /* Set the public key, only if we have certs.
+ We don't return an handshake error if there is no cert,
+ The fact that there is no cert should be reflected in the
+ trust results above, or will be handle when the application
+ does its own trust evaluation. */
+ if(certs) {
+ require_noerr(err=tls_set_peer_pubkey(ctx->hdsk, certs), out);
+ }