xref: /openbmc/u-boot/drivers/crypto/fsl/jobdesc.h (revision fd0bc623)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright 2014 Freescale Semiconductor, Inc.
4  *
5  */
6 
7 #ifndef __JOBDESC_H
8 #define __JOBDESC_H
9 
10 #include <common.h>
11 #include <asm/io.h>
12 #include "rsa_caam.h"
13 
14 #define KEY_IDNFR_SZ_BYTES		16
15 
16 #ifdef CONFIG_CMD_DEKBLOB
17 /* inline_cnstr_jobdesc_blob_dek:
18  * Intializes and constructs the job descriptor for DEK encapsulation
19  * using the given parameters.
20  * @desc: reference to the job descriptor
21  * @plain_txt: reference to the DEK
22  * @enc_blob: reference where to store the blob
23  * @in_sz: size in bytes of the DEK
24  * @return: 0 on success, ECONSTRJDESC otherwise
25  */
26 int inline_cnstr_jobdesc_blob_dek(uint32_t *desc, const uint8_t *plain_txt,
27 				uint8_t *enc_blob, uint32_t in_sz);
28 #endif
29 
30 void inline_cnstr_jobdesc_hash(uint32_t *desc,
31 			  const uint8_t *msg, uint32_t msgsz, uint8_t *digest,
32 			  u32 alg_type, uint32_t alg_size, int sg_tbl);
33 
34 void inline_cnstr_jobdesc_blob_encap(uint32_t *desc, uint8_t *key_idnfr,
35 				     uint8_t *plain_txt, uint8_t *enc_blob,
36 				     uint32_t in_sz);
37 
38 void inline_cnstr_jobdesc_blob_decap(uint32_t *desc, uint8_t *key_idnfr,
39 				     uint8_t *enc_blob, uint8_t *plain_txt,
40 				     uint32_t out_sz);
41 
42 void inline_cnstr_jobdesc_rng_instantiation(uint32_t *desc, int handle);
43 
44 void inline_cnstr_jobdesc_pkha_rsaexp(uint32_t *desc,
45 				      struct pk_in_params *pkin, uint8_t *out,
46 				      uint32_t out_siz);
47 #endif
48