Cryptography¶
API Reference¶
-
group
bt_crypto
Cryptography.
Functions
-
int
bt_rand
(void *buf, size_t len)¶ Generate random data.
A random number generation helper which utilizes the Bluetooth controller’s own RNG.
- Return
- Zero on success or error code otherwise, positive in case of protocol error or negative (POSIX) in case of stack internal error
- Parameters
buf
: Buffer to insert the random datalen
: Length of random data to generate
-
int
bt_encrypt_le
(const u8_t key[16], const u8_t plaintext[16], u8_t enc_data[16])¶ 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.
- Return
- Zero on success or error code otherwise.
- Parameters
key
: 128 bit LS byte first key for the encryption of the plaintextplaintext
: 128 bit LS byte first plaintext data block to be encryptedenc_data
: 128 bit LS byte first encrypted data block
-
int
bt_encrypt_be
(const u8_t key[16], const u8_t plaintext[16], u8_t enc_data[16])¶ 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.
- Return
- Zero on success or error code otherwise.
- Parameters
key
: 128 bit MS byte first key for the encryption of the plaintextplaintext
: 128 bit MS byte first plaintext data block to be encryptedenc_data
: 128 bit MS byte first encrypted data block
-
int