Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
*
* This function specifies if we (in case of a server) are going to
* send a certificate request message to the client. If @req is
- * GNUTLS_CERT_REQUIRE then the server will return an error if the
- * peer does not provide a certificate. If you do not call this
+ * GNUTLS_CERT_REQUIRE then the server will return the %GNUTLS_E_NO_CERTIFICATE_FOUND
+ * error if the peer does not provide a certificate. If you do not call this
* function then the client will not be asked to send a certificate.
**/
void
}
ret = _gnutls_recv_handshake(session, GNUTLS_HANDSHAKE_CERTIFICATE_PKT, optional, &buf);
- if (ret < 0)
+ if (ret < 0) {
+ if (ret == GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET && session->internals.send_cert_req)
+ return gnutls_assert_val(GNUTLS_E_NO_CERTIFICATE_FOUND);
+
return gnutls_assert_val(ret);
+ }
if (buf.length == 0 && optional) {
return 0;