108 #if !defined(CONFIG_IEEE802154_SEC_DEFAULT_KEY) || defined(DOXYGEN) 
  115 #define CONFIG_IEEE802154_SEC_DEFAULT_KEY       "pizza_margherita" 
  121 #define IEEE802154_SEC_KEY_LENGTH               (16U) 
  126 #define IEEE802154_SEC_BLOCK_SIZE               (16U) 
  131 #define IEEE802154_SEC_MAX_AUX_HDR_LEN          (14U) 
  136 #define IEEE802154_SEC_MAX_MAC_SIZE             (16U) 
  141 #define IEEE802154_SEC_SCF_SECLEVEL_MASK        (0x07) 
  146 #define IEEE802154_SEC_SCF_SECLEVEL_SHIFT       (0) 
  151 #define IEEE802154_SEC_SCF_KEYMODE_MASK         (0x18) 
  156 #define IEEE802154_SEC_SCF_KEYMODE_SHIFT        (3) 
  273 typedef struct __attribute__((packed)) {
 
  305 typedef struct __attribute__((packed)) {
 
  315 typedef struct __attribute__((packed)) {
 
  319     uint8_t key_source[4];
 
  329 typedef struct __attribute__((packed)) {
 
  343 typedef struct __attribute__((packed)) {
 
  361 typedef struct __attribute__((packed)) {
 
  402                                  const uint8_t *header, uint8_t *header_size,
 
  403                                  uint8_t *payload, uint16_t payload_size,
 
  404                                  uint8_t *mic, uint8_t *mic_size,
 
  405                                  const uint8_t *src_address);
 
  427                                  uint8_t *header, uint8_t *header_size,
 
  428                                  uint8_t **payload, uint16_t *payload_size,
 
  429                                  uint8_t **mic, uint8_t *mic_size,
 
  430                                  const uint8_t *src_address);
 
Headers for the packet encryption class.
 
int ieee802154_sec_encrypt_frame(ieee802154_sec_context_t *ctx, const uint8_t *header, uint8_t *header_size, uint8_t *payload, uint16_t payload_size, uint8_t *mic, uint8_t *mic_size, const uint8_t *src_address)
Encrypt IEEE 802.15.4 frame according to ctx.
 
ieee802154_sec_scf_seclevel_t
Security levels.
 
ieee802154_sec_error_t
IEEE 802.15.4 security error codes.
 
ieee802154_sec_scf_keymode_t
Key identifier modes.
 
struct ieee802154_radio_cipher_ops ieee802154_radio_cipher_ops_t
Struct of security operations.
 
const ieee802154_radio_cipher_ops_t ieee802154_radio_cipher_ops
Default descriptor that will fallback to default implementations.
 
void ieee802154_sec_init(ieee802154_sec_context_t *ctx)
Initialize IEEE 802.15.4 security context with default values.
 
int ieee802154_sec_decrypt_frame(ieee802154_sec_context_t *ctx, uint16_t frame_size, uint8_t *header, uint8_t *header_size, uint8_t **payload, uint16_t *payload_size, uint8_t **mic, uint8_t *mic_size, const uint8_t *src_address)
Decrypt IEEE 802.15.4 frame according to ctx.
 
struct ieee802154_sec_context ieee802154_sec_context_t
Struct to hold IEEE 802.15.4 security information.
 
@ IEEE802154_SEC_SCF_SECLEVEL_MIC32
32 bit MIC
 
@ IEEE802154_SEC_SCF_SECLEVEL_ENC_MIC32
enc.
 
@ IEEE802154_SEC_SCF_SECLEVEL_MIC128
128 bit MIC
 
@ IEEE802154_SEC_SCF_SECLEVEL_MIC64
64 bit MIC
 
@ IEEE802154_SEC_SCF_SECLEVEL_ENC_MIC64
enc.
 
@ IEEE802154_SEC_SCF_SECLEVEL_ENC_MIC128
enc.
 
@ IEEE802154_SEC_SCF_SECLEVEL_NONE
no security
 
@ IEEE802154_SEC_SCF_SECLEVEL_ENC
encryption
 
@ IEEE802154_SEC_OK
Everything went fine.
 
@ IEEE802154_SEC_UNSUPORTED
Unsupported operation.
 
@ IEEE802154_SEC_MAC_CHECK_FAILURE
The computet MAC did not match.
 
@ IEEE802154_SEC_FRAME_COUNTER_OVERFLOW
The requested operation would let the frame counter overflow.
 
@ IEEE802154_SEC_NO_KEY
Could not find the key to perform a requested cipher operation.
 
@ IEEE802154_SEC_SCF_KEYMODE_IMPLICIT
Key is determined implicitly.
 
@ IEEE802154_SEC_SCF_KEYMODE_INDEX
Key is determined from key index.
 
@ IEEE802154_SEC_SCF_KEYMODE_SHORT_INDEX
Key is determined from 4 byte key source and key index.
 
@ IEEE802154_SEC_SCF_KEYMODE_HW_INDEX
Key is determined from 8 byte key source and key index.
 
basic struct for using block ciphers contains the cipher interface and the context
 
Struct of security operations.
 
void(* ecb)(const ieee802154_sec_dev_t *dev, uint8_t *cipher, const uint8_t *plain, uint8_t nblocks)
Function type to perform ECB encryption.
 
void(* cbc)(const ieee802154_sec_dev_t *dev, uint8_t *cipher, uint8_t *iv, const uint8_t *plain, uint8_t nblocks)
Function type to compute CBC-MAC.
 
void(* set_key)(ieee802154_sec_dev_t *dev, const uint8_t *key, uint8_t key_size)
Function to set the encryption key for the next cipher operation.
 
Content of key_source if key mode is IEEE802154_SEC_SCF_KEYMODE_INDEX.
 
uint8_t key_index
Key index of key from originator, defined by key source.
 
Content of key_source if key mode is IEEE802154_SEC_SCF_KEYMODE_SHORT_INDEX.
 
uint8_t key_index
Key index of key from originator, defined by key source.
 
Content of key_source if key mode is IEEE802154_SEC_SCF_KEYMODE_HW_INDEX.
 
uint8_t key_index
Key index of key from originator, defined by key source.
 
IEEE 802.15.4 auxiliary security header.
 
uint8_t scf
Security Control field (SCF)
 
Format of 16 byte input block of CCM.
 
uint8_t flags
Flags field.
 
ieee802154_sec_ccm_nonce_t nonce
Nonce (Number that is only used once)
 
uint16_t counter
Either the length of the actual message (for CBC-MAC) or a block counter (for CTR)
 
uint32_t frame_counter
Frame counter.
 
uint8_t security_level
One of IEEE802154_SEC_SCF_SECLEVEL_*.
 
Struct to hold IEEE 802.15.4 security information.
 
uint8_t key_index
Key index.
 
ieee802154_sec_dev_t dev
802.15.4 security dev
 
uint8_t key_id_mode
Key mode IEEE802154_SEC_SCF_KEYMODE_*.
 
uint32_t frame_counter
Own frame counter.
 
cipher_t cipher
Cipher context with AES128 interface and key storage.
 
uint8_t key_source[IEEE802154_LONG_ADDRESS_LEN]
Key source.
 
uint8_t security_level
Security level IEEE802154_SEC_SCF_SECLEVEL_*.
 
IEEE 802.15.4 security device descriptor.
 
const struct ieee802154_radio_cipher_ops * cipher_ops
Pointer to the operations of the device.
 
void * ctx
Pointer to the context of the device.
 
IEEE 802.15.4 header definitions.