File: drvcrypt_mac.h

package info (click to toggle)
optee-os 4.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 31,960 kB
  • sloc: ansic: 444,388; asm: 12,922; python: 3,719; makefile: 1,681; sh: 238
file content (39 lines) | stat: -rw-r--r-- 1,026 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* SPDX-License-Identifier: BSD-2-Clause */
/*
 * Copyright 2019-2020 NXP
 *
 * MAC interface calling the HW crypto driver.
 */
#ifndef __DRVCRYPT_MAC_H__
#define __DRVCRYPT_MAC_H__

#include <crypto/crypto_impl.h>
#include <drvcrypt.h>
#include <tee_api_types.h>

/*
 * Crypto library HMAC driver allocation function prototype
 */
typedef TEE_Result (*drvcrypt_mac_allocate)(struct crypto_mac_ctx **ctx,
					    uint32_t algo);

/*
 * Register a HMAC processing driver in the crypto API
 *
 * @allocate - Callback for driver context allocation in the crypto layer
 */
static inline TEE_Result drvcrypt_register_hmac(drvcrypt_mac_allocate allocate)
{
	return drvcrypt_register(CRYPTO_HMAC, (void *)allocate);
}

/*
 * Register a CMAC processing driver in the crypto API
 *
 * @allocate - Callback for driver context allocation in the crypto layer
 */
static inline TEE_Result drvcrypt_register_cmac(drvcrypt_mac_allocate allocate)
{
	return drvcrypt_register(CRYPTO_CMAC, (void *)allocate);
}
#endif /* __DRVCRYPT_MAC_H__ */