xref: /optee_os/core/include/drivers/caam_extension.h (revision fbe66cf83199aa6a2aca9f93384cf1ad9185a5f6)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright 2023 NXP
4  */
5 #ifndef __DRIVERS_CAAM_EXTENSION_H__
6 #define __DRIVERS_CAAM_EXTENSION_H__
7 
8 #include <tee_api_defines.h>
9 #include <tee_api_types.h>
10 #include <types_ext.h>
11 
12 #ifdef CFG_NXP_CAAM_MP_DRV
13 /*
14  * Export the MPMR content.
15  * We assume that it is filled with message given in parameter.
16  * It contains 32 registers of 8 bits (32 bytes).
17  *
18  * @mpmr  [out] MPMR buffer read
19  * @size  [in/out] MPMR buffer size exported
20  */
21 TEE_Result caam_mp_export_mpmr(uint8_t *mpmr, size_t *size);
22 
23 /*
24  * Export the Manufacturing Protection Public Key.
25  *
26  * @pubkey [out] Public key read
27  * @size   [in/out] Public key size exported
28  */
29 TEE_Result caam_mp_export_publickey(uint8_t *pubkey, size_t *size);
30 
31 /*
32  * MPSign function.
33  * This function takes the value in the MPMR if it exists
34  * and concatenates any additional data (certificate).
35  * The signature over the message is done with the private key.
36  *
37  * @data	[in] Data to sign
38  * @data_size	[in] Data size to sign
39  * @sig		[out] Signature
40  * @sig_size	[in/out] Signature size
41  */
42 TEE_Result caam_mp_sign(uint8_t *data, size_t *data_size, uint8_t *sig,
43 			size_t *sig_size);
44 #endif /* CFG_NXP_CAAM_MP_DRV */
45 
46 #ifdef CFG_NXP_CAAM_DEK_DRV
47 /*
48  * Data encryption key generation using CAAM Secure Memory.
49  *
50  * @blob_data  [in/out] Blob data
51  */
52 TEE_Result caam_dek_generate(const uint8_t *payload, size_t payload_size,
53 			     uint8_t *dek, size_t dek_size);
54 #endif /* CFG_NXP_CAAM_DEK_DRV */
55 #endif /* __DRIVERS_CAAM_EXTENSION_H__ */
56