Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
crypto.h
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2017-2020 Nordic Semiconductor ASA
7 * Copyright (c) 2015-2017 Intel Corporation
8 *
9 * SPDX-License-Identifier: Apache-2.0
10 */
11#ifndef ZEPHYR_INCLUDE_BLUETOOTH_CRYPTO_H_
12#define ZEPHYR_INCLUDE_BLUETOOTH_CRYPTO_H_
13
21#include <stdbool.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
38int bt_rand(void *buf, size_t len);
39
52int bt_encrypt_le(const uint8_t key[16], const uint8_t plaintext[16],
53 uint8_t enc_data[16]);
54
67int bt_encrypt_be(const uint8_t key[16], const uint8_t plaintext[16],
68 uint8_t enc_data[16]);
69
70
91int bt_ccm_decrypt(const uint8_t key[16], uint8_t nonce[13], const uint8_t *enc_data,
92 size_t len, const uint8_t *aad, size_t aad_len,
93 uint8_t *plaintext, size_t mic_size);
94
95
115int bt_ccm_encrypt(const uint8_t key[16], uint8_t nonce[13],
116 const uint8_t *plaintext, size_t len, const uint8_t *aad,
117 size_t aad_len, uint8_t *enc_data, size_t mic_size);
118
119#ifdef __cplusplus
120}
121#endif
126#endif /* ZEPHYR_INCLUDE_BLUETOOTH_CRYPTO_H_ */
int bt_rand(void *buf, size_t len)
Generate random 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_encrypt_le(const uint8_t key[16], const uint8_t plaintext[16], uint8_t enc_data[16])
AES encrypt little-endian data.
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.
int bt_encrypt_be(const uint8_t key[16], const uint8_t plaintext[16], uint8_t enc_data[16])
AES encrypt big-endian data.
static k_spinlock_key_t key
Definition: spinlock_error_case.c:14
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58