OPTIGA™ Trust M
Host Library Documentation
|
This file provides the prototypes for the commonly used functions and structures of OPTIGA Library. More...
#include "optiga/optiga_lib_config.h"
#include "optiga/common/optiga_lib_types.h"
#include "optiga/common/optiga_lib_return_codes.h"
Go to the source code of this file.
Data Structures | |
struct | optiga_hash_context |
Specifies the structure to the Hash context details managed by OPTIGA. More... | |
struct | hash_data_from_host |
Specifies the structure to provide the details of data to be hashed from host. More... | |
struct | hash_data_in_optiga |
Specifies the structure to provide the details of data to be hashed from OPTIGA. More... | |
struct | public_key_from_host |
Specifies the data structure of the Public Key details (key, size and type) More... | |
struct | optiga_get_data_object |
Specifies the data structure for data to be read from OPTIGA. More... | |
struct | optiga_set_data_object |
Specifies the data structure for data to be written to OPTIGA. More... | |
struct | optiga_calc_hash |
Specifies the data structure of calculate hash. More... | |
struct | optiga_get_random |
Specifies the data structure of random generation. More... | |
struct | optiga_gen_keypair |
Specifies the data structure for generate key pair. More... | |
struct | optiga_calc_sign |
Specifies the data structure for ECDSA signature. More... | |
struct | optiga_verify_sign |
Specifies the data structure for ECDSA signature verification. More... | |
struct | optiga_calc_ssec |
Specifies the data structure for ecdh secret generation. More... | |
struct | optiga_derive_key |
Specifies the structure for derivation of key using pseudo random function. More... | |
struct | optiga_enc_dec_asym |
Specifies the structure for asymmetric encryption and decryption. More... | |
struct | optiga_set_object_protected_params |
Specifies the data structure for protected update. More... | |
struct | optiga_symmetric_enc_dec_params |
Specifies the data structure for symmetric encrypt and decrypt. More... | |
struct | optiga_gen_symkey_params |
Specifies the data structure for symmetric generate key. More... | |
#define | OPTIGA_INSTANCE_ID_0 (0x00) |
Instance id of OPTIGA slave. More... | |
#define | OPTIGA_COMMS_NO_PROTECTION (0x00) |
When command data and response data is unprotected. More... | |
#define | OPTIGA_COMMS_COMMAND_PROTECTION (0x01) |
When command data is protected and response data is unprotected. More... | |
#define | OPTIGA_COMMS_RESPONSE_PROTECTION (0x02) |
When command data is unprotected and response data is protected. More... | |
#define | OPTIGA_COMMS_FULL_PROTECTION (0x03) |
Both command data and response data are protected. More... | |
#define | OPTIGA_COMMS_RE_ESTABLISH (0x80) |
Re-establish shielded connection. More... | |
#define | OPTIGA_COMMS_PROTOCOL_VERSION_PRE_SHARED_SECRET (0x01) |
Pre shared secret protocol version. More... | |
#define | OPTIGA_CRYPT_HOST_DATA (0x01) |
Data is provided by host. More... | |
#define | OPTIGA_CRYPT_OID_DATA (0x00) |
Data in internal to optiga OID. More... | |
#define | OPTIGA_LIB_INSTANCE_BUSY (0x0001) |
OPTIGA instance is busy. More... | |
#define | OPTIGA_LIB_INSTANCE_FREE (0x0000) |
OPTIGA instance is free. More... | |
enum | optiga_key_id { OPTIGA_KEY_ID_E0F0 = 0xE0F0, OPTIGA_KEY_ID_E0F1 = 0xE0F1, OPTIGA_KEY_ID_E0F2 = 0xE0F2, OPTIGA_KEY_ID_E0F3 = 0xE0F3, OPTIGA_KEY_ID_E0FC = 0xE0FC, OPTIGA_KEY_ID_E0FD = 0xE0FD, OPTIGA_KEY_ID_SESSION_BASED = 0x0000, OPTIGA_KEY_ID_SECRET_BASED = 0xE200 } |
Specifies the key location in OPTIGA. More... | |
enum | optiga_key_usage { OPTIGA_KEY_USAGE_AUTHENTICATION = 0x01, OPTIGA_KEY_USAGE_SIGN = 0x10, OPTIGA_KEY_USAGE_KEY_AGREEMENT = 0x20, OPTIGA_KEY_USAGE_ENCRYPTION = 0x02 } |
Specifies the key usage type in OPTIGA. More... | |
enum | optiga_set_obj_protected_tag { OPTIGA_SET_PROTECTED_UPDATE_START = 0x00, OPTIGA_SET_PROTECTED_UPDATE_CONTINUE = 0x02, OPTIGA_SET_PROTECTED_UPDATE_FINAL = 0x01 } |
Specifies the set protected object tag. More... | |
enum | optiga_ecc_curve { OPTIGA_ECC_CURVE_NIST_P_256 = 0x03, OPTIGA_ECC_CURVE_NIST_P_384 = 0x04, OPTIGA_ECC_CURVE_NIST_P_521 = 0x05, OPTIGA_ECC_CURVE_BRAIN_POOL_P_256R1 = 0x13, OPTIGA_ECC_CURVE_BRAIN_POOL_P_384R1 = 0x15, OPTIGA_ECC_CURVE_BRAIN_POOL_P_512R1 = 0x16 } |
Specifies the key curve type in OPTIGA. More... | |
enum | optiga_rsa_encryption_scheme { OPTIGA_RSAES_PKCS1_V15 = 0x11 } |
Specifies the RSA encryption schemes. More... | |
enum | optiga_rsa_key_type { OPTIGA_RSA_KEY_1024_BIT_EXPONENTIAL = 0x41, OPTIGA_RSA_KEY_2048_BIT_EXPONENTIAL = 0x42 } |
Specifies the RSA key type in OPTIGA. More... | |
enum | optiga_rsa_signature_scheme { OPTIGA_RSASSA_PKCS1_V15_SHA256 = 0x01, OPTIGA_RSASSA_PKCS1_V15_SHA384 = 0x02, OPTIGA_RSASSA_PKCS1_V15_SHA512 = 0x03 } |
Specifies the RSA signature schemes type in OPTIGA. More... | |
enum | optiga_symmetric_encryption_mode { OPTIGA_SYMMETRIC_ECB = 0x08, OPTIGA_SYMMETRIC_CBC = 0x09, OPTIGA_SYMMETRIC_CBC_MAC = 0x0A, OPTIGA_SYMMETRIC_CMAC = 0x0B } |
Specifies the symmetric encryption schemes type in OPTIGA. More... | |
enum | optiga_hash_type { OPTIGA_HASH_TYPE_SHA_256 = 0xE2 } |
Specifies the hashing algorithm type in OPTIGA. More... | |
enum | optiga_hash_context_length { OPTIGA_HASH_CONTEXT_LENGTH_SHA_256 = 209 } |
Specifies the hash context length in bytes. More... | |
enum | optiga_rng_type { OPTIGA_RNG_TYPE_TRNG = 0x00, OPTIGA_RNG_TYPE_DRNG = 0x01 } |
Specifies the random generation types. More... | |
enum | optiga_hmac_type { OPTIGA_HMAC_SHA_256 = 0x20, OPTIGA_HMAC_SHA_384 = 0x21, OPTIGA_HMAC_SHA_512 = 0x22 } |
Specifies the HMAC generation types in OPTIGA. More... | |
enum | optiga_hkdf_type { OPTIGA_HKDF_SHA_256 = 0x08, OPTIGA_HKDF_SHA_384 = 0x09, OPTIGA_HKDF_SHA_512 = 0x0A } |
Specifies the HKDF key derivation types in OPTIGA. More... | |
enum | optiga_tls_prf_type { OPTIGA_TLS12_PRF_SHA_256 = 0x01, OPTIGA_TLS12_PRF_SHA_384 = 0x02, OPTIGA_TLS12_PRF_SHA_512 = 0x03 } |
Specifies the key derivation types. More... | |
enum | optiga_symmetric_key_type { OPTIGA_SYMMETRIC_AES_128 = 0x81, OPTIGA_SYMMETRIC_AES_192 = 0x82, OPTIGA_SYMMETRIC_AES_256 = 0x83 } |
Specifies the symmetric key types supported by OPTIGA. More... | |
typedef enum optiga_key_id | optiga_key_id_t |
Specifies the key location in OPTIGA. More... | |
typedef enum optiga_key_usage | optiga_key_usage_t |
Specifies the key usage type in OPTIGA. More... | |
typedef enum optiga_set_obj_protected_tag | optiga_set_obj_protected_tag_t |
Specifies the set protected object tag. More... | |
typedef enum optiga_ecc_curve | optiga_ecc_curve_t |
Specifies the key curve type in OPTIGA. More... | |
typedef enum optiga_rsa_encryption_scheme | optiga_rsa_encryption_scheme_t |
Specifies the RSA encryption schemes. More... | |
typedef enum optiga_rsa_key_type | optiga_rsa_key_type_t |
Specifies the RSA key type in OPTIGA. More... | |
typedef enum optiga_rsa_signature_scheme | optiga_rsa_signature_scheme_t |
Specifies the RSA signature schemes type in OPTIGA. More... | |
typedef enum optiga_symmetric_encryption_mode | optiga_symmetric_encryption_mode_t |
Specifies the symmetric encryption schemes type in OPTIGA. More... | |
typedef enum optiga_hash_type | optiga_hash_type_t |
Specifies the hashing algorithm type in OPTIGA. More... | |
typedef enum optiga_hash_context_length | optiga_hash_context_length_t |
Specifies the hash context length in bytes. More... | |
typedef enum optiga_rng_type | optiga_rng_type_t |
Specifies the random generation types. More... | |
typedef enum optiga_hmac_type | optiga_hmac_type_t |
Specifies the HMAC generation types in OPTIGA. More... | |
typedef enum optiga_hkdf_type | optiga_hkdf_type_t |
Specifies the HKDF key derivation types in OPTIGA. More... | |
typedef enum optiga_tls_prf_type | optiga_tls_prf_type_t |
Specifies the key derivation types. More... | |
typedef enum optiga_symmetric_key_type | optiga_symmetric_key_type_t |
Specifies the symmetric key types supported by OPTIGA. More... | |
typedef struct optiga_hash_context | optiga_hash_context_t |
Specifies the structure to the Hash context details managed by OPTIGA. More... | |
typedef struct hash_data_from_host | hash_data_from_host_t |
Specifies the structure to provide the details of data to be hashed from host. More... | |
typedef struct hash_data_in_optiga | hash_data_in_optiga_t |
Specifies the structure to provide the details of data to be hashed from OPTIGA. More... | |
typedef struct public_key_from_host | public_key_from_host_t |
Specifies the data structure of the Public Key details (key, size and type) More... | |
typedef struct optiga_get_data_object | optiga_get_data_object_params_t |
Specifies the data structure for data to be read from OPTIGA. More... | |
typedef struct optiga_set_data_object | optiga_set_data_object_params_t |
Specifies the data structure for data to be written to OPTIGA. More... | |
typedef struct optiga_calc_hash | optiga_calc_hash_params_t |
Specifies the data structure of calculate hash. More... | |
typedef struct optiga_get_random | optiga_get_random_params_t |
Specifies the data structure of random generation. More... | |
typedef struct optiga_gen_keypair | optiga_gen_keypair_params_t |
Specifies the data structure for generate key pair. More... | |
typedef struct optiga_calc_sign | optiga_calc_sign_params_t |
Specifies the data structure for ECDSA signature. More... | |
typedef struct optiga_verify_sign | optiga_verify_sign_params_t |
Specifies the data structure for ECDSA signature verification. More... | |
typedef struct optiga_calc_ssec | optiga_calc_ssec_params_t |
Specifies the data structure for ecdh secret generation. More... | |
typedef struct optiga_derive_key | optiga_derive_key_params_t |
Specifies the structure for derivation of key using pseudo random function. More... | |
typedef struct optiga_enc_dec_asym | optiga_encrypt_asym_params_t |
Specifies the structure for asymmetric encryption and decryption. More... | |
typedef struct optiga_enc_dec_asym | optiga_decrypt_asym_params_t |
typedef struct optiga_set_object_protected_params | optiga_set_object_protected_params_t |
Specifies the data structure for protected update. More... | |
typedef struct optiga_symmetric_enc_dec_params | optiga_encrypt_sym_params_t |
Specifies the data structure for symmetric encrypt and decrypt. More... | |
typedef struct optiga_symmetric_enc_dec_params | optiga_decrypt_sym_params_t |
typedef struct optiga_gen_symkey_params | optiga_gen_symkey_params_t |
Specifies the data structure for symmetric generate key. More... | |
uint32_t | optiga_common_get_uint32 (const uint8_t *p_input_buffer) |
Prepares uint32 [Big endian] type value from the buffer and store. More... | |
void | optiga_common_set_uint16 (uint8_t *p_output_buffer, uint16_t two_byte_value) |
Copies 2 bytes of uint16 type value to the buffer. More... | |
void | optiga_common_set_uint32 (uint8_t *p_output_buffer, uint32_t four_byte_value) |
Copies 4 bytes of uint32 [Big endian] type value to the buffer and stores in the output pointer. More... | |
void | optiga_common_get_uint16 (const uint8_t *p_input_buffer, uint16_t *p_two_byte_value) |
Prepares uint16 [Big endian] type value from the buffer and stores in the output pointer. More... | |
This file provides the prototypes for the commonly used functions and structures of OPTIGA Library.
Definition in file optiga_lib_common.h.
#define OPTIGA_COMMS_COMMAND_PROTECTION (0x01) |
When command data is protected and response data is unprotected.
Definition at line 55 of file optiga_lib_common.h.
#define OPTIGA_COMMS_FULL_PROTECTION (0x03) |
Both command data and response data are protected.
Definition at line 59 of file optiga_lib_common.h.
#define OPTIGA_COMMS_NO_PROTECTION (0x00) |
When command data and response data is unprotected.
Definition at line 53 of file optiga_lib_common.h.
#define OPTIGA_COMMS_PROTOCOL_VERSION_PRE_SHARED_SECRET (0x01) |
Pre shared secret protocol version.
Definition at line 63 of file optiga_lib_common.h.
#define OPTIGA_COMMS_RE_ESTABLISH (0x80) |
Re-establish shielded connection.
Definition at line 61 of file optiga_lib_common.h.
#define OPTIGA_COMMS_RESPONSE_PROTECTION (0x02) |
When command data is unprotected and response data is protected.
Definition at line 57 of file optiga_lib_common.h.
#define OPTIGA_CRYPT_HOST_DATA (0x01) |
Data is provided by host.
Definition at line 66 of file optiga_lib_common.h.
#define OPTIGA_CRYPT_OID_DATA (0x00) |
Data in internal to optiga OID.
Definition at line 68 of file optiga_lib_common.h.
#define OPTIGA_INSTANCE_ID_0 (0x00) |
Instance id of OPTIGA slave.
Definition at line 50 of file optiga_lib_common.h.
#define OPTIGA_LIB_INSTANCE_BUSY (0x0001) |
OPTIGA instance is busy.
Definition at line 71 of file optiga_lib_common.h.
#define OPTIGA_LIB_INSTANCE_FREE (0x0000) |
OPTIGA instance is free.
Definition at line 73 of file optiga_lib_common.h.
typedef struct hash_data_from_host hash_data_from_host_t |
Specifies the structure to provide the details of data to be hashed from host.
typedef struct hash_data_in_optiga hash_data_in_optiga_t |
Specifies the structure to provide the details of data to be hashed from OPTIGA.
typedef struct optiga_calc_hash optiga_calc_hash_params_t |
Specifies the data structure of calculate hash.
typedef struct optiga_calc_sign optiga_calc_sign_params_t |
Specifies the data structure for ECDSA signature.
typedef struct optiga_calc_ssec optiga_calc_ssec_params_t |
Specifies the data structure for ecdh secret generation.
typedef struct optiga_enc_dec_asym optiga_decrypt_asym_params_t |
typedef struct optiga_symmetric_enc_dec_params optiga_decrypt_sym_params_t |
typedef struct optiga_derive_key optiga_derive_key_params_t |
Specifies the structure for derivation of key using pseudo random function.
typedef enum optiga_ecc_curve optiga_ecc_curve_t |
Specifies the key curve type in OPTIGA.
typedef struct optiga_enc_dec_asym optiga_encrypt_asym_params_t |
Specifies the structure for asymmetric encryption and decryption.
typedef struct optiga_symmetric_enc_dec_params optiga_encrypt_sym_params_t |
Specifies the data structure for symmetric encrypt and decrypt.
typedef struct optiga_gen_keypair optiga_gen_keypair_params_t |
Specifies the data structure for generate key pair.
typedef struct optiga_gen_symkey_params optiga_gen_symkey_params_t |
Specifies the data structure for symmetric generate key.
typedef struct optiga_get_data_object optiga_get_data_object_params_t |
Specifies the data structure for data to be read from OPTIGA.
typedef struct optiga_get_random optiga_get_random_params_t |
Specifies the data structure of random generation.
typedef enum optiga_hash_context_length optiga_hash_context_length_t |
Specifies the hash context length in bytes.
typedef struct optiga_hash_context optiga_hash_context_t |
Specifies the structure to the Hash context details managed by OPTIGA.
typedef enum optiga_hash_type optiga_hash_type_t |
Specifies the hashing algorithm type in OPTIGA.
typedef enum optiga_hkdf_type optiga_hkdf_type_t |
Specifies the HKDF key derivation types in OPTIGA.
typedef enum optiga_hmac_type optiga_hmac_type_t |
Specifies the HMAC generation types in OPTIGA.
typedef enum optiga_key_id optiga_key_id_t |
Specifies the key location in OPTIGA.
typedef enum optiga_key_usage optiga_key_usage_t |
Specifies the key usage type in OPTIGA.
typedef enum optiga_rng_type optiga_rng_type_t |
Specifies the random generation types.
Specifies the RSA encryption schemes.
typedef enum optiga_rsa_key_type optiga_rsa_key_type_t |
Specifies the RSA key type in OPTIGA.
typedef enum optiga_rsa_signature_scheme optiga_rsa_signature_scheme_t |
Specifies the RSA signature schemes type in OPTIGA.
typedef struct optiga_set_data_object optiga_set_data_object_params_t |
Specifies the data structure for data to be written to OPTIGA.
Specifies the set protected object tag.
Specifies the data structure for protected update.
Specifies the symmetric encryption schemes type in OPTIGA.
typedef enum optiga_symmetric_key_type optiga_symmetric_key_type_t |
Specifies the symmetric key types supported by OPTIGA.
typedef enum optiga_tls_prf_type optiga_tls_prf_type_t |
Specifies the key derivation types.
typedef struct optiga_verify_sign optiga_verify_sign_params_t |
Specifies the data structure for ECDSA signature verification.
typedef struct public_key_from_host public_key_from_host_t |
Specifies the data structure of the Public Key details (key, size and type)
enum optiga_ecc_curve |
Specifies the key curve type in OPTIGA.
Definition at line 138 of file optiga_lib_common.h.
Specifies the hash context length in bytes.
Enumerator | |
---|---|
OPTIGA_HASH_CONTEXT_LENGTH_SHA_256 | Hash context length (in bytes) in case of SHA256. |
Definition at line 224 of file optiga_lib_common.h.
enum optiga_hash_type |
Specifies the hashing algorithm type in OPTIGA.
Enumerator | |
---|---|
OPTIGA_HASH_TYPE_SHA_256 | Hash algorithm type SHA256. |
Definition at line 215 of file optiga_lib_common.h.
enum optiga_hkdf_type |
Specifies the HKDF key derivation types in OPTIGA.
Enumerator | |
---|---|
OPTIGA_HKDF_SHA_256 | Key derivation using HKDF-SHA256. |
OPTIGA_HKDF_SHA_384 | Key derivation using HKDF-SHA384. |
OPTIGA_HKDF_SHA_512 | Key derivation using HKDF-SHA512. |
Definition at line 260 of file optiga_lib_common.h.
enum optiga_hmac_type |
Specifies the HMAC generation types in OPTIGA.
Enumerator | |
---|---|
OPTIGA_HMAC_SHA_256 | Generated MAC using HMAC-SHA256. |
OPTIGA_HMAC_SHA_384 | Generated MAC using HMAC-SHA384. |
OPTIGA_HMAC_SHA_512 | Generated MAC using HMAC-SHA512. |
Definition at line 245 of file optiga_lib_common.h.
enum optiga_key_id |
Specifies the key location in OPTIGA.
Definition at line 85 of file optiga_lib_common.h.
enum optiga_key_usage |
Specifies the key usage type in OPTIGA.
Definition at line 110 of file optiga_lib_common.h.
enum optiga_rng_type |
Specifies the random generation types.
Enumerator | |
---|---|
OPTIGA_RNG_TYPE_TRNG | Generate Random data using TRNG. |
OPTIGA_RNG_TYPE_DRNG | Generate Random data using DRNG. |
Definition at line 233 of file optiga_lib_common.h.
Specifies the RSA encryption schemes.
Enumerator | |
---|---|
OPTIGA_RSAES_PKCS1_V15 | RSA PKCS1 v1.5 encryption scheme. |
Definition at line 161 of file optiga_lib_common.h.
enum optiga_rsa_key_type |
Specifies the RSA key type in OPTIGA.
Enumerator | |
---|---|
OPTIGA_RSA_KEY_1024_BIT_EXPONENTIAL | Generate 1024 bit RSA key. |
OPTIGA_RSA_KEY_2048_BIT_EXPONENTIAL | Generate 2048 bit RSA key. |
Definition at line 170 of file optiga_lib_common.h.
Specifies the RSA signature schemes type in OPTIGA.
Definition at line 182 of file optiga_lib_common.h.
Specifies the set protected object tag.
Definition at line 125 of file optiga_lib_common.h.
Specifies the symmetric encryption schemes type in OPTIGA.
Definition at line 199 of file optiga_lib_common.h.
Specifies the symmetric key types supported by OPTIGA.
Enumerator | |
---|---|
OPTIGA_SYMMETRIC_AES_128 | Symmetric key type of AES-128. |
OPTIGA_SYMMETRIC_AES_192 | Symmetric key type of AES-192. |
OPTIGA_SYMMETRIC_AES_256 | Symmetric key type of AES-256. |
Definition at line 292 of file optiga_lib_common.h.
enum optiga_tls_prf_type |
Specifies the key derivation types.
Definition at line 274 of file optiga_lib_common.h.
void optiga_common_get_uint16 | ( | const uint8_t * | p_input_buffer, |
uint16_t * | p_two_byte_value | ||
) |
Prepares uint16 [Big endian] type value from the buffer and stores in the output pointer.
Prepares uint16 [Big endian] type value from the buffer and store
[in] | p_input_buffer | Pointer to the buffer |
[in,out] | p_two_byte_value | Pointer to the value tobe assigne |
uint32_t optiga_common_get_uint32 | ( | const uint8_t * | p_input_buffer | ) |
Prepares uint32 [Big endian] type value from the buffer and store.
Prepares uint32 [Big endian] type value from the buffer and store
[in] | p_input_buffer | Pointer to the buffer |
return | 32 bit value |
void optiga_common_set_uint16 | ( | uint8_t * | p_output_buffer, |
uint16_t | two_byte_value | ||
) |
Copies 2 bytes of uint16 type value to the buffer.
Copies 2 bytes of uint16 type value to the buffer
[in,out] | p_output_buffer | Pointer to the buffer |
[in] | two_byte_value | 16 bit value |
void optiga_common_set_uint32 | ( | uint8_t * | p_output_buffer, |
uint32_t | four_byte_value | ||
) |
Copies 4 bytes of uint32 [Big endian] type value to the buffer and stores in the output pointer.
Copies 4 bytes of uint32 [Big endian] type value to the buffer and store
[in,out] | p_output_buffer | Pointer to the buffer |
[in] | four_byte_value | 32 bit value |