1 /* 2 * Copyright (c) 2026, Arm Limited. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 * 6 */ 7 8 #ifndef __SFCP_TRUSTED_SUBNET_H__ 9 #define __SFCP_TRUSTED_SUBNET_H__ 10 11 #include <stdint.h> 12 13 #include <drivers/arm/sfcp_link_defs.h> 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 #ifndef SFCP_INFLIGHT_BITFIELD_SIZE 20 #define SFCP_INFLIGHT_BITFIELD_SIZE 8 21 #endif 22 23 #define SFCP_TRUSTED_SUBNET_RE_KEY_SEQ_NUM (UINT16_MAX - 16) 24 25 enum sfcp_cryptography_mode_t { 26 SFCP_CRYPTOGRAPHY_MODE_AES256_CCM = 0, 27 SFCP_CRYPTOGRAPHY_MODE_AES256_GCM = 1, 28 SFCP_CRYPTOGRAPHY_MODE_SM4_CCM = 2, 29 SFCP_CRYPTOGRAPHY_MODE_SM4_GCM = 3, 30 _SFCP_CRYPTOGRAPHY_AES256_MODE_PAD = UINT8_MAX, 31 }; 32 33 enum sfcp_trusted_subnet_type_t { 34 SFCP_TRUSTED_SUBNET_TRUSTED_LINKS, 35 SFCP_TRUSTED_SUBNET_INITIALLY_UNTRUSTED_LINKS, 36 SFCP_TRUSTED_SUBNET_UNTRUSTED_LINKS, 37 }; 38 39 struct sfcp_trusted_subnet_node_t { 40 sfcp_node_id_t id; 41 uint16_t send_seq_num; 42 uint16_t recv_seq_num; 43 uint8_t bitfield_start_index; 44 uint8_t inflight_bitfield[(SFCP_INFLIGHT_BITFIELD_SIZE + 7) / 8]; 45 }; 46 47 struct sfcp_trusted_subnet_config_t { 48 uint8_t id; 49 enum sfcp_trusted_subnet_type_t type; 50 uint32_t key_id; 51 enum sfcp_cryptography_mode_t mode; 52 uint8_t node_amount; 53 struct sfcp_trusted_subnet_node_t *nodes; 54 }; 55 56 #ifdef __cplusplus 57 } 58 #endif 59 60 #endif /* __SFCP_TRUSTED_SUBNET_H__ */ 61