1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright 2018-2020 NXP
4  *
5  * Brief   Hash interface calling the HW crypto driver.
6  */
7 #ifndef __DRVCRYPT_HASH_H__
8 #define __DRVCRYPT_HASH_H__
9 
10 #include <crypto/crypto_impl.h>
11 #include <drvcrypt.h>
12 #include <tee_api_types.h>
13 
14 /*
15  * Crypto Library Hash driver allocation function prototype
16  */
17 typedef TEE_Result (*hw_hash_allocate)(struct crypto_hash_ctx **ctx,
18 				       uint32_t algo);
19 
20 /*
21  * Register a hash processing driver in the crypto API
22  *
23  * @allocate - Callback for driver context allocation in the crypto layer
24  */
drvcrypt_register_hash(hw_hash_allocate allocate)25 static inline TEE_Result drvcrypt_register_hash(hw_hash_allocate allocate)
26 {
27 	return drvcrypt_register(CRYPTO_HASH, (void *)allocate);
28 }
29 
30 #endif /* __DRVCRYPT_HASH_H__ */
31