Trace support for TLS 1.3 certificate request message
@@ -1206,6 +1206,10 @@ static int ssl_print_cert_request(BIO *bio, int indent, SSL *s,
size_t xlen;
unsigned int sigalg;
+ if (SSL_IS_TLS13(s)) {
+ if (!ssl_print_hexbuf(bio, indent, "request_context", 1, &msg, &msglen))
+ return 0;
+ } else {
if (msglen < 1)
return 0;
xlen = msg[0];
@@ -1218,14 +1222,15 @@ static int ssl_print_cert_request(BIO *bio, int indent, SSL *s,
return 0;
msg += xlen;
msglen -= xlen + 1;
- if (!SSL_USE_SIGALGS(s))
- goto skip_sig;
+ }
+ if (SSL_USE_SIGALGS(s)) {
if (msglen < 2)
return 0;
xlen = (msg[0] << 8) | msg[1];
if (msglen < xlen + 2 || (xlen & 1))
return 0;
msg += 2;
+ msglen -= xlen + 2;
BIO_indent(bio, indent, 80);
BIO_printf(bio, "signature_algorithms (len=%d)\n", (int)xlen);
while (xlen > 0) {
@@ -1237,15 +1242,14 @@ static int ssl_print_cert_request(BIO *bio, int indent, SSL *s,
msg += 2;
}
msg += xlen;
- msglen -= xlen + 2;
+ }
- skip_sig:
xlen = (msg[0] << 8) | msg[1];
BIO_indent(bio, indent, 80);
if (msglen < xlen + 2)
return 0;
msg += 2;
- msglen -= 2;
+ msglen -= 2 + xlen;
BIO_printf(bio, "certificate_authorities (len=%d)\n", (int)xlen);
while (xlen > 0) {
size_t dlen;
@@ -1271,7 +1275,12 @@ static int ssl_print_cert_request(BIO *bio, int indent, SSL *s,
xlen -= dlen + 2;
msg += dlen;
}
- return 1;
+ if (SSL_IS_TLS13(s)) {
+ if (!ssl_print_hexbuf(bio, indent, "request_extensions", 2,
+ &msg, &msglen))
+ return 0;
+ }
+ return msglen == 0;
}
static int ssl_print_ticket(BIO *bio, int indent, SSL *s,
