1 // SPDX-License-Identifier: GPL-2.0
3 * caam - Freescale FSL CAAM support for Public Key Cryptography descriptors
5 * Copyright 2016 Freescale Semiconductor, Inc.
7 * There is no Shared Descriptor for PKC so that the Job Descriptor must carry
8 * all the desired key parameters, input and output pointers.
11 #include "desc_constr.h"
13 /* Descriptor for RSA Public operation */
14 void init_rsa_pub_desc(u32
*desc
, struct rsa_pub_pdb
*pdb
)
16 init_job_desc_pdb(desc
, 0, sizeof(*pdb
));
17 append_cmd(desc
, pdb
->sgf
);
18 append_ptr(desc
, pdb
->f_dma
);
19 append_ptr(desc
, pdb
->g_dma
);
20 append_ptr(desc
, pdb
->n_dma
);
21 append_ptr(desc
, pdb
->e_dma
);
22 append_cmd(desc
, pdb
->f_len
);
23 append_operation(desc
, OP_TYPE_UNI_PROTOCOL
| OP_PCLID_RSAENC_PUBKEY
);
26 /* Descriptor for RSA Private operation - Private Key Form #1 */
27 void init_rsa_priv_f1_desc(u32
*desc
, struct rsa_priv_f1_pdb
*pdb
)
29 init_job_desc_pdb(desc
, 0, sizeof(*pdb
));
30 append_cmd(desc
, pdb
->sgf
);
31 append_ptr(desc
, pdb
->g_dma
);
32 append_ptr(desc
, pdb
->f_dma
);
33 append_ptr(desc
, pdb
->n_dma
);
34 append_ptr(desc
, pdb
->d_dma
);
35 append_operation(desc
, OP_TYPE_UNI_PROTOCOL
| OP_PCLID_RSADEC_PRVKEY
|
39 /* Descriptor for RSA Private operation - Private Key Form #2 */
40 void init_rsa_priv_f2_desc(u32
*desc
, struct rsa_priv_f2_pdb
*pdb
)
42 init_job_desc_pdb(desc
, 0, sizeof(*pdb
));
43 append_cmd(desc
, pdb
->sgf
);
44 append_ptr(desc
, pdb
->g_dma
);
45 append_ptr(desc
, pdb
->f_dma
);
46 append_ptr(desc
, pdb
->d_dma
);
47 append_ptr(desc
, pdb
->p_dma
);
48 append_ptr(desc
, pdb
->q_dma
);
49 append_ptr(desc
, pdb
->tmp1_dma
);
50 append_ptr(desc
, pdb
->tmp2_dma
);
51 append_cmd(desc
, pdb
->p_q_len
);
52 append_operation(desc
, OP_TYPE_UNI_PROTOCOL
| OP_PCLID_RSADEC_PRVKEY
|
56 /* Descriptor for RSA Private operation - Private Key Form #3 */
57 void init_rsa_priv_f3_desc(u32
*desc
, struct rsa_priv_f3_pdb
*pdb
)
59 init_job_desc_pdb(desc
, 0, sizeof(*pdb
));
60 append_cmd(desc
, pdb
->sgf
);
61 append_ptr(desc
, pdb
->g_dma
);
62 append_ptr(desc
, pdb
->f_dma
);
63 append_ptr(desc
, pdb
->c_dma
);
64 append_ptr(desc
, pdb
->p_dma
);
65 append_ptr(desc
, pdb
->q_dma
);
66 append_ptr(desc
, pdb
->dp_dma
);
67 append_ptr(desc
, pdb
->dq_dma
);
68 append_ptr(desc
, pdb
->tmp1_dma
);
69 append_ptr(desc
, pdb
->tmp2_dma
);
70 append_cmd(desc
, pdb
->p_q_len
);
71 append_operation(desc
, OP_TYPE_UNI_PROTOCOL
| OP_PCLID_RSADEC_PRVKEY
|