Zephyr API Documentation 4.0.0-rc3
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
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#include <stdint.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
39int bt_rand(void *buf, size_t len);
40
53int bt_encrypt_le(const uint8_t key[16], const uint8_t plaintext[16],
54 uint8_t enc_data[16]);
55
68int bt_encrypt_be(const uint8_t key[16], const uint8_t plaintext[16],
69 uint8_t enc_data[16]);
70
71
92int bt_ccm_decrypt(const uint8_t key[16], uint8_t nonce[13], const uint8_t *enc_data,
93 size_t len, const uint8_t *aad, size_t aad_len,
94 uint8_t *plaintext, size_t mic_size);
95
96
116int bt_ccm_encrypt(const uint8_t key[16], uint8_t nonce[13],
117 const uint8_t *plaintext, size_t len, const uint8_t *aad,
118 size_t aad_len, uint8_t *enc_data, size_t mic_size);
119
120#ifdef __cplusplus
121}
122#endif
127#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.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88