|
RTE RBC 2oo2 Reference Application 0.1.0 build 0006685
SIL 4 2oo2 Dual-Site Fault-Tolerant ERTMS Radio Block Centre Reference Architecture
|
The site's takeover key and the token codec for the dispatcher takeover confirmation (ADR-040 step 4b). More...
#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include "rte/redundancy/site_role/rte_site_role.h"Go to the source code of this file.
Macros | |
| #define | AB_GP_TAKEOVER_KEY_FILE_ENV "RTE_TAKEOVER_KEY_FILE" |
| #define | AB_GP_TAKEOVER_TOKEN_PREFIX "token=" |
Functions | |
| bool | ab_gp_takeover_key_load_file (const char *path) |
| Loads the key file (one key, 48 hex characters) into this process's key slot. | |
| bool | ab_gp_takeover_key_loaded (void) |
| bool | ab_gp_takeover_verify_mac (void *user, const uint8_t *msg, size_t msg_len, const uint8_t mac[RTE_SITE_ROLE_TOKEN_MAC_LEN]) |
| rte_site_role verify_mac callback: true only when a key is loaded and the Subset-037 MAC over msg matches. | |
| bool | ab_gp_takeover_token_from_payload (const char *payload, uint8_t out[RTE_SITE_ROLE_TOKEN_LEN]) |
| Decodes a util payload token=<48 hex> into a token. | |
| bool | ab_gp_takeover_token_build (uint8_t site_id, uint8_t channel_id, uint32_t challenge, uint32_t seq, uint8_t out[RTE_SITE_ROLE_TOKEN_LEN]) |
| Builds a token for one channel: the message (version, site id, channel id, challenge, issuer sequence) and its Subset-037 MAC with the loaded key. | |
| bool | ab_gp_takeover_token_to_payload (const uint8_t token[RTE_SITE_ROLE_TOKEN_LEN], char *out, size_t out_size) |
| Encodes a token as the util payload token=<48 hex> (NUL-terminated). | |
The site's takeover key and the token codec for the dispatcher takeover confirmation (ADR-040 step 4b).
Platform_RTE's rte_site_role checks a takeover token (RTE_SITE_ROLE_TOKEN_LEN bytes) against this channel's challenge; the MAC itself is checked here, with the Subset-037 MAC of Platform_Protocol_SafeComm (RTE links no crypto). The key comes from the file named by RTE_TAKEOVER_KEY_FILE: one line of 48 hex characters (24 bytes, the 3DES key used directly as the MAC key), # comments allowed - the same encoding as SafeComm's kmac_file. The issuer (the status Gateway, on a Maintenance Web request) MACs with the same file.
On the util link (RBC_UTIL_TOPIC_TAKEOVER_CONFIRM) the token travels as the ASCII payload token=<48 hex>.
Definition in file ab_gp_takeover_key.h.
| #define AB_GP_TAKEOVER_KEY_FILE_ENV "RTE_TAKEOVER_KEY_FILE" |
Environment variable naming the takeover key file. Unset or empty: the interim unauthenticated path.
Definition at line 27 of file ab_gp_takeover_key.h.
| #define AB_GP_TAKEOVER_TOKEN_PREFIX "token=" |
Payload prefix of a token frame on the util link.
Definition at line 30 of file ab_gp_takeover_key.h.
| bool ab_gp_takeover_key_load_file | ( | const char * | path | ) |
Loads the key file (one key, 48 hex characters) into this process's key slot.
Definition at line 75 of file ab_gp_takeover_key.c.
| bool ab_gp_takeover_key_loaded | ( | void | ) |
Definition at line 116 of file ab_gp_takeover_key.c.
| bool ab_gp_takeover_verify_mac | ( | void * | user, |
| const uint8_t * | msg, | ||
| size_t | msg_len, | ||
| const uint8_t | mac[RTE_SITE_ROLE_TOKEN_MAC_LEN] ) |
rte_site_role verify_mac callback: true only when a key is loaded and the Subset-037 MAC over msg matches.
Definition at line 121 of file ab_gp_takeover_key.c.
| bool ab_gp_takeover_token_from_payload | ( | const char * | payload, |
| uint8_t | out[RTE_SITE_ROLE_TOKEN_LEN] ) |
Decodes a util payload token=<48 hex> into a token.
Definition at line 139 of file ab_gp_takeover_key.c.
| bool ab_gp_takeover_token_build | ( | uint8_t | site_id, |
| uint8_t | channel_id, | ||
| uint32_t | challenge, | ||
| uint32_t | seq, | ||
| uint8_t | out[RTE_SITE_ROLE_TOKEN_LEN] ) |
Builds a token for one channel: the message (version, site id, channel id, challenge, issuer sequence) and its Subset-037 MAC with the loaded key.
Definition at line 151 of file ab_gp_takeover_key.c.
| bool ab_gp_takeover_token_to_payload | ( | const uint8_t | token[RTE_SITE_ROLE_TOKEN_LEN], |
| char * | out, | ||
| size_t | out_size ) |
Encodes a token as the util payload token=<48 hex> (NUL-terminated).
Definition at line 181 of file ab_gp_takeover_key.c.