RTE RBC 2oo2 Reference Application 0.1.0 build 0006685
SIL 4 2oo2 Dual-Site Fault-Tolerant ERTMS Radio Block Centre Reference Architecture
Loading...
Searching...
No Matches
ab_gp_takeover_key.h
Go to the documentation of this file.
1
13#ifndef AB_GP_TAKEOVER_KEY_H
14#define AB_GP_TAKEOVER_KEY_H
15
16#include <stdbool.h>
17#include <stddef.h>
18#include <stdint.h>
19
20#include "rte/redundancy/site_role/rte_site_role.h"
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
27#define AB_GP_TAKEOVER_KEY_FILE_ENV "RTE_TAKEOVER_KEY_FILE"
28
30#define AB_GP_TAKEOVER_TOKEN_PREFIX "token="
31
37bool ab_gp_takeover_key_load_file(const char *path);
38
41
45bool ab_gp_takeover_verify_mac(void *user, const uint8_t *msg, size_t msg_len,
46 const uint8_t mac[RTE_SITE_ROLE_TOKEN_MAC_LEN]);
47
52bool ab_gp_takeover_token_from_payload(const char *payload, uint8_t out[RTE_SITE_ROLE_TOKEN_LEN]);
53
54/* ---- issuer side (the status Gateway, role C) ---- */
55
61bool ab_gp_takeover_token_build(uint8_t site_id, uint8_t channel_id, uint32_t challenge, uint32_t seq,
62 uint8_t out[RTE_SITE_ROLE_TOKEN_LEN]);
63
68bool ab_gp_takeover_token_to_payload(const uint8_t token[RTE_SITE_ROLE_TOKEN_LEN], char *out, size_t out_size);
69
70#ifdef __cplusplus
71}
72#endif
73
74#endif /* AB_GP_TAKEOVER_KEY_H */
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_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).
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 mat...
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,...
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.