xref: /optee_os/core/include/tee/tee_cryp_utl.h (revision b8bb0afa738e6038bbd92b57742aa2526df9f20a)
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 TEE_Result tee_aes_cbc_cts_update(void *cbc_ctx, void *ecb_ctx,
22 				  TEE_OperationMode mode, bool last_block,
23 				  const uint8_t *data, size_t len,
24 				  uint8_t *dst);
25 
26 /*
27  * plat_prng_add_jitter_entropy() - Adds jitter to RNG entropy pool
28  * @sid:	source ID, normally unique per location of the call
29  * @pnum:	pointer where the pool number for this @sid is stored
30  *
31  * Note that the supplied @sid controls (CRYPTO_RNG_SRC_IS_QUICK()) whether
32  * RPC is allowed to be performed or the event just will be queued for later
33  * consumption.
34  */
35 void plat_prng_add_jitter_entropy(enum crypto_rng_src sid, unsigned int *pnum);
36 
37 void plat_rng_init(void);
38 
39 #endif
40