enum tls_flag_t {
/** set if cipher suites with null encryption are acceptable */
TLS_FLAG_ENCRYPTION_OPTIONAL = 1,
+ /** set if client authentication is optional even if cert req sent */
+ TLS_FLAG_CLIENT_AUTH_OPTIONAL = 2,
};
/**
certs = bio_reader_create(data);
if (!certs->remaining(certs))
{
- DBG1(DBG_TLS, "no certificate sent by peer");
- this->alert->add(this->alert, TLS_FATAL, TLS_DECODE_ERROR);
- return NEED_MORE;
+ if (this->tls->get_flags(this->tls) & TLS_FLAG_CLIENT_AUTH_OPTIONAL)
+ {
+ /* client authentication is not required so we clear the identity */
+ DESTROY_IF(this->peer);
+ this->peer = NULL;
+ }
+ else
+ {
+ DBG1(DBG_TLS, "no certificate sent by peer");
+ this->alert->add(this->alert, TLS_FATAL, TLS_DECODE_ERROR);
+ return NEED_MORE;
+ }
}
while (certs->remaining(certs))
{