blob: c4501abd26b2c4b7ca2e1afe8318b7a6f650929c [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Ruchika Guptab9eebfa2014-10-15 11:35:30 +05302/*
3 * Copyright 2014 Freescale Semiconductor, Inc.
4 *
Ruchika Guptab9eebfa2014-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 Gupta34276472015-01-23 16:01:55 +053012#include "rsa_caam.h"
Ruchika Guptab9eebfa2014-10-15 11:35:30 +053013
Ruchika Guptac5de15c2014-10-07 15:46:20 +053014#define KEY_IDNFR_SZ_BYTES 16
15
Raul Cardenas02000202015-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 Guptab9eebfa2014-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 Guptac5de15c2014-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
Michael Wallec269a972020-06-27 22:58:51 +020042void inline_cnstr_jobdesc_rng_instantiation(u32 *desc, int handle, int do_sk);
Ruchika Gupta34276472015-01-23 16:01:55 +053043
Michael Walleb980f9e2020-06-27 22:58:52 +020044void inline_cnstr_jobdesc_rng_deinstantiation(u32 *desc, int handle);
45
Michael Walleea95f212020-06-27 22:58:53 +020046void inline_cnstr_jobdesc_rng(u32 *desc, void *data_out, u32 size);
47
Ruchika Gupta34276472015-01-23 16:01:55 +053048void inline_cnstr_jobdesc_pkha_rsaexp(uint32_t *desc,
49 struct pk_in_params *pkin, uint8_t *out,
50 uint32_t out_siz);
Michael Walleea95f212020-06-27 22:58:53 +020051
Ruchika Guptab9eebfa2014-10-15 11:35:30 +053052#endif