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