Separate client and server certificate_types. This is the first of reorganizing state between connection state and handshake state. The existing set are retained in cert_st for the server; they are server configuration. The client gets a copy in s->s3->tmp alongside other handshake state. With other handshake state moved there, hopefully we can reset that state in one go and possibly not even maintain it when there is no handshake in progress. Rather than currently where we sometimes confused connection state and handshake state and have to reset as appropriate on renegotiate. While I'm here, document the fields and name them something more useful than 'ctypes'. Change-Id: Ib927579f0004fc5c6854fce2127625df669b2b6d Reviewed-on: https://boringssl-review.googlesource.com/1113 Reviewed-by: Adam Langley <agl@google.com>
diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c index 2fa4101..954dfc9 100644 --- a/ssl/t1_lib.c +++ b/ssl/t1_lib.c
@@ -3805,7 +3805,7 @@ if (!s->server && strict_mode) { STACK_OF(X509_NAME) *ca_dn; - int check_type = 0; + uint8_t check_type = 0; switch (pk->type) { case EVP_PKEY_RSA: @@ -3829,17 +3829,10 @@ } if (check_type) { - const unsigned char *ctypes; - int ctypelen; - ctypes = c->ctypes; - ctypelen = (int)c->ctype_num; - for (i = 0; i < ctypelen; i++) + if (s->s3->tmp.certificate_types && + memchr(s->s3->tmp.certificate_types, check_type, s->s3->tmp.num_certificate_types)) { - if (ctypes[i] == check_type) - { rv |= CERT_PKEY_CERT_TYPE; - break; - } } if (!(rv & CERT_PKEY_CERT_TYPE) && !check_flags) goto end;