11bb92983SJerome Forissier /* SPDX-License-Identifier: BSD-2-Clause */ 2ffe04039SJerome Forissier /* 3ffe04039SJerome Forissier * Copyright (c) 2014, Linaro Limited 4ffe04039SJerome Forissier */ 5ffe04039SJerome Forissier 6fbe66cf8SEtienne Carriere #ifndef __TEE_TEE_CRYP_UTL_H 7fbe66cf8SEtienne Carriere #define __TEE_TEE_CRYP_UTL_H 8ffe04039SJerome Forissier 9ffe04039SJerome Forissier #include <tee_api_types.h> 106e954a6eSJens Wiklander #include <crypto/crypto.h> 11ffe04039SJerome Forissier 127c767434SAlbert Schwarzkopf TEE_Result tee_alg_get_digest_size(uint32_t algo, size_t *size); 13ffe04039SJerome Forissier TEE_Result tee_hash_createdigest(uint32_t algo, const uint8_t *data, 14ffe04039SJerome Forissier size_t datalen, uint8_t *digest, 15ffe04039SJerome Forissier size_t digestlen); 16ffe04039SJerome Forissier TEE_Result tee_cipher_get_block_size(uint32_t algo, size_t *size); 17ffe04039SJerome Forissier TEE_Result tee_do_cipher_update(void *ctx, uint32_t algo, 18ffe04039SJerome Forissier TEE_OperationMode mode, bool last_block, 19ffe04039SJerome Forissier const uint8_t *data, size_t len, uint8_t *dst); 20ffe04039SJerome Forissier 2125d6f46eSJens Wiklander /* 226e954a6eSJens Wiklander * plat_prng_add_jitter_entropy() - Adds jitter to RNG entropy pool 236e954a6eSJens Wiklander * @sid: source ID, normally unique per location of the call 246e954a6eSJens Wiklander * @pnum: pointer where the pool number for this @sid is stored 256e954a6eSJens Wiklander * 266e954a6eSJens Wiklander * Note that the supplied @sid controls (CRYPTO_RNG_SRC_IS_QUICK()) whether 276e954a6eSJens Wiklander * RPC is allowed to be performed or the event just will be queued for later 286e954a6eSJens Wiklander * consumption. 2925d6f46eSJens Wiklander */ 306e954a6eSJens Wiklander void plat_prng_add_jitter_entropy(enum crypto_rng_src sid, unsigned int *pnum); 316e954a6eSJens Wiklander 32*dcb51b21SThomas Bourgoin /* 33*dcb51b21SThomas Bourgoin * plat_rng_init() - Initialize RNG support. 34*dcb51b21SThomas Bourgoin * If not overridden with a platform implementation, the function defaults 35*dcb51b21SThomas Bourgoin * to __plat_rng_init() that implements a weak seeding of the RNG. 36*dcb51b21SThomas Bourgoin */ 376e954a6eSJens Wiklander void plat_rng_init(void); 38*dcb51b21SThomas Bourgoin void __plat_rng_init(void); 39ffe04039SJerome Forissier 40ffe04039SJerome Forissier #endif 41