-/* $OpenBSD: ssl_tlsext.c,v 1.17 2017/09/25 18:02:27 jsing Exp $ */
+/* $OpenBSD: ssl_tlsext.c,v 1.18 2017/11/28 16:46:14 jsing Exp $ */
/*
* Copyright (c) 2016, 2017 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2017 Doug Hogan <doug@openbsd.org>
{
CBB extensions, extension_data;
struct tls_extension *tlsext;
+ int extensions_present = 0;
size_t i;
if (!CBB_add_u16_length_prefixed(cbb, &extensions))
return 0;
if (!tls_extensions[i].clienthello_build(s, &extension_data))
return 0;
+
+ extensions_present = 1;
}
+ if (!extensions_present)
+ CBB_discard_child(cbb);
+
if (!CBB_flush(cbb))
return 0;
{
CBB extensions, extension_data;
struct tls_extension *tlsext;
+ int extensions_present = 0;
size_t i;
if (!CBB_add_u16_length_prefixed(cbb, &extensions))
return 0;
if (!tlsext->serverhello_build(s, &extension_data))
return 0;
+
+ extensions_present = 1;
}
+ if (!extensions_present)
+ CBB_discard_child(cbb);
+
if (!CBB_flush(cbb))
return 0;