RTE RBC 2oo2 Reference Application
0.1.0 build 0006685
SIL 4 2oo2 Dual-Site Fault-Tolerant ERTMS Radio Block Centre Reference Architecture
Toggle main menu visibility
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
23
extern
"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
37
bool
ab_gp_takeover_key_load_file
(
const
char
*path);
38
40
bool
ab_gp_takeover_key_loaded
(
void
);
41
45
bool
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
52
bool
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
61
bool
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
68
bool
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 */
ab_gp_takeover_token_from_payload
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
ab_gp_takeover_key.c:139
ab_gp_takeover_token_to_payload
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
ab_gp_takeover_key.c:181
ab_gp_takeover_key_loaded
bool ab_gp_takeover_key_loaded(void)
Definition
ab_gp_takeover_key.c:116
ab_gp_takeover_verify_mac
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...
Definition
ab_gp_takeover_key.c:121
ab_gp_takeover_token_build
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,...
Definition
ab_gp_takeover_key.c:151
ab_gp_takeover_key_load_file
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
ab_gp_takeover_key.c:75
src
application
AB
GP
com
ab_gp_takeover_key.h
Generated by
1.18.0