xref: /optee_os/core/include/tee/tee_cryp_utl.h (revision df24e6517b6454cf906c16979ea0e7546c5c99d5)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2014, Linaro Limited
4  */
5 
6 #ifndef TEE_CRYP_UTL_H
7 #define TEE_CRYP_UTL_H
8 
9 #include <tee_api_types.h>
10 #include <crypto/crypto.h>
11 
12 TEE_Result tee_hash_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_mac_get_digest_size(uint32_t algo, size_t *size);
17 TEE_Result tee_cipher_get_block_size(uint32_t algo, size_t *size);
18 TEE_Result tee_do_cipher_update(void *ctx, uint32_t algo,
19 				TEE_OperationMode mode, bool last_block,
20 				const uint8_t *data, size_t len, uint8_t *dst);
21 
22 /*
23  * plat_prng_add_jitter_entropy() - Adds jitter to RNG entropy pool
24  * @sid:	source ID, normally unique per location of the call
25  * @pnum:	pointer where the pool number for this @sid is stored
26  *
27  * Note that the supplied @sid controls (CRYPTO_RNG_SRC_IS_QUICK()) whether
28  * RPC is allowed to be performed or the event just will be queued for later
29  * consumption.
30  */
31 void plat_prng_add_jitter_entropy(enum crypto_rng_src sid, unsigned int *pnum);
32 
33 void plat_rng_init(void);
34 
35 #endif
36