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 40 41 42 43 44 45 46 47
|
/* SPDX-License-Identifier: BSD-2-Clause */
/*
* Copyright 2018-2020 NXP
*
* Brief Cryptographic library using the HW crypto driver.
* Mathematical operation using HW if available.
*/
#ifndef __DRVCRYPT_MATH_H__
#define __DRVCRYPT_MATH_H__
#include <drvcrypt.h>
/*
* Binary Modular operation data
*/
struct drvcrypt_mod_op {
struct drvcrypt_buf n; /* Modulus N */
struct drvcrypt_buf a; /* Operand A */
struct drvcrypt_buf b; /* Operand B */
struct drvcrypt_buf result; /* Result of operation */
};
/*
* Operation (A xor B) mod N
*
* @data [in/out] Data operation
*/
TEE_Result drvcrypt_xor_mod_n(struct drvcrypt_mod_op *data);
/*
* Crypto Library Binaries Modular driver operations
*/
struct drvcrypt_math {
/* (A xor B) mod N */
TEE_Result (*xor_mod_n)(struct drvcrypt_mod_op *op_data);
};
/*
* Register a mathematical processing driver in the crypto API
*
* @ops - Driver operations in the HW layer
*/
static inline TEE_Result drvcrypt_register_math(const struct drvcrypt_math *ops)
{
return drvcrypt_register(CRYPTO_MATH, (void *)ops);
}
#endif /* __DRVCRYPT_MATH_H__ */
|