|
iPXE
|
TLS data formats. More...
#include <string.h>#include <errno.h>#include <byteswap.h>#include <ipxe/tls.h>#include <ipxe/tlsfmt.h>Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| FILE_SECBOOT (PERMITTED) | |
| static const char * | tls_map_name (const uint8_t *map) |
| Get data structure descriptor mapping name (for debugging). | |
| static int | tls_parse_extensions (const uint8_t *map, unsigned int index, struct tls_cursor *fields, unsigned int count) |
| Parse TLS extensions within a data structure. | |
| int | tls_parse_map (const uint8_t *map, unsigned int version, const struct tls_cursor *cursor, union tls_ptr_len *desc) |
| Parse TLS data structure. | |
| int | tls_parse_opt_map (const uint8_t *map, unsigned int version, const struct tls_cursor *cursor, union tls_ptr_len *desc) |
| Parse optional TLS data structure. | |
| static int | tls_build_extensions (const uint8_t *map, unsigned int index, struct tls_cursor *fields, unsigned int count) |
| Build TLS extensions within a data structure. | |
| int | tls_build_map (const uint8_t *map, unsigned int version, union tls_ptr_len *desc, struct tls_cursor *cursor) |
| Build TLS data structure. | |
| TLS_DESCR_MAPPING (tls_certificate) | |
| Certificate descriptor mapping. | |
| TLS_DESCR_MAPPING (tls_certificate_entry) | |
| CertificateEntry descriptor mapping. | |
| TLS_DESCR_MAPPING (tls_digitally_signed) | |
| DigitallySigned descriptor mapping. | |
| TLS_DESCR_MAPPING (tls_extension) | |
| Extension descriptor mapping. | |
| TLS_DESCR_MAPPING (tls_hello_request) | |
| HelloRequest descriptor mapping. | |
| TLS_DESCR_MAPPING (tls_key_share_entry) | |
| KeyShareEntry descriptor mapping. | |
| TLS_DESCR_MAPPING (tls_new_session_ticket) | |
| NewSessionTicket descriptor mapping. | |
| TLS_DESCR_MAPPING (tls_renegotiation_info) | |
| RenegotiationInfo descriptor mapping. | |
| TLS_DESCR_MAPPING (tls_server_hello) | |
| ServerHello descriptor mapping. | |
| TLS_DESCR_MAPPING (tls_server_hello_done) | |
| ServerHello descriptor mapping. | |
| TLS_DESCR_MAPPING (tls_server_key_exchange_dhe) | |
| ServerKeyExchange descriptor mapping (for DHE). | |
| TLS_DESCR_MAPPING (tls_server_key_exchange_ecdhe) | |
| ServerKeyExchange descriptor mapping (for EcDHE). | |
| TLS_DESCR_MAPPING (tls_supported_version) | |
| SupportedVersions descriptor mapping (in ServerHello). | |
| TLS_DESCR_MAPPING (tls_supported_versions) | |
| SupportedVersions descriptor mapping (in ClientHello). | |
TLS data formats.
Definition in file tlsfmt.c.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
| FILE_SECBOOT | ( | PERMITTED | ) |
|
static |
Get data structure descriptor mapping name (for debugging).
| map | Data structure descriptor mapping |
| name | Data structure name |
Definition at line 45 of file tlsfmt.c.
References map.
Referenced by tls_build_extensions(), tls_build_map(), tls_parse_extensions(), tls_parse_map(), and tls_parse_opt_map().
|
static |
Parse TLS extensions within a data structure.
| map | Data structure descriptor mapping |
| index | Current index within mapping |
| fields | Extensions data fields |
| count | Number of extensions |
| rc | Return status code |
Definition at line 87 of file tlsfmt.c.
References __attribute__, count, data, tls_cursor::data, tls_extension::data, DBGC, DBGC2, DBGC2_HDA, EINVAL, EPROTO, index, len, tls_cursor::len, map, tls_extension::next, ntohs, rc, tls_map_name(), tls_parse, TLS_VERSION_BASE, tls_extension::type, and type.
Referenced by tls_parse_map().
| int tls_parse_map | ( | const uint8_t * | map, |
| unsigned int | version, | ||
| const struct tls_cursor * | cursor, | ||
| union tls_ptr_len * | desc ) |
Parse TLS data structure.
| map | Data structure descriptor mapping |
| version | Protocol version |
| cursor | Cursor containing TLS data structure |
| desc | Data structure descriptor to fill in |
| rc | Return status code |
Definition at line 148 of file tlsfmt.c.
References assert, container_of, count, data, tls_cursor::data, DBGC, DBGC2, DBGC2_HDA, DBGC_HDA, desc, EINVAL, EPROTO, fixed, index, len, tls_cursor::len, map, memset(), next, rc, TLS_MAP_EXTENSIONS, TLS_MAP_FIXED, TLS_MAP_LEN_LEN, TLS_MAP_MIN, tls_map_name(), tls_parse_extensions(), TLS_VERSION_TLS_1_3, and version.
Referenced by tls_parse_opt_map().
| int tls_parse_opt_map | ( | const uint8_t * | map, |
| unsigned int | version, | ||
| const struct tls_cursor * | cursor, | ||
| union tls_ptr_len * | desc ) |
Parse optional TLS data structure.
| map | Data structure descriptor mapping |
| version | Protocol version |
| cursor | Cursor containing TLS data structure |
| desc | Data structure descriptor to fill in |
| rc | Return status code |
Definition at line 319 of file tlsfmt.c.
References count, tls_cursor::data, DBGC, desc, EINVAL, map, memset(), rc, tls_map_name(), tls_parse_map(), and version.
|
static |
Build TLS extensions within a data structure.
| map | Data structure descriptor mapping |
| index | Current index within mapping |
| fields | Extensions data fields |
| count | Number of extensions |
| rc | Return status code |
Definition at line 356 of file tlsfmt.c.
References __attribute__, count, data, tls_cursor::data, tls_extension::data, DBGC, DBGC2, DBGC2_HDA, EINVAL, index, len, tls_cursor::len, map, tls_extension::next, ntohs, rc, tls_build, tls_map_name(), TLS_VERSION_BASE, tls_extension::type, and type.
Referenced by tls_build_map().
| int tls_build_map | ( | const uint8_t * | map, |
| unsigned int | version, | ||
| union tls_ptr_len * | desc, | ||
| struct tls_cursor * | cursor ) |
Build TLS data structure.
| map | Data structure descriptor mapping |
| version | Protocol version |
| desc | Data structure descriptor |
| cursor | Cursor to contain TLS data structure |
| rc | Return status code |
Build a TLS data structure at the cursor. The cursor's original length will be ignored and will be set to the overall length of the built data structure. The caller must ensure that sufficient space already exists (e.g. by calling tls_size() first to determine the required length).
The overall length will be calculated based on the variable lengths within the descriptor. The output content will be be copied from any non-NULL pointers within the descriptor (with any missing content initialised to zero).
Pointers within the descriptor will be updated to point to the appropriate location within the built data structure.
The caller must therefore fill in any variable lengths within the descriptor beforehand, but may freely choose to either fill in pointers within the descriptor beforehand or to write through the updated pointers afterwards.
A cursor with a NULL data pointer may be used to calculate the required length without copying in any data or updating any pointers within the descriptor.
Definition at line 444 of file tlsfmt.c.
References assert, container_of, count, data, tls_cursor::data, DBGC, DBGC2, DBGC2_HDA, desc, EINVAL, ERANGE, fixed, index, len, tls_cursor::len, map, max, memcpy(), memset(), next, NULL, rc, tls_build_extensions(), TLS_MAP_EXTENSIONS, TLS_MAP_FIXED, TLS_MAP_LEN_LEN, TLS_MAP_LEN_LEN_MAX, TLS_MAP_MIN, tls_map_name(), TLS_VERSION_TLS_1_3, and version.
Referenced by tls_size_map().
| TLS_DESCR_MAPPING | ( | tls_certificate | ) |
Certificate descriptor mapping.
References TLS_MAPSZ, TLS_VAR08, TLS_VAR24, TLS_VERSION_BASE, and TLS_VERSION_TLS_1_3.
| TLS_DESCR_MAPPING | ( | tls_certificate_entry | ) |
CertificateEntry descriptor mapping.
References ext, next, TLS_EXT16, TLS_EXTRA, TLS_MAPSZ, TLS_VAR24, TLS_VERSION_BASE, and TLS_VERSION_TLS_1_3.
| TLS_DESCR_MAPPING | ( | tls_digitally_signed | ) |
DigitallySigned descriptor mapping.
References sig, TLS_FIXED, TLS_MAPSZ, TLS_VAR16, TLS_VERSION_BASE, and TLS_VERSION_TLS_1_2.
| TLS_DESCR_MAPPING | ( | tls_extension | ) |
| TLS_DESCR_MAPPING | ( | tls_hello_request | ) |
HelloRequest descriptor mapping.
References TLS_MAPSZ.
| TLS_DESCR_MAPPING | ( | tls_key_share_entry | ) |
| TLS_DESCR_MAPPING | ( | tls_new_session_ticket | ) |
| TLS_DESCR_MAPPING | ( | tls_renegotiation_info | ) |
RenegotiationInfo descriptor mapping.
References TLS_MAPSZ, TLS_VAR08, and TLS_VERSION_BASE.
| TLS_DESCR_MAPPING | ( | tls_server_hello | ) |
ServerHello descriptor mapping.
References ext, TLS_EXT16, TLS_EXTENDED_MASTER_SECRET, TLS_EXTND, TLS_FIXED, TLS_KEY_SHARE, TLS_MAPSZ, TLS_RENEGOTIATION_INFO, TLS_SUPPORTED_VERSIONS, TLS_VAR08, and TLS_VERSION_BASE.
| TLS_DESCR_MAPPING | ( | tls_server_hello_done | ) |
ServerHello descriptor mapping.
References TLS_MAPSZ.
| TLS_DESCR_MAPPING | ( | tls_server_key_exchange_dhe | ) |
ServerKeyExchange descriptor mapping (for DHE).
References TLS_EXTRA, TLS_MAPSZ, TLS_VAR16, and TLS_VERSION_BASE.
| TLS_DESCR_MAPPING | ( | tls_server_key_exchange_ecdhe | ) |
ServerKeyExchange descriptor mapping (for EcDHE).
References TLS_EXTRA, TLS_FIXED, TLS_MAPSZ, TLS_VAR08, and TLS_VERSION_BASE.
| TLS_DESCR_MAPPING | ( | tls_supported_version | ) |
SupportedVersions descriptor mapping (in ServerHello).
References TLS_FIXED, TLS_MAPSZ, and TLS_VERSION_BASE.
| TLS_DESCR_MAPPING | ( | tls_supported_versions | ) |
SupportedVersions descriptor mapping (in ClientHello).
References TLS_MAPSZ, TLS_VAR08, TLS_VERSION_BASE, and versions.