forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
crypto_stm32_priv.h
39 lines (30 loc) · 957 Bytes
/
crypto_stm32_priv.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
* Copyright (c) 2020 Markus Fuchs <[email protected]>
*
* SPDX-License-Identifier: Apache-2.0
*
*/
#ifndef ZEPHYR_DRIVERS_CRYPTO_CRYPTO_STM32_PRIV_H_
#define ZEPHYR_DRIVERS_CRYPTO_CRYPTO_STM32_PRIV_H_
/* Maximum supported key length is 256 bits */
#define CRYPTO_STM32_AES_MAX_KEY_LEN (256 / 8)
struct crypto_stm32_config {
struct stm32_pclken pclken;
};
struct crypto_stm32_data {
CRYP_HandleTypeDef hcryp;
struct k_sem device_sem;
struct k_sem session_sem;
};
struct crypto_stm32_session {
CRYP_ConfigTypeDef config;
uint32_t key[CRYPTO_STM32_AES_MAX_KEY_LEN / sizeof(uint32_t)];
bool in_use;
};
#define CRYPTO_STM32_CFG(dev) \
((const struct crypto_stm32_config *const)(dev)->config)
#define CRYPTO_STM32_DATA(dev) \
((struct crypto_stm32_data *const)(dev)->data)
#define CRYPTO_STM32_SESSN(ctx) \
((struct crypto_stm32_session *const)(ctx)->drv_sessn_state)
#endif /* ZEPHYR_DRIVERS_CRYPTO_CRYPTO_STM32_PRIV_H_ */