Zephyr API Documentation
3.6.99
A Scalable Open Source RTOS
|
Cryptography. More...
Functions | |
int | bt_rand (void *buf, size_t len) |
Generate random data. | |
int | bt_encrypt_le (const uint8_t key[16], const uint8_t plaintext[16], uint8_t enc_data[16]) |
AES encrypt little-endian data. | |
int | bt_encrypt_be (const uint8_t key[16], const uint8_t plaintext[16], uint8_t enc_data[16]) |
AES encrypt big-endian data. | |
int | bt_ccm_decrypt (const uint8_t key[16], uint8_t nonce[13], const uint8_t *enc_data, size_t len, const uint8_t *aad, size_t aad_len, uint8_t *plaintext, size_t mic_size) |
Decrypt big-endian data with AES-CCM. | |
int | bt_ccm_encrypt (const uint8_t key[16], uint8_t nonce[13], const uint8_t *plaintext, size_t len, const uint8_t *aad, size_t aad_len, uint8_t *enc_data, size_t mic_size) |
Encrypt big-endian data with AES-CCM. | |
Cryptography.
int bt_ccm_decrypt | ( | const uint8_t | key[16], |
uint8_t | nonce[13], | ||
const uint8_t * | enc_data, | ||
size_t | len, | ||
const uint8_t * | aad, | ||
size_t | aad_len, | ||
uint8_t * | plaintext, | ||
size_t | mic_size | ||
) |
#include <zephyr/bluetooth/crypto.h>
Decrypt big-endian data with AES-CCM.
Decrypts and authorizes enc_data
with AES-CCM, as described in https://tools.ietf.org/html/rfc3610.
Assumes that the MIC follows directly after the encrypted data.
key | 128 bit MS byte first key |
nonce | 13 byte MS byte first nonce |
enc_data | Encrypted data |
len | Length of the encrypted data |
aad | Additional authenticated data |
aad_len | Additional authenticated data length |
plaintext | Plaintext buffer to place result in |
mic_size | Size of the trailing MIC (in bytes) |
0 | Successfully decrypted the data. |
-EINVAL | Invalid parameters. |
-EBADMSG | Authentication failed. |
int bt_ccm_encrypt | ( | const uint8_t | key[16], |
uint8_t | nonce[13], | ||
const uint8_t * | plaintext, | ||
size_t | len, | ||
const uint8_t * | aad, | ||
size_t | aad_len, | ||
uint8_t * | enc_data, | ||
size_t | mic_size | ||
) |
#include <zephyr/bluetooth/crypto.h>
Encrypt big-endian data with AES-CCM.
Encrypts and generates a MIC from plaintext
with AES-CCM, as described in https://tools.ietf.org/html/rfc3610.
Places the MIC directly after the encrypted data.
key | 128 bit MS byte first key |
nonce | 13 byte MS byte first nonce |
plaintext | Plaintext buffer to encrypt |
len | Length of the encrypted data |
aad | Additional authenticated data |
aad_len | Additional authenticated data length |
enc_data | Buffer to place encrypted data in |
mic_size | Size of the trailing MIC (in bytes) |
0 | Successfully encrypted the data. |
-EINVAL | Invalid parameters. |
#include <zephyr/bluetooth/crypto.h>
AES encrypt big-endian data.
An AES encrypt helper is used to request the Bluetooth controller's own hardware to encrypt the plaintext using the key and returns the encrypted data.
key | 128 bit MS byte first key for the encryption of the plaintext |
plaintext | 128 bit MS byte first plaintext data block to be encrypted |
enc_data | 128 bit MS byte first encrypted data block |
#include <zephyr/bluetooth/crypto.h>
AES encrypt little-endian data.
An AES encrypt helper is used to request the Bluetooth controller's own hardware to encrypt the plaintext using the key and returns the encrypted data.
key | 128 bit LS byte first key for the encryption of the plaintext |
plaintext | 128 bit LS byte first plaintext data block to be encrypted |
enc_data | 128 bit LS byte first encrypted data block |
int bt_rand | ( | void * | buf, |
size_t | len | ||
) |
#include <zephyr/bluetooth/crypto.h>
Generate random data.
A random number generation helper which utilizes the Bluetooth controller's own RNG.
buf | Buffer to insert the random data |
len | Length of random data to generate |