OPTIGA™ Trust M
Host Library Documentation
|
This file defines APIs, types and data structures used in the Command (cmd) module implementation. More...
#include "optiga/common/optiga_lib_common.h"
Go to the source code of this file.
This file defines APIs, types and data structures used in the Command (cmd) module implementation.
Definition in file optiga_cmd.h.
typedef struct optiga_cmd optiga_cmd_t |
OPTIGA command instance structure type.
Definition at line 1 of file optiga_cmd.h.
typedef struct optiga_context optiga_context_t |
OPTIGA comms instance structure type.
Definition at line 1 of file optiga_cmd.h.
optiga_lib_status_t optiga_cmd_calc_hash | ( | optiga_cmd_t * | me, |
uint8_t | cmd_param, | ||
optiga_calc_hash_params_t * | params | ||
) |
Generates hash on external data or data in OID.
Generates hash on external data or data in OID by issuing Calc Hash command to OPTIGA.
[in] | me | Valid instance of optiga_cmd_t created using optiga_cmd_create. |
[in] | cmd_param | Param of CalcHash Command APDU.
|
[in] | params | InData of CalcHash Command APDU, must not be NULL. |
OPTIGA_CMD_SUCCESS | Successful invocation. |
OPTIGA_CMD_ERROR | Error occurred before invoking CalcHash command. Error in the asynchronous state machine. |
OPTIGA_CMD_ERROR_MEMORY_INSUFFICIENT | Error due to insufficient buffer size.
|
optiga_lib_status_t optiga_cmd_calc_sign | ( | optiga_cmd_t * | me, |
uint8_t | cmd_param, | ||
optiga_calc_sign_params_t * | params | ||
) |
Calculate signature on digest.
Calculate signature on digest by issuing Calc Sign command to OPTIGA.
[in] | me | Valid instance of optiga_cmd_t created using optiga_cmd_create. |
[in] | cmd_param | Param of Calc Sign Command APDU.
|
[in] | params | InData of Calc Sign Command APDU, must not be NULL. |
OPTIGA_CMD_SUCCESS | Successful invocation. |
OPTIGA_CMD_ERROR | Error occurred before invoking Calc Sign command. Error in the asynchronous state machine. |
OPTIGA_CMD_ERROR_INVALID_INPUT | Instance invoked for session oid, without acquiring the session (from optiga_cmd_gen_keypair). |
OPTIGA_CMD_ERROR_MEMORY_INSUFFICIENT | Error due to insufficient buffer size.
|
optiga_lib_status_t optiga_cmd_calc_ssec | ( | optiga_cmd_t * | me, |
uint8_t | cmd_param, | ||
optiga_calc_ssec_params_t * | params | ||
) |
Calculates shared secret.
Calculates shared secret by issuing CalcSSec command to OPTIGA.
[in] | me | Valid instance of optiga_cmd_t created using optiga_cmd_create. |
[in] | cmd_param | Param of Calc SSec Command APDU.
|
[in] | params | Pointer to input parameters, must not be NULL. |
OPTIGA_LIB_SUCCESS | Successful invocation of optiga_comms module. |
OPTIGA_CMD_ERROR | Error occurred before invoking CalcSSec command optiga_comms_transceive returned a failure Error in the asynchronous state machine. |
OPTIGA_CMD_ERROR_INVALID_INPUT | Instance invoked for session oid, without acquiring the session (from optiga_cmd_gen_keypair). |
OPTIGA_CMD_ERROR_MEMORY_INSUFFICIENT | APDU length formed is greater than OPTIGA_MAX_COMMS_BUFFER_SIZE. |
optiga_lib_status_t optiga_cmd_close_application | ( | optiga_cmd_t * | me, |
uint8_t | cmd_param, | ||
void * | params | ||
) |
Closes the OPTIGA Application.
Closes the OPTIGA Application by issuing the CloseApplication command.
[in] | me | Valid instance of optiga_cmd_t created using optiga_cmd_create. |
[in] | cmd_param | Param of Command APDU.
|
[in] | params | Secure connection related information, must not be NULL. |
OPTIGA_CMD_SUCCESS | Successful invocation. |
OPTIGA_CMD_ERROR | Error occurred before invoking CloseApplication command. Error in the asynchronous state machine. |
OPTIGA_CMD_ERROR_MEMORY_INSUFFICIENT | APDU length formed is greater than OPTIGA_MAX_COMMS_BUFFER_SIZE. |
optiga_cmd_t* optiga_cmd_create | ( | uint8_t | optiga_instance_id, |
callback_handler_t | handler, | ||
void * | caller_context | ||
) |
Creates an instance of optiga_cmd_t.
Creates an instance of optiga_cmd_t.
[in] | optiga_instance_id | Indicates the OPTIGA configuration to associate with instance. |
[in] | handler | Pointer to callback function, must not be NULL. |
[in] | caller_context | Pointer to upper layer context. |
optiga_cmd_t | * On successful instance creation. |
NULL | Memory allocation failure. Already, OPTIGA_CMD_MAX_REGISTRATIONS number of instances is created. |
optiga_lib_status_t optiga_cmd_decrypt_asym | ( | optiga_cmd_t * | me, |
uint8_t | cmd_param, | ||
optiga_decrypt_asym_params_t * | params | ||
) |
Decrypts data using OPTIGA RSA private key.
Decrypts data using OPTIGA RSA private key by issuing Decrypt Asym command to OPTIGA.
[in] | me | Valid instance of optiga_cmd_t created using optiga_cmd_create. |
[in] | cmd_param | Param of Decrypt Asym Command APDU.
|
[in] | params | InData of Decrypt Asym Command APDU, must not be NULL. |
OPTIGA_LIB_SUCCESS | Successful invocation. |
OPTIGA_CMD_ERROR | Error occurred before invoking Decrypt Asym command. Error in the asynchronous state machine. |
OPTIGA_CMD_ERROR_MEMORY_INSUFFICIENT | Error due to insufficient buffer size.
|
optiga_lib_status_t optiga_cmd_decrypt_sym | ( | optiga_cmd_t * | me, |
uint8_t | cmd_param, | ||
optiga_decrypt_sym_params_t * | params | ||
) |
Decrypt data using optiga_symmetric_encryption_mode_t encryption scheme.
Decrypts data using selected encryption scheme by issuing Decrypt Sym command to OPTIGA.
[in] | me | Valid instance of optiga_cmd_t created using optiga_cmd_create. |
[in] | cmd_param | Param of Decrypt Sym Command APDU.
|
[in] | params | InData of Decrypt Sym Command APDU, must not be NULL. |
OPTIGA_LIB_SUCCESS | Successful invocation. |
OPTIGA_CMD_ERROR | Error occurred before invoking Encrypt Sym command. Error in the asynchronous state machine. |
OPTIGA_CMD_ERROR_INVALID_INPUT | Continue and final APDU command invoked without strict lock acquired for the instance. |
OPTIGA_CMD_ERROR_MEMORY_INSUFFICIENT | Error due to insufficient buffer size.
|
optiga_lib_status_t optiga_cmd_derive_key | ( | optiga_cmd_t * | me, |
uint8_t | cmd_param, | ||
optiga_derive_key_params_t * | params | ||
) |
Derives a key.
Derives a key by issuing DeriveKey command to OPTIGA.
[in] | me | Valid instance of optiga_cmd_t created using optiga_cmd_create. |
[in] | cmd_param | Param of Derive Key Command APDU.
|
[in] | params | InData of derive key Command APDU, must not be NULL. |
OPTIGA_LIB_SUCCESS | Successful invocation. |
OPTIGA_CMD_ERROR | Error occurred before invoking derive key command optiga comms transceive returned a failure Error in the asynchronous state machine. |
OPTIGA_CMD_ERROR_INVALID_INPUT | Instance invoked for session oid, without acquiring the session(from optiga_cmd_calc_ssec). |
OPTIGA_CMD_ERROR_MEMORY_INSUFFICIENT | APDU length formed is greater than OPTIGA_MAX_COMMS_BUFFER_SIZE. |
optiga_lib_status_t optiga_cmd_destroy | ( | optiga_cmd_t * | me | ) |
Destroys the instance of optiga_cmd_t.
Destroys the instance of optiga_cmd_t.
[in] | me | Valid instance of optiga_cmd_t created using optiga_cmd_create. |
OPTIGA_LIB_SUCCESS | Successful destruction of instance. |
optiga_lib_status_t optiga_cmd_encrypt_asym | ( | optiga_cmd_t * | me, |
uint8_t | cmd_param, | ||
optiga_encrypt_asym_params_t * | params | ||
) |
Encrypt data using RSA public key.
Encrypts data using RSA public key by issuing Encrypt Asym command to OPTIGA.
[in] | me | Valid instance of optiga_cmd_t created using optiga_cmd_create. |
[in] | cmd_param | Param of Encrypt Asym Command APDU.
|
[in] | params | InData of Encrypt Asym Command APDU, must not be NULL. |
OPTIGA_LIB_SUCCESS | Successful invocation. |
OPTIGA_CMD_ERROR | Error occurred before invoking Encrypt Asym command. Error in the asynchronous state machine. |
OPTIGA_CMD_ERROR_INVALID_INPUT | Instance invoked for encrypting session, without acquiring the session |
OPTIGA_CMD_ERROR_MEMORY_INSUFFICIENT | Error due to insufficient buffer size.
|
optiga_lib_status_t optiga_cmd_encrypt_sym | ( | optiga_cmd_t * | me, |
uint8_t | cmd_param, | ||
optiga_encrypt_sym_params_t * | params | ||
) |
Encrypt data using optiga_symmetric_encryption_mode_t encryption scheme.
Encrypts data using selected encryption scheme by issuing Encrypt Sym command to OPTIGA.
[in] | me | Valid instance of optiga_cmd_t created using optiga_cmd_create. |
[in] | cmd_param | Param of Encrypt Sym Command APDU.
|
[in] | params | InData of Encrypt Sym Command APDU, must not be NULL. |
OPTIGA_LIB_SUCCESS | Successful invocation. |
OPTIGA_CMD_ERROR | Error occurred before invoking Encrypt Sym command. Error in the asynchronous state machine. |
OPTIGA_CMD_ERROR_INVALID_INPUT | Continue and final APDU command invoked without strict lock acquired for the instance. |
OPTIGA_CMD_ERROR_MEMORY_INSUFFICIENT | Error due to insufficient buffer size.
|
optiga_lib_status_t optiga_cmd_gen_keypair | ( | optiga_cmd_t * | me, |
uint8_t | cmd_param, | ||
optiga_gen_keypair_params_t * | params | ||
) |
Generates ECC or RSA key-pair.
Generate ECC/RSA key-pair by issuing Generate KeyPair command to OPTIGA.
[in] | me | Valid instance of optiga_cmd_t created using optiga_cmd_create. |
[in] | cmd_param | Param of Generate KeyPair Command APDU.
|
[in] | params | InData of Generate KeyPair Command APDU, must not be NULL. |
OPTIGA_LIB_SUCCESS | Successful invocation. |
OPTIGA_CMD_ERROR | Error occurred before invoking Generate KeyPair command. Error in the asynchronous state machine. |
OPTIGA_CMD_ERROR_MEMORY_INSUFFICIENT | Error due to insufficient buffer size.
|
optiga_lib_status_t optiga_cmd_gen_symkey | ( | optiga_cmd_t * | me, |
uint8_t | cmd_param, | ||
optiga_gen_symkey_params_t * | params | ||
) |
Generate symmetric key using OPTIGA.
Generate symmetric key by issuing Generate Symmetric Key command to OPTIGA.
[in] | me | Valid instance of optiga_cmd_t created using optiga_cmd_create. |
[in] | cmd_param | Param of Gen Sym Key Command APDU.
|
[in] | params | InData of Gen Sym Key Command APDU, must not be NULL. |
OPTIGA_LIB_SUCCESS | Successful invocation. |
OPTIGA_CMD_ERROR | Error occurred before invoking Gen Sym Key command. Error in the asynchronous state machine. |
OPTIGA_CMD_ERROR_INVALID_INPUT | Instance invoked for encrypting session, without acquiring the session |
OPTIGA_CMD_ERROR_MEMORY_INSUFFICIENT | Error due to insufficient buffer size.
|
optiga_lib_status_t optiga_cmd_get_data_object | ( | optiga_cmd_t * | me, |
uint8_t | cmd_param, | ||
optiga_get_data_object_params_t * | params | ||
) |
Reads data or metadata of the specified data object.
Reads data or metadata of the specified data object, by issuing the GetDataObject command, based on input parameters.
[in] | me | Valid instance of optiga_cmd_t created using optiga_cmd_create. |
[in] | cmd_param | Param of Get Data Command APDU.
|
[in] | params | InData of Get Data Command APDU, must not be NULL. |
OPTIGA_CMD_SUCCESS | Successful invocation. |
OPTIGA_CMD_ERROR | Error occurred before invoking GetDataObject command. Error in the asynchronous state machine. |
OPTIGA_CMD_ERROR_MEMORY_INSUFFICIENT | Error due to insufficient buffer size.
|
optiga_lib_status_t optiga_cmd_get_random | ( | optiga_cmd_t * | me, |
uint8_t | cmd_param, | ||
optiga_get_random_params_t * | params | ||
) |
Generates random data or pre-master secret for RSA key exchange.
Generates random data or pre-master secret for RSA key exchange, by issuing the GetRandom command to OPTIGA.
[in] | me | Valid instance of optiga_cmd_t created using optiga_cmd_create. |
[in] | cmd_param | Param of Get Random Command APDU.
|
[in] | params | InData of Get Random Command APDU, must not be NULL. |
OPTIGA_CMD_SUCCESS | Successful invocation. |
OPTIGA_CMD_ERROR | Error occurred before invoking GetRandom command. Error in the asynchronous state machine. |
OPTIGA_CMD_ERROR_MEMORY_INSUFFICIENT | APDU length formed is greater than OPTIGA_MAX_COMMS_BUFFER_SIZE. |
optiga_lib_status_t optiga_cmd_open_application | ( | optiga_cmd_t * | me, |
uint8_t | cmd_param, | ||
void * | params | ||
) |
Opens the OPTIGA Application.
Opens the OPTIGA Application by issuing the OpenApplication command.
[in] | me | Valid instance of optiga_cmd_t created using optiga_cmd_create. |
[in] | cmd_param | Param of Command APDU.
|
[in] | params | Secure connection related information, must not be NULL. |
OPTIGA_CMD_SUCCESS | Successful invocation. |
OPTIGA_CMD_ERROR | Error occurred before invoking OpenApplication command. Error in the asynchronous state machine. |
OPTIGA_CMD_ERROR_MEMORY_INSUFFICIENT | APDU length formed is greater than OPTIGA_MAX_COMMS_BUFFER_SIZE. |
optiga_lib_status_t optiga_cmd_release_lock | ( | const optiga_cmd_t * | me | ) |
Releases the OPTIGA cmd lock.
Releases the OPTIGA cmd lock.
[in] | me | Valid instance of optiga_cmd_t created using optiga_cmd_create. |
OPTIGA_CMD_SUCCESS | Successful release of the access layer lock. |
optiga_lib_status_t optiga_cmd_set_data_object | ( | optiga_cmd_t * | me, |
uint8_t | cmd_param, | ||
optiga_set_data_object_params_t * | params | ||
) |
Writes data or metadata to the specified data object.
Writes data or metadata to the specified data object, by issuing the SetDataObject command, based on input parameters.
[in] | me | Valid instance of optiga_cmd_t created using optiga_cmd_create. |
[in] | cmd_param | Param of Set Data Command APDU.
|
[in] | params | InData of Set Data Command APDU, must not be NULL. |
OPTIGA_CMD_SUCCESS | Successful invocation. |
OPTIGA_CMD_ERROR | Error occurred before invoking SetDataObject command. Error in the asynchronous state machine. |
OPTIGA_CMD_ERROR_MEMORY_INSUFFICIENT | APDU length formed is greater than OPTIGA_MAX_COMMS_BUFFER_SIZE. |
optiga_lib_status_t optiga_cmd_set_object_protected | ( | optiga_cmd_t * | me, |
uint8_t | cmd_param, | ||
optiga_set_object_protected_params_t * | params | ||
) |
Writes protected object fragments to OPTIGA.
Writes manifest or data fragement(s) to the specified data object, by issuing the SetObjectProtected command, in a securely.
[in] | me | Valid instance of optiga_cmd_t created using optiga_cmd_create. |
[in] | cmd_param | Param of Set Object Protected APDU.
|
[in] | params | InData of Set Object Protected APDU, must not be NULL. |
OPTIGA_CMD_SUCCESS | Successful invocation. |
OPTIGA_CMD_ERROR | Error occurred before invoking SetObjectProtected command. Error in the asynchronous state machine. |
OPTIGA_CMD_ERROR_MEMORY_INSUFFICIENT | APDU length formed is greater than OPTIGA_MAX_COMMS_BUFFER_SIZE. |
OPTIGA_CMD_ERROR_INVALID_INPUT | Continue and final APDU command invoked without strict lock acquired for the instance. |
optiga_lib_status_t optiga_cmd_verify_sign | ( | optiga_cmd_t * | me, |
uint8_t | cmd_param, | ||
optiga_verify_sign_params_t * | params | ||
) |
Verifies the signature over the given digest.
Verifies the signature over the given digest by issuing VerifySign command.
[in] | me | Valid instance of optiga_cmd_t created using optiga_cmd_create. |
[in] | cmd_param | Param of VerifySign Command APDU.
|
[in] | params | Parameters for InData of VerifySign Command APDU, must not be NULL. |
OPTIGA_CMD_SUCCESS | Successful invocation. |
OPTIGA_CMD_ERROR | Error occurred before invoking VerifySign command. Error in the asynchronous state machine. |
OPTIGA_CMD_ERROR_MEMORY_INSUFFICIENT | APDU length formed is greater than OPTIGA_MAX_COMMS_BUFFER_SIZE. |