xref: /optee_os/core/include/tee/tee_cryp_utl.h (revision dcb51b2126c99b8b8cc5272875149ccadba67d3c)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2014, Linaro Limited
4  */
5 
6 #ifndef __TEE_TEE_CRYP_UTL_H
7 #define __TEE_TEE_CRYP_UTL_H
8 
9 #include <tee_api_types.h>
10 #include <crypto/crypto.h>
11 
12 TEE_Result tee_alg_get_digest_size(uint32_t algo, size_t *size);
13 TEE_Result tee_hash_createdigest(uint32_t algo, const uint8_t *data,
14 				 size_t datalen, uint8_t *digest,
15 				 size_t digestlen);
16 TEE_Result tee_cipher_get_block_size(uint32_t algo, size_t *size);
17 TEE_Result tee_do_cipher_update(void *ctx, uint32_t algo,
18 				TEE_OperationMode mode, bool last_block,
19 				const uint8_t *data, size_t len, uint8_t *dst);
20 
21 /*
22  * plat_prng_add_jitter_entropy() - Adds jitter to RNG entropy pool
23  * @sid:	source ID, normally unique per location of the call
24  * @pnum:	pointer where the pool number for this @sid is stored
25  *
26  * Note that the supplied @sid controls (CRYPTO_RNG_SRC_IS_QUICK()) whether
27  * RPC is allowed to be performed or the event just will be queued for later
28  * consumption.
29  */
30 void plat_prng_add_jitter_entropy(enum crypto_rng_src sid, unsigned int *pnum);
31 
32 /*
33  * plat_rng_init() - Initialize RNG support.
34  * If not overridden with a platform implementation, the function defaults
35  * to __plat_rng_init() that implements a weak seeding of the RNG.
36  */
37 void plat_rng_init(void);
38 void __plat_rng_init(void);
39 
40 #endif
41