Blame lib/tls13/psk_ext_parser.h

Packit aea12f
/*
Packit aea12f
 * Copyright (C) 2017 Free Software Foundation, Inc.
Packit aea12f
 *
Packit aea12f
 * Author: Ander Juaristi
Packit aea12f
 *
Packit aea12f
 * This file is part of GnuTLS.
Packit aea12f
 *
Packit aea12f
 * The GnuTLS is free software; you can redistribute it and/or
Packit aea12f
 * modify it under the terms of the GNU Lesser General Public License
Packit aea12f
 * as published by the Free Software Foundation; either version 2.1 of
Packit aea12f
 * the License, or (at your option) any later version.
Packit aea12f
 *
Packit aea12f
 * This library is distributed in the hope that it will be useful, but
Packit aea12f
 * WITHOUT ANY WARRANTY; without even the implied warranty of
Packit aea12f
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit aea12f
 * Lesser General Public License for more details.
Packit aea12f
 *
Packit aea12f
 * You should have received a copy of the GNU Lesser General Public License
Packit aea12f
 * along with this program.  If not, see <https://www.gnu.org/licenses/>
Packit aea12f
 *
Packit aea12f
 */
Packit aea12f
Packit aea12f
#ifndef GNUTLS_LIB_TLS13_PSK_EXT_PARSER_H
Packit aea12f
#define GNUTLS_LIB_TLS13_PSK_EXT_PARSER_H
Packit aea12f
Packit aea12f
struct psk_ext_parser_st {
Packit aea12f
	const unsigned char *identities_data;
Packit aea12f
	ssize_t identities_len;
Packit aea12f
Packit aea12f
	const unsigned char *binders_data;
Packit aea12f
	ssize_t binders_len;
Packit aea12f
};
Packit aea12f
Packit aea12f
typedef struct psk_ext_parser_st psk_ext_parser_st;
Packit aea12f
typedef struct psk_ext_parser_st psk_ext_iter_st;
Packit aea12f
Packit aea12f
struct psk_st {
Packit aea12f
	/* constant values */
Packit aea12f
	gnutls_datum_t identity;
Packit aea12f
	uint32_t ob_ticket_age;
Packit aea12f
};
Packit aea12f
Packit aea12f
int _gnutls13_psk_ext_parser_init(psk_ext_parser_st *p,
Packit aea12f
				  const unsigned char *data, size_t len);
Packit aea12f
Packit aea12f
inline static
Packit aea12f
void _gnutls13_psk_ext_iter_init(psk_ext_iter_st *iter,
Packit aea12f
				 const psk_ext_parser_st *p)
Packit aea12f
{
Packit aea12f
	memcpy(iter, p, sizeof(*p));
Packit aea12f
}
Packit aea12f
Packit aea12f
int _gnutls13_psk_ext_iter_next_identity(psk_ext_iter_st *iter,
Packit aea12f
					 struct psk_st *psk);
Packit aea12f
int _gnutls13_psk_ext_iter_next_binder(psk_ext_iter_st *iter,
Packit aea12f
				       gnutls_datum_t *binder);
Packit aea12f
Packit aea12f
#endif /* GNUTLS_LIB_TLS13_PSK_EXT_PARSER_H */