xref: /dflybsd-src/crypto/libressl/ssl/ssl_tlsext.h (revision 961e30ea7dc61d1112b778ea4981eac68129fb86)
1*de0e0e4dSAntonio Huete Jimenez /* $OpenBSD: ssl_tlsext.h,v 1.32 2022/08/04 09:27:36 tb Exp $ */
272c33676SMaxim Ag /*
372c33676SMaxim Ag  * Copyright (c) 2016, 2017 Joel Sing <jsing@openbsd.org>
472c33676SMaxim Ag  * Copyright (c) 2017 Doug Hogan <doug@openbsd.org>
572c33676SMaxim Ag  * Copyright (c) 2019 Bob Beck <beck@openbsd.org>
672c33676SMaxim Ag  *
772c33676SMaxim Ag  * Permission to use, copy, modify, and distribute this software for any
872c33676SMaxim Ag  * purpose with or without fee is hereby granted, provided that the above
972c33676SMaxim Ag  * copyright notice and this permission notice appear in all copies.
1072c33676SMaxim Ag  *
1172c33676SMaxim Ag  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1272c33676SMaxim Ag  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1372c33676SMaxim Ag  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1472c33676SMaxim Ag  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1572c33676SMaxim Ag  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1672c33676SMaxim Ag  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1772c33676SMaxim Ag  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1872c33676SMaxim Ag  */
1972c33676SMaxim Ag 
2072c33676SMaxim Ag #ifndef HEADER_SSL_TLSEXT_H
2172c33676SMaxim Ag #define HEADER_SSL_TLSEXT_H
2272c33676SMaxim Ag 
2372c33676SMaxim Ag /* TLSv1.3 - RFC 8446 Section 4.2. */
2472c33676SMaxim Ag #define SSL_TLSEXT_MSG_CH	0x0001	/* ClientHello */
2572c33676SMaxim Ag #define SSL_TLSEXT_MSG_SH	0x0002	/* ServerHello */
2672c33676SMaxim Ag #define SSL_TLSEXT_MSG_EE	0x0004	/* EncryptedExtension */
2772c33676SMaxim Ag #define SSL_TLSEXT_MSG_CT	0x0008	/* Certificate */
2872c33676SMaxim Ag #define SSL_TLSEXT_MSG_CR	0x0010	/* CertificateRequest */
2972c33676SMaxim Ag #define SSL_TLSEXT_MSG_NST	0x0020	/* NewSessionTicket */
30cca6fc52SDaniel Fojt #define SSL_TLSEXT_MSG_HRR	0x0040	/* HelloRetryRequest */
3172c33676SMaxim Ag 
3272c33676SMaxim Ag __BEGIN_HIDDEN_DECLS
3372c33676SMaxim Ag 
34*de0e0e4dSAntonio Huete Jimenez int tlsext_alpn_check_format(CBS *cbs);
35*de0e0e4dSAntonio Huete Jimenez int tlsext_sni_is_valid_hostname(CBS *cbs, int *is_ip);
3672c33676SMaxim Ag 
378edacedfSDaniel Fojt int tlsext_client_build(SSL *s, uint16_t msg_type, CBB *cbb);
388edacedfSDaniel Fojt int tlsext_client_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);
3972c33676SMaxim Ag 
408edacedfSDaniel Fojt int tlsext_server_build(SSL *s, uint16_t msg_type, CBB *cbb);
418edacedfSDaniel Fojt int tlsext_server_parse(SSL *s, uint16_t msg_type, CBS *cbs, int *alert);
4272c33676SMaxim Ag 
4372c33676SMaxim Ag int tlsext_extension_seen(SSL *s, uint16_t);
44*de0e0e4dSAntonio Huete Jimenez 
4572c33676SMaxim Ag __END_HIDDEN_DECLS
4672c33676SMaxim Ag 
4772c33676SMaxim Ag #endif
48