blob: ad4690ae5068099dd8c7809caa6d33a00ef2f2ed [file] [log] [blame]
Nicolas Toromanoffdb13fac2020-09-30 17:36:45 +02001/*
2 * Copyright (c) 2022, STMicroelectronics - All Rights Reserved
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef STM32_PKA_H
8#define STM32_PKA_H
9
10#include <stdint.h>
11
12#if !PKA_USE_NIST_P256 && !PKA_USE_BRAINPOOL_P256R1 && !PKA_USE_BRAINPOOL_P256T1 && \
13 !PKA_USE_NIST_P521
14#error "At least one ECDSA curve needs to be selected"
15#endif
16
17enum stm32_pka_ecdsa_curve_id {
18#if PKA_USE_NIST_P256
19 PKA_NIST_P256,
20#endif
21#if PKA_USE_BRAINPOOL_P256R1
22 PKA_BRAINPOOL_P256R1,
23#endif
24#if PKA_USE_BRAINPOOL_P256T1
25 PKA_BRAINPOOL_P256T1,
26#endif
27#if PKA_USE_NIST_P521
28 PKA_NIST_P521,
29#endif
30};
31
32struct stm32_pka_platdata {
33 uintptr_t base;
34 unsigned long clock_id;
35 unsigned int reset_id;
36};
37
38int stm32_pka_init(void);
39int stm32_pka_ecdsa_verif(void *hash, unsigned int hash_size,
40 void *sig_r_ptr, unsigned int sig_r_size,
41 void *sig_s_ptr, unsigned int sig_s_size,
42 void *pk_x_ptr, unsigned int pk_x_size,
43 void *pk_y_ptr, unsigned int pk_y_size,
44 enum stm32_pka_ecdsa_curve_id cid);
45
46#endif /* STM32_PKA_H */