|
RTE RBC 2oo2 Reference Application 0.1.0 build 0006685
SIL 4 2oo2 Dual-Site Fault-Tolerant ERTMS Radio Block Centre Reference Architecture
|
See ab_gp_km114_client.h. More...
#include "ab_gp_km114_client.h"#include "ab_gp_saf_train.h"#include <stdbool.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include "rte/oal/log/rte_log.h"#include "km114/km114.h"Go to the source code of this file.
Functions | |
| static void | handle_install_transport_key (const uint8_t *bytes, size_t len, const char *role_tag, rte_example_site_t site) |
| static void | handle_add_authentication_key (const uint8_t *bytes, size_t len, const char *role_tag, rte_example_site_t site, ab_gp_channel_handle_t handle) |
| static void | install_kmac (const uint8_t kmac[KM114_MAC_KEY_LEN], uint32_t snum, const char *role_tag, rte_example_site_t site, ab_gp_channel_handle_t handle) |
| static int | km114_cross_check (const char *role_tag, rte_example_site_t site) |
| void | ab_gp_km114_client_on_message (const uint8_t *bytes, size_t len, const char *role_tag, rte_example_site_t site, ab_gp_channel_handle_t handle) |
| Processes one complete, reassembled Subset-114 message. | |
| int | ab_gp_km114_client_on_peer_digest (const uint8_t *payload, size_t size, const char *role_tag, rte_example_site_t site) |
Consumes a PEER_MSG_KIND_KM114_DIGEST frame from the A/B sibling (called from pre_execute.c's own peer-frame dispatch) and cross-checks it against this side's own most recently installed KMAC for the same serial number, in whichever order the two sides' installs and this frame arrive. Logs MATCH/MISMATCH (snum only, never the key); does nothing if size is too short. | |
| static void | install_train_link_keys (const km114_kstruct_t *ks, const uint8_t kmac[KM114_MAC_KEY_LEN], const char *role_tag, rte_example_site_t site) |
| static void | send_km114_digest (ab_gp_channel_handle_t handle, uint32_t snum, const uint8_t kmac[KM114_MAC_KEY_LEN]) |
Variables | |
| static bool | s_have_ktrans = false |
| static uint8_t | s_ktrans1 [KM114_MAC_KEY_LEN] |
| static uint8_t | s_ktrans2 [KM114_MAC_KEY_LEN] |
| static bool | s_have_own = false |
| static uint32_t | s_own_snum = 0U |
| static uint8_t | s_own_kmac [KM114_MAC_KEY_LEN] |
| static bool | s_have_peer = false |
| static uint32_t | s_peer_snum = 0U |
| static uint8_t | s_peer_kmac [KM114_MAC_KEY_LEN] |
See ab_gp_km114_client.h.
Definition in file ab_gp_km114_client.c.
|
static |
Local function declarations
Definition at line 98 of file ab_gp_km114_client.c.
|
static |
Definition at line 147 of file ab_gp_km114_client.c.
|
static |
Definition at line 223 of file ab_gp_km114_client.c.
|
static |
Compares this side's own most recently installed KMAC against whatever the A/B sibling last sent, when both are known for the SAME serial number - called after either one arrives, so the comparison happens regardless of which side's install or which side's frame gets here first. Logs MATCH/MISMATCH only (snum, never the key). A mismatch is reported, not rebooted on - a free correctness check on top of the vital data path, per the consumption design's own framing, not a new fault path in its own right.
Definition at line 198 of file ab_gp_km114_client.c.
| void ab_gp_km114_client_on_message | ( | const uint8_t * | bytes, |
| size_t | len, | ||
| const char * | role_tag, | ||
| rte_example_site_t | site, | ||
| ab_gp_channel_handle_t | handle ) |
Processes one complete, reassembled Subset-114 message.
Global functions
Dispatches by the message's own header type:
The plaintext key is NEVER written to a log line - only its length/serial number/outcome.
On a successful ADD_AUTHENTICATION_KEY, the decoded KMAC is also cross-checked against the A/B sibling's own independently decoded result (PEER_MSG_KIND_KM114_DIGEST, sent here and consumed via ab_gp_km114_client_on_peer_digest()) - step 3 of the consumption design, a free correctness check, not a new vital-fault path: a mismatch is logged (never the key itself), not rebooted on.
| bytes | The full reassembled message. |
| len | Its length. |
| role_tag | This process's own role tag ("A"/"B"), for log lines. |
| site | This process's own site, for log lines. |
| handle | This channel's own handle, to send the A/B cross-check frame. May be NULL (the cross-check is then skipped, e.g. from a unit test with no live channel). |
Definition at line 50 of file ab_gp_km114_client.c.
| int ab_gp_km114_client_on_peer_digest | ( | const uint8_t * | payload, |
| size_t | size, | ||
| const char * | role_tag, | ||
| rte_example_site_t | site ) |
Consumes a PEER_MSG_KIND_KM114_DIGEST frame from the A/B sibling (called from pre_execute.c's own peer-frame dispatch) and cross-checks it against this side's own most recently installed KMAC for the same serial number, in whichever order the two sides' installs and this frame arrive. Logs MATCH/MISMATCH (snum only, never the key); does nothing if size is too short.
| payload | 4-byte snum followed by the 24-byte plaintext KMAC. |
| size | Length of payload. |
| role_tag | This process's own role tag, for log lines. |
| site | This process's own site, for log lines. |
payload was malformed or this side has no own KMAC for that snum yet (the comparison then happens later, from install_kmac(), once this side installs its own). Definition at line 82 of file ab_gp_km114_client.c.
|
static |
Hands the decoded KMAC to the train-link SaF termination in memory (SAFE_COMM_INTEGRATION.dox, REQ-SC-005), once per entity the K-STRUCT says it is valid with - the SaF layer looks it up by the ETCS identity a train announces in AU1. Logs the count only, never the key.
Definition at line 126 of file ab_gp_km114_client.c.
|
static |
Sends this side's own decoded KMAC to the A/B sibling for the cross-check (ab_gp_km114_client_on_peer_digest() on the receiving end) - PEER_MSG_KIND_KM114_DIGEST, immediate (not staged), same as the negotiation-level frames this link already carries (SITE_STATE, CHECKPOINT_*): a rare, one-off control event, not this cycle's own decision output.
Definition at line 176 of file ab_gp_km114_client.c.
|
static |
Local makros Local types declarations Local variables declarations
Definition at line 26 of file ab_gp_km114_client.c.
|
static |
Definition at line 27 of file ab_gp_km114_client.c.
|
static |
Definition at line 28 of file ab_gp_km114_client.c.
|
static |
Definition at line 33 of file ab_gp_km114_client.c.
|
static |
Definition at line 34 of file ab_gp_km114_client.c.
|
static |
Definition at line 35 of file ab_gp_km114_client.c.
|
static |
Definition at line 36 of file ab_gp_km114_client.c.
|
static |
Definition at line 37 of file ab_gp_km114_client.c.
|
static |
Definition at line 38 of file ab_gp_km114_client.c.