|
|
NVIDIA DRIVE OS Linux API Reference5.1.0.2 Release |
Defines APIs for Trusted Little Kernel (TLK) crypto services.
Data Structures | |
| struct | te_crypto_operation_info_t |
| Holds a crypto operation info object. More... | |
| struct | __te_crypto_operation_t |
Internal data structure for te_crypto_operation_t. More... | |
| struct | te_crypto_rsa_key_t |
| Holds internal data for RSA keys. More... | |
| struct | hwrng_cache |
Macros | |
| #define | AES_BLOCK_SIZE 16 |
| #define | AES_ENCRYPTION_PADDED_SIZE(clearlen) ((((clearlen) + AES_BLOCK_SIZE) / AES_BLOCK_SIZE) * AES_BLOCK_SIZE) |
| #define | OTE_AES_MODE_NEEDS_PADDING(algo) |
| #define | HWRNG_CACHE_SIZE_BYTES 1024 |
| #define | HWRNG_CACHE_ENTROPY_SIZE_BYTES 256 |
Typedefs | |
| typedef struct __te_crypto_object * | te_crypto_object_t |
| typedef struct __te_crypto_operation_t * | te_crypto_operation_t |
Enumerations | |
| enum | te_oper_crypto_algo_t { OTE_ALG_AES_ECB_NOPAD = 0x10000010, OTE_ALG_AES_CBC_NOPAD = 0x10000110, OTE_ALG_AES_CTR = 0x10000210, OTE_ALG_AES_CTS = 0x10000310, OTE_ALG_AES_ECB = 0x10000510, OTE_ALG_AES_CBC = 0x10000610, OTE_ALG_AES_CBC_256 = 0x10000710, OTE_ALG_AES_CBC_256_NOPAD = 0x10000810, OTE_ALG_AES_CMAC_128 = 0x20000110, OTE_ALG_AES_CMAC_192 = 0x20000120, OTE_ALG_AES_CMAC_256 = 0x20000130, OTE_ALG_SHA_HMAC_224 = 0x20000210, OTE_ALG_SHA_HMAC_256 = 0x20000220, OTE_ALG_SHA_HMAC_384 = 0x20000230, OTE_ALG_SHA_HMAC_512 = 0x20000240, OTE_ALG_SHA_HMAC_1 = 0x20000250, OTE_ALG_RSA_PKCS_OAEP = 0x30000100, OTE_ALG_RSA_PSS = 0x30000200, OTE_ALG_PKCS1_Block1 = 0x30000300, OTE_ALG_DRNG = 0x50000000 } |
| Defines algorithm types. More... | |
| enum | te_oper_crypto_algo_mode_t { OTE_ALG_MODE_ENCRYPT, OTE_ALG_MODE_DECRYPT, OTE_ALG_MODE_SIGN, OTE_ALG_MODE_VERIFY, OTE_ALG_MODE_DIGEST, OTE_ALG_MODE_DERIVE } |
| Defines algrorithm modes. More... | |
Functions | |
| te_error_t | te_allocate_object (te_crypto_object_t *obj) |
| Allocates memory for a te_crypto_object_t. More... | |
| 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. More... | |
| void | te_free_object (te_crypto_object_t obj) |
| Frees allocated memory within crypto object. More... | |
| 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. More... | |
| 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 object. More... | |
| te_error_t | te_cipher_init (te_crypto_operation_t oper, void *iv, size_t iv_size) |
| Initializes the operation cipher. More... | |
| 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. More... | |
| 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. More... | |
| te_error_t | te_rsa_init (te_crypto_operation_t oper) |
| Initializes the RSA operation. More... | |
| 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. More... | |
| 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. More... | |
| void | te_free_operation (te_crypto_operation_t oper) |
| Frees operation internal memory. More... | |
| void | te_generate_random (void *buffer, size_t size) |
| Generates random data. More... | |
| 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. More... | |
| 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. More... | |
| #define AES_BLOCK_SIZE 16 |
Definition at line 179 of file ote_crypto.h.
| #define AES_ENCRYPTION_PADDED_SIZE | ( | clearlen | ) | ((((clearlen) + AES_BLOCK_SIZE) / AES_BLOCK_SIZE) * AES_BLOCK_SIZE) |
Definition at line 180 of file ote_crypto.h.
| #define HWRNG_CACHE_ENTROPY_SIZE_BYTES 256 |
Definition at line 310 of file ote_crypto.h.
| #define HWRNG_CACHE_SIZE_BYTES 1024 |
Definition at line 309 of file ote_crypto.h.
| #define OTE_AES_MODE_NEEDS_PADDING | ( | algo | ) |
Definition at line 183 of file ote_crypto.h.
| typedef struct __te_crypto_object* te_crypto_object_t |
Definition at line 48 of file ote_crypto.h.
| typedef struct __te_crypto_operation_t* te_crypto_operation_t |
Definition at line 50 of file ote_crypto.h.
Defines algrorithm modes.
| Enumerator | |
|---|---|
| OTE_ALG_MODE_ENCRYPT | |
| OTE_ALG_MODE_DECRYPT | |
| OTE_ALG_MODE_SIGN | |
| OTE_ALG_MODE_VERIFY | |
| OTE_ALG_MODE_DIGEST | |
| OTE_ALG_MODE_DERIVE | |
Definition at line 188 of file ote_crypto.h.
Defines algorithm types.
Definition at line 155 of file ote_crypto.h.
| te_error_t te_allocate_object | ( | te_crypto_object_t * | obj | ) |
Allocates memory for a te_crypto_object_t.
| [in,out] | obj | A pointer to new crypto object. |
| OTE_SUCCESS | Indicates the operation was successful. |
| OTE_ERROR_OUT_OF_MEMORY | Indicates the system ran out of resources. |
| 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.
Allocates crypto operation internal memory. Initializes operation based on algo/mode.
| [in,out] | oper | A pointer to a crypto operation object. |
| [in] | algorithm | Crypto algorithm. |
| [in] | mode | Crypto algorithm mode. |
| OTE_SUCCESS | Indicates the operation was successful. |
| 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.
| [in] | oper | Crypto operation object. |
| [in] | src_data | NULL expected. |
| [in] | src_len | Zero expected. |
| [in,out] | dst_data | A pointer to the destination data buffer supplied to do_final. |
| [in,out] | dst_len | A pointer to the destination buffer size supplied to do_final. |
| OTE_SUCCESS | Indicates the operation was successful. |
| OTE_ERROR_BAD_PARAMETERS | Indicates src_len was not 0 or dst_data/dst_len was NULL. |
| te_error_t te_cipher_init | ( | te_crypto_operation_t | oper, |
| void * | iv, | ||
| size_t | iv_size | ||
| ) |
Initializes the operation cipher.
Sets the initialization vector and calls the init function.
| [in,out] | oper | Crypto operation object. |
| [in] | iv | Initialization vector. |
| [in] | iv_size | Initialization vector size. |
| OTE_SUCCESS | Indicates the operation was successful. |
| 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.
| [in] | oper | Crypto operation object |
| [in] | src_data | A pointer to the source data buffer supplied to init. |
| [in] | src_size | Source buffer size supplied to init. |
| [in,out] | dst_data | A pointer to the destination data buffer supplied to init. |
| [in,out] | dst_size | A pointer to the destination buffer size supplied to init. |
| OTE_SUCCESS | Indicates the operation was successful. |
| 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.
This calls te_cipher_init, te_cipher_update and te_cipher_do_final on the supplied input buffer and returns the resulting output.
| OTE_SUCCESS | Indicates the operation was successful. |
| [in] | mode | Mode to use, e.g. decrypt/encrypt. |
| [in] | algo | Algorithm to be used. |
| [in] | key | Key to be used. |
| [in] | keysize | The length of the key in bytes. |
| [in] | iv | Initialization Vector. |
| [in] | ivsize | The length of initialization vector in bytes. |
| [in] | in | Input buffer. |
| [in] | insize | The length of the input buffer in bytes. |
| [out] | out | Output Buffer. |
| [in,out] | outsize | The length of the output buffer in bytes. |
| void te_free_object | ( | te_crypto_object_t | obj | ) |
Frees allocated memory within crypto object.
| [in] | obj | Crypto object. |
| void te_free_operation | ( | te_crypto_operation_t | oper | ) |
Frees operation internal memory.
| void te_generate_random | ( | void * | buffer, |
| size_t | size | ||
| ) |
Generates random data.
| [in,out] | buffer | A pointer to the buffer to be filled. |
| [in] | size | Length of the buffer. |
| 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.
| [in] | object | Crypto object. |
| [in] | id | Attribute ID to match. |
| [out] | ret | A double pointer to the attribute found. |
| OTE_SUCCESS | Indicates the operation was successful. |
| OTE_ERROR_ITEM_NOT_FOUND | Indicates the requested data item was not found. |
| 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.
Allocates obj internal memory and copies attributes to obj.
| [in,out] | obj | Crypto object to store attributes. |
| [in] | attrs | Array of attributes. |
| [in] | attr_count | Array length. |
| OTE_SUCCESS | Indicates the operation was successful. |
| 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.
| [in] | oper | Crypto operation object. |
| [out] | modulus_size_bytes | Size of the modulus in Bytes. |
| OTE_SUCCESS | Indicates the operation was successful. |
| 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.
| [in] | oper | Crypto operation object. |
| [in] | src_data | A pointer to the source data buffer supplied to init. |
| [in] | src_size | Source buffer size supplied to init. |
| [in,out] | dst_data | A pointer to the destination data buffer supplied to init. |
| [in,out] | dst_size | A pointer to the destination buffer size supplied to init. |
| OTE_SUCCESS | Indicates the operation was successful. |
| te_error_t te_rsa_init | ( | te_crypto_operation_t | oper | ) |
Initializes the RSA operation.
| [in,out] | oper | Crypto operation object. |
| OTE_SUCCESS | Indicates the operation was successful. |
| 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 object.
| [in,out] | oper | Crypto operation object. |
| [in] | obj | Key crypto object. |
| OTE_SUCCESS | Indicates the operation was successful. |