-/* $OpenBSD: ssl_tlsext.c,v 1.125 2022/07/20 15:16:06 tb Exp $ */
+/* $OpenBSD: ssl_tlsext.c,v 1.126 2022/07/22 13:10:31 tb Exp $ */
/*
* Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2017 Doug Hogan <doug@openbsd.org>
if (!CBS_get_u16_length_prefixed(cbs, &alpn))
goto err;
- if (CBS_len(cbs) != 0)
- goto err;
if (!tlsext_alpn_check_format(&alpn))
goto err;
if (!CBS_get_u16_length_prefixed(cbs, &list))
goto err;
- if (CBS_len(cbs) != 0)
- goto err;
if (!CBS_get_u8_length_prefixed(&list, &proto))
goto err;
if (!CBS_get_u16_length_prefixed(cbs, &grouplist))
goto err;
- if (CBS_len(cbs) != 0)
- goto err;
groups_len = CBS_len(&grouplist);
if (groups_len == 0 || groups_len % 2 != 0)
return 0;
if (CBS_len(&ecpf) == 0)
return 0;
- if (CBS_len(cbs) != 0)
- return 0;
/* Must contain uncompressed (0) - RFC 8422, section 5.1.2. */
if (!CBS_contains_zero_byte(&ecpf)) {
if (!CBS_get_u8_length_prefixed(cbs, &reneg))
goto err;
- if (CBS_len(cbs) != 0)
- goto err;
if (!CBS_mem_equal(&reneg, s->s3->previous_client_finished,
s->s3->previous_client_finished_len)) {
goto err;
if (CBS_len(&reneg) != 0)
goto err;
- if (CBS_len(cbs) != 0)
- goto err;
if (!CBS_mem_equal(&prev_client, s->s3->previous_client_finished,
s->s3->previous_client_finished_len)) {
*alert = SSL_AD_ILLEGAL_PARAMETER;
goto err;
}
- if (CBS_len(cbs) != 0)
- goto err;
return 1;
goto err;
}
- /* should be nothing left */
- if (CBS_len(cbs) > 0)
- goto err;
-
ret = 1;
err:
if (ret == 0)
*alert = SSL_AD_DECODE_ERROR;
goto done;
}
- if (CBS_len(cbs) != 0)
- goto err;
/*
* Per RFC 5764 section 4.1.1