diff options
author | Tudor Ambarus <tudor-dan.ambarus@nxp.com> | 2016-07-04 06:12:08 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-07-05 11:05:24 -0400 |
commit | 8c419778ab57e497b5de1352aa39dbe2efb3ed54 (patch) | |
tree | b9977075029d6d46cc1ae2e743e7df9bde0bd1c3 /drivers/crypto/caam/pkc_desc.c | |
parent | 57763f5ec7488d5864e4d6ec9d4197b8f52214bd (diff) |
crypto: caam - add support for RSA algorithm
Add RSA support to caam driver.
Initial author is Yashpal Dutta <yashpal.dutta@freescale.com>.
Signed-off-by: Tudor Ambarus <tudor-dan.ambarus@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/caam/pkc_desc.c')
-rw-r--r-- | drivers/crypto/caam/pkc_desc.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/crypto/caam/pkc_desc.c b/drivers/crypto/caam/pkc_desc.c new file mode 100644 index 000000000000..4e4183e615ea --- /dev/null +++ b/drivers/crypto/caam/pkc_desc.c | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * caam - Freescale FSL CAAM support for Public Key Cryptography descriptors | ||
3 | * | ||
4 | * Copyright 2016 Freescale Semiconductor, Inc. | ||
5 | * | ||
6 | * There is no Shared Descriptor for PKC so that the Job Descriptor must carry | ||
7 | * all the desired key parameters, input and output pointers. | ||
8 | */ | ||
9 | #include "caampkc.h" | ||
10 | #include "desc_constr.h" | ||
11 | |||
12 | /* Descriptor for RSA Public operation */ | ||
13 | void init_rsa_pub_desc(u32 *desc, struct rsa_pub_pdb *pdb) | ||
14 | { | ||
15 | init_job_desc_pdb(desc, 0, sizeof(*pdb)); | ||
16 | append_cmd(desc, pdb->sgf); | ||
17 | append_ptr(desc, pdb->f_dma); | ||
18 | append_ptr(desc, pdb->g_dma); | ||
19 | append_ptr(desc, pdb->n_dma); | ||
20 | append_ptr(desc, pdb->e_dma); | ||
21 | append_cmd(desc, pdb->f_len); | ||
22 | append_operation(desc, OP_TYPE_UNI_PROTOCOL | OP_PCLID_RSAENC_PUBKEY); | ||
23 | } | ||
24 | |||
25 | /* Descriptor for RSA Private operation - Private Key Form #1 */ | ||
26 | void init_rsa_priv_f1_desc(u32 *desc, struct rsa_priv_f1_pdb *pdb) | ||
27 | { | ||
28 | init_job_desc_pdb(desc, 0, sizeof(*pdb)); | ||
29 | append_cmd(desc, pdb->sgf); | ||
30 | append_ptr(desc, pdb->g_dma); | ||
31 | append_ptr(desc, pdb->f_dma); | ||
32 | append_ptr(desc, pdb->n_dma); | ||
33 | append_ptr(desc, pdb->d_dma); | ||
34 | append_operation(desc, OP_TYPE_UNI_PROTOCOL | OP_PCLID_RSADEC_PRVKEY | | ||
35 | RSA_PRIV_KEY_FRM_1); | ||
36 | } | ||