41 #ifndef __OTE_CRYPTO_H
42 #define __OTE_CRYPTO_H
47 struct __te_crypto_object;
86 void (*
free)(te_crypto_operation_t operation);
145 uint32_t attr_count);
179 #define AES_BLOCK_SIZE 16
180 #define AES_ENCRYPTION_PADDED_SIZE(clearlen) \
181 ((((clearlen) + AES_BLOCK_SIZE) / AES_BLOCK_SIZE) * AES_BLOCK_SIZE)
183 #define OTE_AES_MODE_NEEDS_PADDING(algo) \
184 (((algo) == OTE_ALG_AES_ECB) || ((algo) == OTE_ALG_AES_CBC) || \
185 ((algo) == OTE_ALG_AES_CBC_256))
251 size_t src_size,
void *dst_data,
size_t *dst_size);
269 size_t src_len,
void *dst_data,
size_t *dst_len);
303 const void *src_data,
size_t src_size,
304 void *dst_data,
size_t *dst_size);
309 #define HWRNG_CACHE_SIZE_BYTES 1024
310 #define HWRNG_CACHE_ENTROPY_SIZE_BYTES 256
371 unsigned int keysize,
372 unsigned char *iv,
unsigned int ivsize,
373 unsigned char *in,
unsigned int insize,
374 unsigned char *out,
unsigned int *outsize);
void(* free)(te_crypto_operation_t operation)
te_error_t(* init)(te_crypto_operation_t operation)
int expo1_len
Holds expo1 length in bytes.
int public_expo_len
Holds public exponent length in bytes.
uint8_t * expo1
Holds d mod (p-1).
uint8_t * prime1
Holds secret prime factor.
uint32_t required_key_usage
te_error_t te_allocate_operation(te_crypto_operation_t *oper, te_oper_crypto_algo_t algorithm, te_oper_crypto_algo_mode_t mode)
Allocates memory for crypto operation.
void te_free_object(te_crypto_object_t obj)
Frees allocated memory within crypto object.
Holds a crypto operation info object.
Internal data structure for te_crypto_operation_t.
int expo2_len
Holds expo2 length in bytes.
int prime2_len
Holds prime2 length in bytes.
te_error_t te_set_operation_key(te_crypto_operation_t oper, te_crypto_object_t obj)
Allocates memory in the crypto operation and copies the key from the crypto object to the operation o...
te_oper_crypto_algo_t
Defines algorithm types.
te_error_t(* do_final)(te_crypto_operation_t operation, const void *srd_data, size_t src_size, void *dst_data, size_t *dst_size)
uint8_t * public_mod
Holds public modulus.
te_error_t te_rsa_get_modulus_size(te_crypto_operation_t oper, size_t *modulus_size_bytes)
Returns the RSA modulus size in bytes.
te_attribute_id_t
Defines attribute ID types.
te_error_t(* handle_req)(te_crypto_operation_t operation, const void *src_data, size_t src_size, void *dst_data, size_t *dst_size)
uint8_t * coeff
Holds q^-1 mod p.
te_error_t te_allocate_object(te_crypto_object_t *obj)
Allocates memory for a te_crypto_object_t.
int prime1_len
Holds prime1 length in bytes.
uint8_t * public_expo
Holds public exponent.
te_error_t te_get_attribute_by_id(te_crypto_object_t object, te_attribute_id_t id, te_attribute_t **ret)
Finds the first attribute in the crypto object that matches ID.
te_error_t te_rsa_init(te_crypto_operation_t oper)
Initializes the RSA operation.
int coeff_len
Holds the coefficient length in bytes.
te_error_t te_cipher_do_final(te_crypto_operation_t oper, const void *src_data, size_t src_len, void *dst_data, size_t *dst_len)
Calls operation do_final with supplied parameters.
te_error_t te_populate_object(te_crypto_object_t obj, te_attribute_t *attrs, uint32_t attr_count)
Populates crypto object from a list of attributes.
te_crypto_operation_info_t info
te_oper_crypto_algo_mode_t
Defines algrorithm modes.
void te_generate_random(void *buffer, size_t size)
Generates random data.
uint8_t * private_expo
Holds private exponent.
struct __te_crypto_operation_t * te_crypto_operation_t
te_error_t te_cipher_update(te_crypto_operation_t oper, const void *src_data, size_t src_size, void *dst_data, size_t *dst_size)
Updates the cipher by calling the operation update function with the supplied parameters.
te_error_t(* update)(te_crypto_operation_t operation, const void *src_data, size_t src_size, void *dst_dat, size_t *dst_size)
Defines attribute object internals.
te_error_t te_cipher_init(te_crypto_operation_t oper, void *iv, size_t iv_size)
Initializes the operation cipher.
te_error_t te_crypt_data(te_oper_crypto_algo_mode_t mode, te_oper_crypto_algo_t algo, unsigned char *key, unsigned int keysize, unsigned char *iv, unsigned int ivsize, unsigned char *in, unsigned int insize, unsigned char *out, unsigned int *outsize)
Crypto wrapper around software crypto library.
te_error_t te_rsa_handle_request(te_crypto_operation_t oper, const void *src_data, size_t src_size, void *dst_data, size_t *dst_size)
Executes the specified RSA operations.
int private_expo_len
Holds private exponent length in bytes.
int public_mod_len
Holds public modulus length in bytes.
te_error_t
Defines Open Trusted Environment (OTE) error codes.
Holds internal data for RSA keys.
uint8_t * expo2
Holds d mod (q-1).
struct __te_crypto_object * te_crypto_object_t
void te_free_operation(te_crypto_operation_t oper)
Frees operation internal memory.
NVIDIA Trusted Little Kernel Interface: Service Attributes
uint8_t * prime2
Holds secret prime factor.