blob: d782c46b9db0a3c9049e5694e26beda22b114775 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Ruchika Guptaac1b2692014-10-15 11:35:30 +05302/*
3 * Copyright 2014 Freescale Semiconductor, Inc.
4 *
Ruchika Guptaac1b2692014-10-15 11:35:30 +05305 */
6
7#ifndef __JOBDESC_H
8#define __JOBDESC_H
9
10#include <common.h>
11#include <asm/io.h>
Ruchika Gupta29c1a6b2015-01-23 16:01:55 +053012#include "rsa_caam.h"
Ruchika Guptaac1b2692014-10-15 11:35:30 +053013
Ruchika Gupta4345a572014-10-07 15:46:20 +053014#define KEY_IDNFR_SZ_BYTES 16
15
Raul Cardenasb5a36d82015-02-27 11:22:06 -060016#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 */
26int 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
Ruchika Guptaac1b2692014-10-15 11:35:30 +053030void 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
Ruchika Gupta4345a572014-10-07 15:46:20 +053034void 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
38void 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
Lukas Aueraed8eac2018-01-25 14:11:17 +010042void inline_cnstr_jobdesc_rng_instantiation(uint32_t *desc, int handle);
Ruchika Gupta29c1a6b2015-01-23 16:01:55 +053043
44void inline_cnstr_jobdesc_pkha_rsaexp(uint32_t *desc,
45 struct pk_in_params *pkin, uint8_t *out,
46 uint32_t out_siz);
Ruchika Guptaac1b2692014-10-15 11:35:30 +053047#endif