190#define HKDS_SHAKE_256
210#define HKDS_CACHE_MULTIPLIER 4
218#define HKDS_ADMIN_SIZE 2
224#define HKDS_AUTHENTICATION_KMAC 0x11
230#define HKDS_AUTHENTICATION_NONE 0x10
236#define HKDS_AUTHENTICATION_SHA3 0x12
245#define HKDS_PARALLEL_DEPTH 8
254#define HKDS_CACHX8_DEPTH 8
260#define HKDS_CACHX64_SIZE 64
266#define HKDS_CTOK_SIZE 23
272#define HKDS_DID_SIZE 12
278#define HKDS_ERROR_SIZE 16
284#define HKDS_HEADER_SIZE 4
290#define HKDS_KID_SIZE 4
296#define HKDS_KSN_SIZE 16
302#define HKDS_MESSAGE_SIZE 16
308#define HKDS_NAME_SIZE 7
314#define HKDS_TAG_SIZE 16
320#define HKDS_TKC_SIZE 4
329#define HKDS_TMS_SIZE (HKDS_KSN_SIZE + HKDS_NAME_SIZE)
331#if defined(HKDS_SHAKE_128)
337# define HKDS_BDK_SIZE 16
343# define HKDS_EDK_SIZE 16
349# define HKDS_ETOK_SIZE 32
355# define HKDS_PRF_RATE 168
361# define HKDS_PROTOCOL_TYPE protocol_shake_128
367# define HKDS_STK_SIZE 16
372static const uint8_t hkds_formal_name[
HKDS_NAME_SIZE] = { 0x48, 0x4B, 0x44, 0x53, 0x31, 0x32, 0x38 };
377static const uint8_t hkds_mac_name[
HKDS_NAME_SIZE] = { 0x75, 0x4B, 0x77, 0x65, 0x31, 0x32, 0x38 };
379#elif defined(HKDS_SHAKE_256)
385# define HKDS_BDK_SIZE 32
391# define HKDS_EDK_SIZE 32
397# define HKDS_ETOK_SIZE 48
403# define HKDS_PRF_RATE 136
409# define HKDS_PROTOCOL_TYPE protocol_shake_256
415# define HKDS_STK_SIZE 32
420static const uint8_t hkds_formal_name[
HKDS_NAME_SIZE] = { 0x48, 0x4B, 0x44, 0x53, 0x32, 0x35, 0x36 };
425static const uint8_t hkds_mac_name[
HKDS_NAME_SIZE] = { 0x75, 0x4B, 0x77, 0x65, 0x32, 0x35, 0x36 };
427#elif defined(HKDS_SHAKE_512)
433# define HKDS_BDK_SIZE 64
439# define HKDS_EDK_SIZE 64
445# define HKDS_ETOK_SIZE 80
451# define HKDS_PRF_RATE 72
457# define HKDS_PROTOCOL_TYPE protocol_shake_512
463# define HKDS_STK_SIZE 64
468static const uint8_t hkds_formal_name[
HKDS_NAME_SIZE] = { 0x48, 0x4B, 0x44, 0x53, 0x35, 0x31, 0x32 };
473static const uint8_t hkds_mac_name[
HKDS_NAME_SIZE] = { 0x75, 0x4B, 0x77, 0x65, 0x35, 0x31, 0x32 };
484#define HKDS_CACHE_SIZE ((HKDS_CACHE_MULTIPLIER * HKDS_PRF_RATE) / HKDS_MESSAGE_SIZE)
493#define HKDS_CLIENT_MESSAGE_REQUEST_SIZE (HKDS_HEADER_SIZE + HKDS_KSN_SIZE + HKDS_MESSAGE_SIZE + HKDS_TAG_SIZE)
502#define HKDS_CLIENT_TOKEN_REQUEST_SIZE (HKDS_HEADER_SIZE + HKDS_KSN_SIZE)
511#define HKDS_SERVER_MESSAGE_RESPONSE_SIZE (HKDS_HEADER_SIZE + HKDS_MESSAGE_SIZE)
520#define HKDS_SERVER_TOKEN_RESPONSE_SIZE (HKDS_HEADER_SIZE + HKDS_ETOK_SIZE)
529#define HKDS_ADMIN_MESSAGE_SIZE (HKDS_HEADER_SIZE + HKDS_ADMIN_SIZE)
538#define HKDS_ERROR_MESSAGE_SIZE (HKDS_HEADER_SIZE + HKDS_ERROR_SIZE)
#define HKDS_MESSAGE_SIZE
The encrypted message size in bytes.
Definition hkds_config.h:302
#define HKDS_NAME_SIZE
Internal: The formal algorithm name size in bytes.
Definition hkds_config.h:308
#define HKDS_TAG_SIZE
The size of the authentication tag (MAC) in bytes.
Definition hkds_config.h:314
hkds_error_type
Enumerates the error types for HKDS packet communications.
Definition hkds_config.h:119
@ error_connection_aborted
Definition hkds_config.h:121
@ error_connection_failure
Definition hkds_config.h:126
@ error_connection_refused
Definition hkds_config.h:123
@ error_unkown_failure
Definition hkds_config.h:127
@ error_disconnected
Definition hkds_config.h:122
@ error_general_failure
Definition hkds_config.h:120
@ error_invalid_format
Definition hkds_config.h:124
@ error_retries_exceeded
Definition hkds_config.h:125
hkds_packet_type
Enumerates the types of packets used in HKDS communications.
Definition hkds_config.h:79
@ packet_administrative_message
Definition hkds_config.h:84
@ packet_error_message
Definition hkds_config.h:85
@ packet_token_request
Definition hkds_config.h:80
@ packet_token_response
Definition hkds_config.h:81
@ packet_message_response
Definition hkds_config.h:83
@ packet_message_request
Definition hkds_config.h:82
#define HKDS_ERROR_SIZE
The error message size in bytes.
Definition hkds_config.h:278
hkds_protocol_id
Enumerates the supported cryptographic protocol identifiers.
Definition hkds_config.h:98
@ protocol_shake_128
Definition hkds_config.h:99
@ protocol_shake_256
Definition hkds_config.h:100
@ protocol_shake_512
Definition hkds_config.h:101
hkds_message_type
Enumerates the HKDS packet message types.
Definition hkds_config.h:143
@ message_reserved1
Definition hkds_config.h:149
@ message_diagnostic
Definition hkds_config.h:148
@ message_reinitialized_token
Definition hkds_config.h:145
@ message_reserved2
Definition hkds_config.h:150
@ message_reserved3
Definition hkds_config.h:151
@ message_synchronize_token
Definition hkds_config.h:144
@ message_token_requests_exceeded
Definition hkds_config.h:146
@ message_remote_reset
Definition hkds_config.h:147
#define HKDS_ETOK_SIZE
The encrypted token (server response) size for SHAKE-256 in bytes.
Definition hkds_config.h:397
#define HKDS_KSN_SIZE
The Key Serial Number (KSN) size in bytes.
Definition hkds_config.h:296
#define HKDS_ADMIN_SIZE
The size of the administrative message in bytes.
Definition hkds_config.h:218
Represents an administrative message packet.
Definition hkds_config.h:639
hkds_packet_header header
Definition hkds_config.h:640
uint8_t message[HKDS_ADMIN_SIZE]
Definition hkds_config.h:641
Represents the client's encrypted message request packet.
Definition hkds_config.h:573
hkds_packet_header header
Definition hkds_config.h:574
uint8_t ksn[HKDS_KSN_SIZE]
Definition hkds_config.h:575
uint8_t message[HKDS_MESSAGE_SIZE]
Definition hkds_config.h:576
uint8_t tag[HKDS_TAG_SIZE]
Definition hkds_config.h:577
Represents the client token request packet.
Definition hkds_config.h:591
hkds_packet_header header
Definition hkds_config.h:592
uint8_t ksn[HKDS_KSN_SIZE]
Definition hkds_config.h:593
Represents an error message packet.
Definition hkds_config.h:654
hkds_packet_header header
Definition hkds_config.h:655
uint8_t message[HKDS_ERROR_SIZE]
Definition hkds_config.h:656
Represents the server's plaintext message response packet.
Definition hkds_config.h:607
hkds_packet_header header
Definition hkds_config.h:608
uint8_t message[HKDS_MESSAGE_SIZE]
Definition hkds_config.h:609
Represents the server's token response packet.
Definition hkds_config.h:623
hkds_packet_header header
Definition hkds_config.h:624
uint8_t etok[HKDS_ETOK_SIZE]
Definition hkds_config.h:625