Loading...
Searching...
No Matches
ieee802154_security.h File Reference

IEEE 802.15.4 security interface. More...

Detailed Description

#include <stdint.h>
#include "ieee802154.h"
#include "crypto/ciphers.h"
+ Include dependency graph for ieee802154_security.h:

Go to the source code of this file.

Data Structures

struct  ieee802154_radio_cipher_ops
 Struct of security operations. More...
 
struct  ieee802154_sec_dev
 IEEE 802.15.4 security device descriptor. More...
 
struct  ieee802154_sec_context
 Struct to hold IEEE 802.15.4 security information. More...
 
struct  ieee802154_sec_aux_t
 IEEE 802.15.4 auxiliary security header. More...
 
struct  ieee802154_sec_aux_key_identifier_1_t
 Content of key_source if key mode is IEEE802154_SEC_SCF_KEYMODE_INDEX. More...
 
struct  ieee802154_sec_aux_key_identifier_5_t
 Content of key_source if key mode is IEEE802154_SEC_SCF_KEYMODE_SHORT_INDEX. More...
 
struct  ieee802154_sec_aux_key_identifier_9_t
 Content of key_source if key mode is IEEE802154_SEC_SCF_KEYMODE_HW_INDEX. More...
 
struct  ieee802154_sec_ccm_nonce_t
 Format of 13 byte nonce. More...
 
struct  ieee802154_sec_ccm_block_t
 Format of 16 byte input block of CCM. More...
 

Macros

#define CONFIG_IEEE802154_SEC_DEFAULT_KEY   "pizza_margherita"
 AES default key.
 
#define IEEE802154_SEC_KEY_LENGTH   (16U)
 Length of an AES key in bytes.
 
#define IEEE802154_SEC_BLOCK_SIZE   (16U)
 Block size of an encryption block.
 
#define IEEE802154_SEC_MAX_AUX_HDR_LEN   (14U)
 Maximum length of the security auxiliary header in bytes.
 
#define IEEE802154_SEC_MAX_MAC_SIZE   (16U)
 Maximum Size of IEEE 802.15.4 MAC.
 
#define IEEE802154_SEC_SCF_SECLEVEL_MASK   (0x07)
 Mask to get security level bits.
 
#define IEEE802154_SEC_SCF_SECLEVEL_SHIFT   (0)
 Number of shifts to set/get security level bits.
 
#define IEEE802154_SEC_SCF_KEYMODE_MASK   (0x18)
 Mask to get key mode bits.
 
#define IEEE802154_SEC_SCF_KEYMODE_SHIFT   (3)
 Number of shifts to set/get key mode bits.
 

Typedefs

typedef struct ieee802154_sec_dev ieee802154_sec_dev_t
 Forward declaration of an IEEE 802.15.4 abstract security device.
 
typedef struct ieee802154_radio_cipher_ops ieee802154_radio_cipher_ops_t
 Struct of security operations.
 
typedef struct ieee802154_sec_context ieee802154_sec_context_t
 Struct to hold IEEE 802.15.4 security information.
 

Enumerations

enum  ieee802154_sec_scf_seclevel_t {
  IEEE802154_SEC_SCF_SECLEVEL_NONE = 0x00 , IEEE802154_SEC_SCF_SECLEVEL_MIC32 = 0x01 , IEEE802154_SEC_SCF_SECLEVEL_MIC64 = 0x02 , IEEE802154_SEC_SCF_SECLEVEL_MIC128 = 0x03 ,
  IEEE802154_SEC_SCF_SECLEVEL_ENC = 0x04 , IEEE802154_SEC_SCF_SECLEVEL_ENC_MIC32 = 0x05 , IEEE802154_SEC_SCF_SECLEVEL_ENC_MIC64 = 0x06 , IEEE802154_SEC_SCF_SECLEVEL_ENC_MIC128 = 0x07
}
 Security levels. More...
 
enum  ieee802154_sec_scf_keymode_t { IEEE802154_SEC_SCF_KEYMODE_IMPLICIT = 0x00 , IEEE802154_SEC_SCF_KEYMODE_INDEX = 0x01 , IEEE802154_SEC_SCF_KEYMODE_SHORT_INDEX = 0x02 , IEEE802154_SEC_SCF_KEYMODE_HW_INDEX = 0x03 }
 Key identifier modes. More...
 
enum  ieee802154_sec_error_t {
  IEEE802154_SEC_OK , IEEE802154_SEC_FRAME_COUNTER_OVERFLOW , IEEE802154_SEC_NO_KEY , IEEE802154_SEC_MAC_CHECK_FAILURE ,
  IEEE802154_SEC_UNSUPORTED
}
 IEEE 802.15.4 security error codes. More...
 

Functions

void ieee802154_sec_init (ieee802154_sec_context_t *ctx)
 Initialize IEEE 802.15.4 security context with default values.
 
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.
 
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.
 

Variables

const ieee802154_radio_cipher_ops_t ieee802154_radio_cipher_ops
 Default descriptor that will fallback to default implementations.