30 #ifndef MBED_LORAWAN_MAC_LORAMAC_CRYPTO_H__ 31 #define MBED_LORAWAN_MAC_LORAMAC_CRYPTO_H__ 33 #include "mbedtls/config.h" 34 #include "mbedtls/aes.h" 35 #include "mbedtls/cmac.h" 64 int compute_mic(
const uint8_t *buffer, uint16_t size,
65 const uint8_t *key, uint32_t key_length,
66 uint32_t address, uint8_t dir, uint32_t seq_counter,
84 const uint8_t *key, uint32_t key_length,
85 uint32_t address, uint8_t dir, uint32_t seq_counter,
103 const uint8_t *key, uint32_t key_length,
104 uint32_t address, uint8_t dir, uint32_t seq_counter,
105 uint8_t *dec_buffer);
120 const uint8_t *key, uint32_t key_length,
135 const uint8_t *key, uint32_t key_length,
136 uint8_t *dec_buffer);
151 const uint8_t *app_nonce, uint16_t dev_nonce,
152 uint8_t *nwk_skey, uint8_t *app_skey);
158 mbedtls_aes_context aes_ctx;
163 mbedtls_cipher_context_t aes_cmac_ctx[1];
166 #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.