Line data Source code
1 : /* 2 : * Copyright (C) 2017 Free Software Foundation, Inc. 3 : * 4 : * Author: Ander Juaristi 5 : * 6 : * This file is part of GnuTLS. 7 : * 8 : * The GnuTLS is free software; you can redistribute it and/or 9 : * modify it under the terms of the GNU Lesser General Public License 10 : * as published by the Free Software Foundation; either version 2.1 of 11 : * the License, or (at your option) any later version. 12 : * 13 : * This library is distributed in the hope that it will be useful, but 14 : * WITHOUT ANY WARRANTY; without even the implied warranty of 15 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 : * Lesser General Public License for more details. 17 : * 18 : * You should have received a copy of the GNU Lesser General Public License 19 : * along with this program. If not, see <https://www.gnu.org/licenses/> 20 : * 21 : */ 22 : 23 : #ifndef GNUTLS_LIB_TLS13_PSK_EXT_PARSER_H 24 : #define GNUTLS_LIB_TLS13_PSK_EXT_PARSER_H 25 : 26 : struct psk_ext_parser_st { 27 : const unsigned char *identities_data; 28 : size_t identities_len; 29 : 30 : const unsigned char *binders_data; 31 : size_t binders_len; 32 : }; 33 : 34 : typedef struct psk_ext_parser_st psk_ext_parser_st; 35 : typedef struct psk_ext_parser_st psk_ext_iter_st; 36 : 37 : struct psk_st { 38 : /* constant values */ 39 : gnutls_datum_t identity; 40 : uint32_t ob_ticket_age; 41 : }; 42 : 43 : int _gnutls13_psk_ext_parser_init(psk_ext_parser_st *p, 44 : const unsigned char *data, size_t len); 45 : 46 : inline static 47 4251 : void _gnutls13_psk_ext_iter_init(psk_ext_iter_st *iter, 48 : const psk_ext_parser_st *p) 49 : { 50 4251 : memcpy(iter, p, sizeof(*p)); 51 : } 52 : 53 : int _gnutls13_psk_ext_iter_next_identity(psk_ext_iter_st *iter, 54 : struct psk_st *psk); 55 : int _gnutls13_psk_ext_iter_next_binder(psk_ext_iter_st *iter, 56 : gnutls_datum_t *binder); 57 : 58 : #endif /* GNUTLS_LIB_TLS13_PSK_EXT_PARSER_H */