xref: /optee_os/core/drivers/crypto/caam/acipher/local.h (revision 4b383f736e9e21019cca5b49fe9874148e7f6908)
1796ea6d8SCedric Neveux /* SPDX-License-Identifier: BSD-2-Clause */
2796ea6d8SCedric Neveux /*
38bdff4a4SClement Faure  * Copyright 2018-2021 NXP
4796ea6d8SCedric Neveux  *
5796ea6d8SCedric Neveux  * CAAM Cipher Local header.
6796ea6d8SCedric Neveux  */
7796ea6d8SCedric Neveux #ifndef __LOCAL_H__
8796ea6d8SCedric Neveux #define __LOCAL_H__
9796ea6d8SCedric Neveux 
10796ea6d8SCedric Neveux #include "caam_common.h"
11796ea6d8SCedric Neveux 
12796ea6d8SCedric Neveux /*
138bdff4a4SClement Faure  * Prime generator structure for RSA
14796ea6d8SCedric Neveux  */
158bdff4a4SClement Faure struct prime_data_rsa {
16796ea6d8SCedric Neveux 	uint8_t era;	   /* CAAM Era version */
17796ea6d8SCedric Neveux 	size_t key_size;   /* Key size in bits */
18796ea6d8SCedric Neveux 	struct caambuf *e; /* Key exponent e */
19796ea6d8SCedric Neveux 	struct caambuf *p; /* Prime p */
20796ea6d8SCedric Neveux 	struct caambuf *q; /* Prime q (can be NULL of only p asked) */
21796ea6d8SCedric Neveux };
22796ea6d8SCedric Neveux 
23796ea6d8SCedric Neveux /*
248bdff4a4SClement Faure  * Generate prime numbers for RSA
25796ea6d8SCedric Neveux  * Algorithm based on the Chapter B.3.3 of the FIPS.184-6 specification
26796ea6d8SCedric Neveux  *
27796ea6d8SCedric Neveux  * @data  [in/out] Prime generation data
28796ea6d8SCedric Neveux  */
298bdff4a4SClement Faure enum caam_status caam_prime_rsa_gen(struct prime_data_rsa *data);
30796ea6d8SCedric Neveux 
31*4b383f73SClement Faure /*
32*4b383f73SClement Faure  * Prime generator structure for DSA
33*4b383f73SClement Faure  */
34*4b383f73SClement Faure struct prime_data_dsa {
35*4b383f73SClement Faure 	struct caambuf *g; /* Generator g */
36*4b383f73SClement Faure 	struct caambuf *p; /* Prime p */
37*4b383f73SClement Faure 	struct caambuf *q; /* Prime q */
38*4b383f73SClement Faure };
39*4b383f73SClement Faure 
40*4b383f73SClement Faure /*
41*4b383f73SClement Faure  * Generate prime numbers for DSA
42*4b383f73SClement Faure  * Algorithm based on the Chapter A.1.2 of the FIPS.186-4 specification
43*4b383f73SClement Faure  *
44*4b383f73SClement Faure  * @data  [in/out] Prime generation data
45*4b383f73SClement Faure  */
46*4b383f73SClement Faure enum caam_status caam_prime_dsa_gen(struct prime_data_dsa *data);
47*4b383f73SClement Faure 
48796ea6d8SCedric Neveux #endif /* __LOCAL_H__ */
49