30 #ifndef MBED_LORAWAN_MAC_LORAMAC_CRYPTO_H__ 31 #define MBED_LORAWAN_MAC_LORAMAC_CRYPTO_H__ 33 #include "mbedtls/aes.h" 34 #include "mbedtls/cmac.h" 63 int compute_mic(
const uint8_t *buffer, uint16_t size,
64 const uint8_t *key, uint32_t key_length,
65 uint32_t address, uint8_t dir, uint32_t seq_counter,
83 const uint8_t *key, uint32_t key_length,
84 uint32_t address, uint8_t dir, uint32_t seq_counter,
102 const uint8_t *key, uint32_t key_length,
103 uint32_t address, uint8_t dir, uint32_t seq_counter,
104 uint8_t *dec_buffer);
119 const uint8_t *key, uint32_t key_length,
134 const uint8_t *key, uint32_t key_length,
135 uint8_t *dec_buffer);
150 const uint8_t *app_nonce, uint16_t dev_nonce,
151 uint8_t *nwk_skey, uint8_t *app_skey);
157 mbedtls_aes_context aes_ctx;
162 mbedtls_cipher_context_t aes_cmac_ctx[1];
165 #endif // MBED_LORAWAN_MAC_LORAMAC_CRYPTO_H__ int compute_mic(const uint8_t *buffer, uint16_t size, const uint8_t *key, uint32_t key_length, uint32_t address, uint8_t dir, uint32_t seq_counter, uint32_t *mic)
Computes the LoRaMAC frame MIC field.
int decrypt_join_frame(const uint8_t *buffer, uint16_t size, const uint8_t *key, uint32_t key_length, uint8_t *dec_buffer)
Computes the LoRaMAC join frame decryption.
int compute_join_frame_mic(const uint8_t *buffer, uint16_t size, const uint8_t *key, uint32_t key_length, uint32_t *mic)
Computes the LoRaMAC Join Request frame MIC field.
int encrypt_payload(const uint8_t *buffer, uint16_t size, const uint8_t *key, uint32_t key_length, uint32_t address, uint8_t dir, uint32_t seq_counter, uint8_t *enc_buffer)
Performs payload encryption.
int compute_skeys_for_join_frame(const uint8_t *key, uint32_t key_length, const uint8_t *app_nonce, uint16_t dev_nonce, uint8_t *nwk_skey, uint8_t *app_skey)
Computes the LoRaMAC join frame decryption.
int decrypt_payload(const uint8_t *buffer, uint16_t size, const uint8_t *key, uint32_t key_length, uint32_t address, uint8_t dir, uint32_t seq_counter, uint8_t *dec_buffer)
Performs payload decryption.
LoRaMacCrypto()
Constructor.
~LoRaMacCrypto()
Destructor.