OPTIGA™ Trust M
Host Library Documentation
optiga_lib_common.h
Go to the documentation of this file.
1 
38 #ifndef _OPTIGA_LIB_COMMON_H_
39 #define _OPTIGA_LIB_COMMON_H_
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
48 
50 #define OPTIGA_INSTANCE_ID_0 (0x00)
51 
53 #define OPTIGA_COMMS_NO_PROTECTION (0x00)
54 
55 #define OPTIGA_COMMS_COMMAND_PROTECTION (0x01)
56 
57 #define OPTIGA_COMMS_RESPONSE_PROTECTION (0x02)
58 
59 #define OPTIGA_COMMS_FULL_PROTECTION (0x03)
60 
61 #define OPTIGA_COMMS_RE_ESTABLISH (0x80)
62 
63 #define OPTIGA_COMMS_PROTOCOL_VERSION_PRE_SHARED_SECRET (0x01)
64 
66 #define OPTIGA_CRYPT_HOST_DATA (0x01)
67 
68 #define OPTIGA_CRYPT_OID_DATA (0x00)
69 
71 #define OPTIGA_LIB_INSTANCE_BUSY (0x0001)
72 
73 #define OPTIGA_LIB_INSTANCE_FREE (0x0000)
74 
75 #ifdef OPTIGA_COMMS_SHIELDED_CONNECTION
76 
77 #define OPTIGA_COMMS_PROTECTION_LEVEL (0x01)
78 
79 #define OPTIGA_COMMS_PROTOCOL_VERSION (0x02)
80 #endif
81 
85 typedef enum optiga_key_id
86 {
101 #ifdef OPTIGA_CRYPT_SYM_GENERATE_KEY_ENABLED
104 #endif
106 
110 typedef enum optiga_key_usage
111 {
121 
126 {
134 
138 typedef enum optiga_ecc_curve
139 {
144 #ifdef OPTIGA_CRYPT_ECC_NIST_P_521_ENABLED
147 #endif
148 #ifdef OPTIGA_CRYPT_ECC_BRAINPOOL_P_R1_ENABLED
155 #endif
157 
162 {
166 
171 {
177 
178 
183 {
188 #ifdef OPTIGA_CRYPT_RSA_SSA_SHA512_ENABLED
191 #endif
193 
194 #if defined (OPTIGA_CRYPT_SYM_ENCRYPT_ENABLED) || defined (OPTIGA_CRYPT_SYM_DECRYPT_ENABLED) || \
195 defined (OPTIGA_CRYPT_HMAC_ENABLED) || defined (OPTIGA_CRYPT_HMAC_VERIFY_ENABLED)
196 
200 {
208  OPTIGA_SYMMETRIC_CMAC = 0x0B
210 #endif
211 
215 typedef enum optiga_hash_type
216 {
220 
225 {
229 
233 typedef enum optiga_rng_type
234 {
238  OPTIGA_RNG_TYPE_DRNG = 0x01
240 
241 #ifdef OPTIGA_CRYPT_HMAC_ENABLED
242 
245 typedef enum optiga_hmac_type
246 {
252  OPTIGA_HMAC_SHA_512 = 0x22
254 #endif
255 
256 #ifdef OPTIGA_CRYPT_HKDF_ENABLED
257 
260 typedef enum optiga_hkdf_type
261 {
267  OPTIGA_HKDF_SHA_512 = 0x0A
269 #endif
270 
275 {
278 #ifdef OPTIGA_CRYPT_TLS_PRF_SHA384_ENABLED
281 #endif
282 #ifdef OPTIGA_CRYPT_TLS_PRF_SHA512_ENABLED
285 #endif
287 
288 #ifdef OPTIGA_CRYPT_SYM_GENERATE_KEY_ENABLED
289 
293 {
301 #endif
302 
305 typedef struct optiga_hash_context
306 {
308  uint8_t *context_buffer;
312  uint8_t hash_algo;
314 
318 typedef struct hash_data_from_host
319 {
321  const uint8_t * buffer;
323  uint32_t length;
325 
329 typedef struct hash_data_in_optiga
330 {
332  uint16_t oid;
334  uint16_t offset;
336  uint16_t length;
338 
342 typedef struct public_key_from_host
343 {
345  uint8_t * public_key;
347  uint16_t length;
349  uint8_t key_type;
351 
356 {
358  uint16_t oid;
360  uint16_t offset;
362  uint16_t bytes_to_read;
366  uint16_t last_read_size;
370  uint16_t * ref_bytes_to_read;
372  uint8_t * buffer;
374 
379 {
381  uint16_t oid;
383  uint16_t offset;
385  uint16_t size;
387  uint16_t written_size;
389  const uint8_t * buffer;
393  uint8_t write_type;
395  uint8_t count;
397 
401 typedef struct optiga_calc_hash
402 {
410  uint8_t hash_sequence;
414  uint32_t data_sent;
416  uint8_t * p_out_digest;
422 
423 
427 typedef struct optiga_get_random
428 {
434  uint8_t * random_data;
436  const uint8_t * optional_data;
440 
441 
445 typedef struct optiga_gen_keypair
446 {
448  uint8_t key_usage;
454  uint8_t * private_key;
456  uint16_t * private_key_length;
458  uint8_t * public_key;
460  uint16_t * public_key_length;
462 
466 typedef struct optiga_calc_sign
467 {
469  const uint8_t * p_digest;
471  uint8_t * p_signature;
473  uint16_t * p_signature_length;
477  uint8_t digest_length;
479 
483 typedef struct optiga_verify_sign
484 {
486  const uint8_t * p_digest;
488  uint8_t digest_length;
490  const uint8_t * p_signature;
498  uint16_t certificate_oid;
500 
504 typedef struct optiga_calc_ssec
505 {
509  uint8_t * shared_secret;
513  uint8_t export_to_host;
515 
519 typedef struct optiga_derive_key
520 {
522  const uint8_t * random_data;
524  const uint8_t * label;
526  const uint8_t * info;
528  uint8_t * derived_key;
534  uint16_t label_length;
536  uint16_t info_length;
540 
541 #if defined (OPTIGA_CRYPT_RSA_ENCRYPT_ENABLED) || defined (OPTIGA_CRYPT_RSA_DECRYPT_ENABLED)
542 
545 typedef struct optiga_enc_dec_asym
546 {
548  uint16_t message_length;
552  const uint8_t * message;
556  const void * key;
558  uint8_t * processed_message;
562 #endif
563 
568 {
570  const uint8_t * p_protected_update_buffer;
578 
579 #if defined (OPTIGA_CRYPT_SYM_ENCRYPT_ENABLED) || defined (OPTIGA_CRYPT_SYM_DECRYPT_ENABLED)
580 
584 {
588  const uint8_t * in_data;
590  uint32_t in_data_length;
592  const uint8_t * iv;
594  uint16_t iv_length;
596  const uint8_t * associated_data;
600  uint8_t * out_data;
602  uint32_t * out_data_length;
604  const uint8_t * generated_hmac;
618  uint8_t mode;
620  uint8_t operation_mode;
622 #endif
623 #ifdef OPTIGA_CRYPT_SYM_GENERATE_KEY_ENABLED
624 
628 {
630  uint8_t key_usage;
636 #endif
637 
655 uint32_t optiga_common_get_uint32(const uint8_t* p_input_buffer);
656 
674 void optiga_common_set_uint16(uint8_t * p_output_buffer,
675  uint16_t two_byte_value);
676 
694 void optiga_common_set_uint32(uint8_t* p_output_buffer,
695  uint32_t four_byte_value);
696 
714 void optiga_common_get_uint16(const uint8_t * p_input_buffer,
715  uint16_t* p_two_byte_value);
716 
717 #ifdef __cplusplus
718 }
719 #endif
720 
721 #endif /*_OPTIGA_LIB_COMMON_H_ */
722 
optiga_calc_ssec
Specifies the data structure for ecdh secret generation.
Definition: optiga_lib_common.h:505
optiga_symmetric_enc_dec_params
Specifies the data structure for symmetric encrypt and decrypt.
Definition: optiga_lib_common.h:584
optiga_calc_hash::export_hash_ctx
bool_t export_hash_ctx
export hash ctx
Definition: optiga_lib_common.h:418
optiga_lib_config.h
This file is defines the compilation switches to build code with required features.
optiga_derive_key::label_length
uint16_t label_length
Label length.
Definition: optiga_lib_common.h:534
optiga_key_usage_t
enum optiga_key_usage optiga_key_usage_t
Specifies the key usage type in OPTIGA.
optiga_calc_hash::p_hash_context
optiga_hash_context_t * p_hash_context
Context buffer pointer.
Definition: optiga_lib_common.h:408
optiga_get_data_object::bytes_to_read
uint16_t bytes_to_read
Data size to be read.
Definition: optiga_lib_common.h:362
OPTIGA_RNG_TYPE_DRNG
@ OPTIGA_RNG_TYPE_DRNG
Generate Random data using DRNG.
Definition: optiga_lib_common.h:238
optiga_derive_key::random_data
const uint8_t * random_data
Random Seed/Salt.
Definition: optiga_lib_common.h:522
optiga_set_object_protected_params::p_protected_update_buffer
const uint8_t * p_protected_update_buffer
Pointer to the buffer which contains manifest/fragment.
Definition: optiga_lib_common.h:570
optiga_derive_key::derived_key_length
uint16_t derived_key_length
Derived Key length.
Definition: optiga_lib_common.h:538
optiga_get_random::store_in_session
bool_t store_in_session
Use to indicate to acquire session.
Definition: optiga_lib_common.h:438
OPTIGA_ECC_CURVE_NIST_P_384
@ OPTIGA_ECC_CURVE_NIST_P_384
Generate elliptic curve key based on NIST P384.
Definition: optiga_lib_common.h:143
optiga_symmetric_enc_dec_params::received_data_length
uint32_t received_data_length
Length of received data.
Definition: optiga_lib_common.h:612
optiga_get_random::random_data
uint8_t * random_data
User buffer for storing random data.
Definition: optiga_lib_common.h:434
optiga_symmetric_encryption_mode
optiga_symmetric_encryption_mode
Specifies the symmetric encryption schemes type in OPTIGA.
Definition: optiga_lib_common.h:200
optiga_lib_return_codes.h
This file defines the error codes for the all the layers and modules. OPTIGA host library return val...
optiga_rsa_key_type_t
enum optiga_rsa_key_type optiga_rsa_key_type_t
Specifies the RSA key type in OPTIGA.
optiga_calc_sign_params_t
struct optiga_calc_sign optiga_calc_sign_params_t
Specifies the data structure for ECDSA signature.
OPTIGA_ECC_CURVE_BRAIN_POOL_P_384R1
@ OPTIGA_ECC_CURVE_BRAIN_POOL_P_384R1
Generate elliptic curve key based on ECC Brainpool 384R1.
Definition: optiga_lib_common.h:152
optiga_set_data_object::written_size
uint16_t written_size
Contains length of data written in across multiple transceive calls. Used for chaining purpose.
Definition: optiga_lib_common.h:387
optiga_rsa_signature_scheme_t
enum optiga_rsa_signature_scheme optiga_rsa_signature_scheme_t
Specifies the RSA signature schemes type in OPTIGA.
optiga_set_data_object_params_t
struct optiga_set_data_object optiga_set_data_object_params_t
Specifies the data structure for data to be written to OPTIGA.
optiga_verify_sign::digest_length
uint8_t digest_length
Digest data length.
Definition: optiga_lib_common.h:488
optiga_get_data_object::accumulated_size
uint16_t accumulated_size
Contains length of data received in across multiple transceive calls. Used for chaining purpose.
Definition: optiga_lib_common.h:364
OPTIGA_HKDF_SHA_384
@ OPTIGA_HKDF_SHA_384
Key derivation using HKDF-SHA384.
Definition: optiga_lib_common.h:265
OPTIGA_HMAC_SHA_512
@ OPTIGA_HMAC_SHA_512
Generated MAC using HMAC-SHA512.
Definition: optiga_lib_common.h:252
optiga_set_obj_protected_tag
optiga_set_obj_protected_tag
Specifies the set protected object tag.
Definition: optiga_lib_common.h:126
optiga_hkdf_type_t
enum optiga_hkdf_type optiga_hkdf_type_t
Specifies the HKDF key derivation types in OPTIGA.
optiga_calc_ssec::private_key
optiga_key_id_t private_key
OID of the Private Key (either Key store or Session based). Refer optiga_key_id_t for possible values...
Definition: optiga_lib_common.h:511
optiga_set_data_object
Specifies the data structure for data to be written to OPTIGA.
Definition: optiga_lib_common.h:379
optiga_calc_hash::p_hash_oid
hash_data_in_optiga_t * p_hash_oid
OID hash pointer.
Definition: optiga_lib_common.h:404
optiga_get_random::random_data_length
uint16_t random_data_length
Random data length.
Definition: optiga_lib_common.h:430
optiga_get_data_object
Specifies the data structure for data to be read from OPTIGA.
Definition: optiga_lib_common.h:356
optiga_calc_sign::p_signature
uint8_t * p_signature
Signature buffer pointer.
Definition: optiga_lib_common.h:471
optiga_symmetric_encryption_mode_t
enum optiga_symmetric_encryption_mode optiga_symmetric_encryption_mode_t
Specifies the symmetric encryption schemes type in OPTIGA.
OPTIGA_SYMMETRIC_CBC_MAC
@ OPTIGA_SYMMETRIC_CBC_MAC
Symmetric encryption mode with CBC_MAC mode.
Definition: optiga_lib_common.h:206
OPTIGA_SET_PROTECTED_UPDATE_CONTINUE
@ OPTIGA_SET_PROTECTED_UPDATE_CONTINUE
This enables to continue of the protected update.
Definition: optiga_lib_common.h:130
optiga_hash_context::context_buffer
uint8_t * context_buffer
buffer to hold the hash context data
Definition: optiga_lib_common.h:308
hash_data_in_optiga
Specifies the structure to provide the details of data to be hashed from OPTIGA.
Definition: optiga_lib_common.h:330
optiga_rsa_key_type
optiga_rsa_key_type
Specifies the RSA key type in OPTIGA.
Definition: optiga_lib_common.h:171
optiga_hmac_type
optiga_hmac_type
Specifies the HMAC generation types in OPTIGA.
Definition: optiga_lib_common.h:246
OPTIGA_HMAC_SHA_384
@ OPTIGA_HMAC_SHA_384
Generated MAC using HMAC-SHA384.
Definition: optiga_lib_common.h:250
OPTIGA_HASH_TYPE_SHA_256
@ OPTIGA_HASH_TYPE_SHA_256
Hash algorithm type SHA256.
Definition: optiga_lib_common.h:218
optiga_calc_ssec_params_t
struct optiga_calc_ssec optiga_calc_ssec_params_t
Specifies the data structure for ecdh secret generation.
optiga_enc_dec_asym::key
const void * key
Public key provided by host.
Definition: optiga_lib_common.h:556
optiga_enc_dec_asym::message_length
uint16_t message_length
Length of message to be encrypted. Set 0 if data from session OID.
Definition: optiga_lib_common.h:548
optiga_derive_key::derived_key
uint8_t * derived_key
Pointer to a buffer where the exported key to be stored.
Definition: optiga_lib_common.h:528
OPTIGA_RSASSA_PKCS1_V15_SHA256
@ OPTIGA_RSASSA_PKCS1_V15_SHA256
Signature schemes RSA SSA PKCS1-v1.5 with SHA256 digest.
Definition: optiga_lib_common.h:185
optiga_set_data_object::oid
uint16_t oid
Object ID to be written.
Definition: optiga_lib_common.h:381
optiga_hash_context_length
optiga_hash_context_length
Specifies the hash context length in bytes.
Definition: optiga_lib_common.h:225
optiga_hash_context
Specifies the structure to the Hash context details managed by OPTIGA.
Definition: optiga_lib_common.h:306
optiga_symmetric_enc_dec_params::associated_data
const uint8_t * associated_data
Pointer to associated data.
Definition: optiga_lib_common.h:596
OPTIGA_ECC_CURVE_NIST_P_256
@ OPTIGA_ECC_CURVE_NIST_P_256
Generate elliptic curve key based on NIST P256.
Definition: optiga_lib_common.h:141
optiga_calc_ssec::public_key
public_key_from_host_t * public_key
Public Key of the peer.
Definition: optiga_lib_common.h:507
optiga_symmetric_enc_dec_params::generated_hmac
const uint8_t * generated_hmac
Pointer to generated hmac.
Definition: optiga_lib_common.h:604
optiga_get_random
Specifies the data structure of random generation.
Definition: optiga_lib_common.h:428
OPTIGA_KEY_ID_E0FC
@ OPTIGA_KEY_ID_E0FC
Key from key store for RSA (non-volatile)
Definition: optiga_lib_common.h:96
optiga_calc_sign::private_key_oid
optiga_key_id_t private_key_oid
OID of the Private Key (either Key store or Session based). Refer optiga_key_id_t for possible values...
Definition: optiga_lib_common.h:475
optiga_hash_context::context_buffer_length
uint16_t context_buffer_length
context length
Definition: optiga_lib_common.h:310
optiga_key_usage
optiga_key_usage
Specifies the key usage type in OPTIGA.
Definition: optiga_lib_common.h:111
optiga_set_data_object::count
uint8_t count
Count value.
Definition: optiga_lib_common.h:395
OPTIGA_SYMMETRIC_AES_256
@ OPTIGA_SYMMETRIC_AES_256
Symmetric key type of AES-256.
Definition: optiga_lib_common.h:299
optiga_get_random_params_t
struct optiga_get_random optiga_get_random_params_t
Specifies the data structure of random generation.
optiga_get_data_object_params_t
struct optiga_get_data_object optiga_get_data_object_params_t
Specifies the data structure for data to be read from OPTIGA.
optiga_lib_types.h
This file contains the type definitions for the fundamental data types.
optiga_enc_dec_asym::message
const uint8_t * message
Message to be encrypted. Set NULL if data from session OID.
Definition: optiga_lib_common.h:552
optiga_symmetric_key_type
optiga_symmetric_key_type
Specifies the symmetric key types supported by OPTIGA.
Definition: optiga_lib_common.h:293
optiga_ecc_curve_t
enum optiga_ecc_curve optiga_ecc_curve_t
Specifies the key curve type in OPTIGA.
public_key_from_host::key_type
uint8_t key_type
Public key type details. For ECC key use optiga_ecc_curve_t and for RSA key use optiga_rsa_key_type_t...
Definition: optiga_lib_common.h:349
optiga_rsa_encryption_scheme
optiga_rsa_encryption_scheme
Specifies the RSA encryption schemes.
Definition: optiga_lib_common.h:162
optiga_get_data_object::oid
uint16_t oid
Object ID to be read.
Definition: optiga_lib_common.h:358
optiga_hash_type_t
enum optiga_hash_type optiga_hash_type_t
Specifies the hashing algorithm type in OPTIGA.
optiga_set_data_object::size
uint16_t size
Write data size.
Definition: optiga_lib_common.h:385
OPTIGA_SYMMETRIC_CBC
@ OPTIGA_SYMMETRIC_CBC
Symmetric encryption mode with CBC mode.
Definition: optiga_lib_common.h:204
public_key_from_host::length
uint16_t length
Length of public key buffer.
Definition: optiga_lib_common.h:347
optiga_calc_hash::data_sent
uint32_t data_sent
Data length has been sent.
Definition: optiga_lib_common.h:414
optiga_calc_hash::apparent_context_size
uint32_t apparent_context_size
Possible context size to send in a fragment.
Definition: optiga_lib_common.h:420
optiga_decrypt_asym_params_t
struct optiga_enc_dec_asym optiga_decrypt_asym_params_t
optiga_verify_sign::p_digest
const uint8_t * p_digest
Digest buffer pointer.
Definition: optiga_lib_common.h:486
optiga_symmetric_enc_dec_params::current_sequence
uint8_t current_sequence
Variable to store current encrypt decrypt sequence.
Definition: optiga_lib_common.h:608
optiga_gen_symkey_params
Specifies the data structure for symmetric generate key.
Definition: optiga_lib_common.h:628
public_key_from_host
Specifies the data structure of the Public Key details (key, size and type)
Definition: optiga_lib_common.h:343
optiga_get_random::optional_data_length
uint16_t optional_data_length
Optional data length.
Definition: optiga_lib_common.h:432
optiga_symmetric_enc_dec_params::operation_mode
uint8_t operation_mode
Symmetric mode of operation.
Definition: optiga_lib_common.h:620
optiga_symmetric_enc_dec_params::total_input_data_length
uint16_t total_input_data_length
Variable to indicate complete input data length required for CCM.
Definition: optiga_lib_common.h:614
optiga_derive_key::input_shared_secret_oid
uint16_t input_shared_secret_oid
Session based (optiga_key_id_t) or Data object which has the pre-shared secret.
Definition: optiga_lib_common.h:530
optiga_symmetric_enc_dec_params::mode
uint8_t mode
Encryption or hmac mode.
Definition: optiga_lib_common.h:618
OPTIGA_KEY_ID_E0F1
@ OPTIGA_KEY_ID_E0F1
Key from key store (non-volatile)
Definition: optiga_lib_common.h:90
OPTIGA_TLS12_PRF_SHA_256
@ OPTIGA_TLS12_PRF_SHA_256
Key derivation using TLSv1.2 PRF SHA256.
Definition: optiga_lib_common.h:277
optiga_calc_hash::p_out_digest
uint8_t * p_out_digest
Out digest.
Definition: optiga_lib_common.h:416
optiga_tls_prf_type_t
enum optiga_tls_prf_type optiga_tls_prf_type_t
Specifies the key derivation types.
optiga_gen_symkey_params::symmetric_key
void * symmetric_key
Symmetric key buffer pointer or oid pointer.
Definition: optiga_lib_common.h:634
optiga_gen_keypair::private_key
uint8_t * private_key
Private key buffer pointer.
Definition: optiga_lib_common.h:454
optiga_gen_symkey_params::export_symmetric_key
bool_t export_symmetric_key
Symmetric key export option.
Definition: optiga_lib_common.h:632
OPTIGA_SYMMETRIC_AES_192
@ OPTIGA_SYMMETRIC_AES_192
Symmetric key type of AES-192.
Definition: optiga_lib_common.h:297
optiga_symmetric_enc_dec_params::associated_data_length
uint16_t associated_data_length
Length of associated data.
Definition: optiga_lib_common.h:598
optiga_gen_keypair::export_private_key
bool_t export_private_key
Private key export option.
Definition: optiga_lib_common.h:450
optiga_symmetric_enc_dec_params::generated_hmac_length
uint32_t generated_hmac_length
Length of generated hmac.
Definition: optiga_lib_common.h:616
hash_data_in_optiga::offset
uint16_t offset
Offset within the data object.
Definition: optiga_lib_common.h:334
hash_data_in_optiga_t
struct hash_data_in_optiga hash_data_in_optiga_t
Specifies the structure to provide the details of data to be hashed from OPTIGA.
optiga_calc_hash::p_hash_data
hash_data_from_host_t * p_hash_data
Data buffer pointer.
Definition: optiga_lib_common.h:406
optiga_set_data_object::offset
uint16_t offset
Offset of data with the object ID.
Definition: optiga_lib_common.h:383
optiga_verify_sign_params_t
struct optiga_verify_sign optiga_verify_sign_params_t
Specifies the data structure for ECDSA signature verification.
public_key_from_host_t
struct public_key_from_host public_key_from_host_t
Specifies the data structure of the Public Key details (key, size and type)
optiga_get_data_object::buffer
uint8_t * buffer
Read data buffer pointer.
Definition: optiga_lib_common.h:372
optiga_hash_type
optiga_hash_type
Specifies the hashing algorithm type in OPTIGA.
Definition: optiga_lib_common.h:216
optiga_calc_ssec::export_to_host
uint8_t export_to_host
Export to Host (store in OPTIGA Session or export to host)
Definition: optiga_lib_common.h:513
optiga_verify_sign::public_key_source_type
uint8_t public_key_source_type
Source of provided public key.
Definition: optiga_lib_common.h:494
optiga_gen_keypair::private_key_oid
optiga_key_id_t private_key_oid
Type of public key OID.
Definition: optiga_lib_common.h:452
optiga_rsa_encryption_scheme_t
enum optiga_rsa_encryption_scheme optiga_rsa_encryption_scheme_t
Specifies the RSA encryption schemes.
optiga_get_data_object::data_or_metadata
uint8_t data_or_metadata
Read to data or metadata.
Definition: optiga_lib_common.h:368
optiga_common_get_uint32
uint32_t optiga_common_get_uint32(const uint8_t *p_input_buffer)
Prepares uint32 [Big endian] type value from the buffer and store.
optiga_rng_type_t
enum optiga_rng_type optiga_rng_type_t
Specifies the random generation types.
optiga_calc_hash
Specifies the data structure of calculate hash.
Definition: optiga_lib_common.h:402
OPTIGA_RNG_TYPE_TRNG
@ OPTIGA_RNG_TYPE_TRNG
Generate Random data using TRNG.
Definition: optiga_lib_common.h:236
OPTIGA_ECC_CURVE_NIST_P_521
@ OPTIGA_ECC_CURVE_NIST_P_521
Generate elliptic curve key based on ECC NIST P521.
Definition: optiga_lib_common.h:146
optiga_enc_dec_asym::processed_message_length
uint16_t * processed_message_length
Pointer to the length of the encrypted or decrypted message.
Definition: optiga_lib_common.h:550
OPTIGA_HKDF_SHA_256
@ OPTIGA_HKDF_SHA_256
Key derivation using HKDF-SHA256.
Definition: optiga_lib_common.h:263
optiga_set_data_object::data_or_metadata
uint8_t data_or_metadata
Write to data or metadata.
Definition: optiga_lib_common.h:391
OPTIGA_TLS12_PRF_SHA_512
@ OPTIGA_TLS12_PRF_SHA_512
Key derivation using TLSv1.2 PRF SHA512.
Definition: optiga_lib_common.h:284
optiga_set_object_protected_params::manifest_version
uint8_t manifest_version
manifest version
Definition: optiga_lib_common.h:576
optiga_gen_symkey_params::key_usage
uint8_t key_usage
Key usage type.
Definition: optiga_lib_common.h:630
optiga_hash_context_length_t
enum optiga_hash_context_length optiga_hash_context_length_t
Specifies the hash context length in bytes.
OPTIGA_KEY_USAGE_AUTHENTICATION
@ OPTIGA_KEY_USAGE_AUTHENTICATION
This enables the private key for the signature generation as part of authentication commands.
Definition: optiga_lib_common.h:113
hash_data_from_host::buffer
const uint8_t * buffer
data to hash
Definition: optiga_lib_common.h:321
OPTIGA_KEY_ID_SESSION_BASED
@ OPTIGA_KEY_ID_SESSION_BASED
Key from session (volatile)
Definition: optiga_lib_common.h:100
optiga_key_id
optiga_key_id
Specifies the key location in OPTIGA.
Definition: optiga_lib_common.h:86
optiga_get_data_object::offset
uint16_t offset
Offset of data with the object ID.
Definition: optiga_lib_common.h:360
OPTIGA_ECC_CURVE_BRAIN_POOL_P_512R1
@ OPTIGA_ECC_CURVE_BRAIN_POOL_P_512R1
Generate elliptic curve key based on ECC Brainpool 512R1.
Definition: optiga_lib_common.h:154
optiga_get_data_object::last_read_size
uint16_t last_read_size
Contains the data length received in last transceive. Used for chaining purpose.
Definition: optiga_lib_common.h:366
optiga_gen_keypair::private_key_length
uint16_t * private_key_length
Private key length.
Definition: optiga_lib_common.h:456
optiga_encrypt_sym_params_t
struct optiga_symmetric_enc_dec_params optiga_encrypt_sym_params_t
Specifies the data structure for symmetric encrypt and decrypt.
optiga_hmac_type_t
enum optiga_hmac_type optiga_hmac_type_t
Specifies the HMAC generation types in OPTIGA.
optiga_symmetric_key_type_t
enum optiga_symmetric_key_type optiga_symmetric_key_type_t
Specifies the symmetric key types supported by OPTIGA.
OPTIGA_HMAC_SHA_256
@ OPTIGA_HMAC_SHA_256
Generated MAC using HMAC-SHA256.
Definition: optiga_lib_common.h:248
optiga_ecc_curve
optiga_ecc_curve
Specifies the key curve type in OPTIGA.
Definition: optiga_lib_common.h:139
optiga_derive_key::label
const uint8_t * label
Label input as a constant string.
Definition: optiga_lib_common.h:524
optiga_gen_keypair_params_t
struct optiga_gen_keypair optiga_gen_keypair_params_t
Specifies the data structure for generate key pair.
optiga_verify_sign
Specifies the data structure for ECDSA signature verification.
Definition: optiga_lib_common.h:484
optiga_key_id_t
enum optiga_key_id optiga_key_id_t
Specifies the key location in OPTIGA.
OPTIGA_KEY_USAGE_KEY_AGREEMENT
@ OPTIGA_KEY_USAGE_KEY_AGREEMENT
This enables the private key for key agreement (e.g. ecdh operations)
Definition: optiga_lib_common.h:117
optiga_derive_key::random_data_length
uint16_t random_data_length
Random Seed/Salt length.
Definition: optiga_lib_common.h:532
optiga_calc_hash::hash_sequence
uint8_t hash_sequence
Type of hash operation.
Definition: optiga_lib_common.h:410
optiga_verify_sign::public_key
public_key_from_host_t * public_key
Public key provided by host.
Definition: optiga_lib_common.h:496
hash_data_from_host
Specifies the structure to provide the details of data to be hashed from host.
Definition: optiga_lib_common.h:319
optiga_set_object_protected_params_t
struct optiga_set_object_protected_params optiga_set_object_protected_params_t
Specifies the data structure for protected update.
optiga_symmetric_enc_dec_params::out_data_length
uint32_t * out_data_length
Length of output data.
Definition: optiga_lib_common.h:602
optiga_verify_sign::signature_length
uint16_t signature_length
Signature data length.
Definition: optiga_lib_common.h:492
OPTIGA_RSASSA_PKCS1_V15_SHA512
@ OPTIGA_RSASSA_PKCS1_V15_SHA512
Signature schemes RSA SSA PKCS1-v1.5 with SHA512 digest.
Definition: optiga_lib_common.h:190
OPTIGA_KEY_USAGE_ENCRYPTION
@ OPTIGA_KEY_USAGE_ENCRYPTION
This enables the private key for encrypt and decrypt.
Definition: optiga_lib_common.h:119
optiga_enc_dec_asym
Specifies the structure for asymmetric encryption and decryption.
Definition: optiga_lib_common.h:546
optiga_derive_key::info
const uint8_t * info
Application specific info.
Definition: optiga_lib_common.h:526
bool_t
uint8_t bool_t
Typedef for a boolean.
Definition: optiga_lib_types.h:84
OPTIGA_KEY_ID_E0F3
@ OPTIGA_KEY_ID_E0F3
Key from key store (non-volatile)
Definition: optiga_lib_common.h:94
optiga_get_data_object::ref_bytes_to_read
uint16_t * ref_bytes_to_read
Pointer to the read buffer length.
Definition: optiga_lib_common.h:370
optiga_decrypt_sym_params_t
struct optiga_symmetric_enc_dec_params optiga_decrypt_sym_params_t
hash_data_from_host_t
struct hash_data_from_host hash_data_from_host_t
Specifies the structure to provide the details of data to be hashed from host.
optiga_set_object_protected_params::set_obj_protected_tag
optiga_set_obj_protected_tag_t set_obj_protected_tag
Set protected object tag.
Definition: optiga_lib_common.h:574
hash_data_in_optiga::oid
uint16_t oid
OID of data object.
Definition: optiga_lib_common.h:332
optiga_calc_sign::digest_length
uint8_t digest_length
Digest data length.
Definition: optiga_lib_common.h:477
optiga_set_object_protected_params
Specifies the data structure for protected update.
Definition: optiga_lib_common.h:568
optiga_symmetric_enc_dec_params::symmetric_key_oid
uint16_t symmetric_key_oid
Symmetric key OID.
Definition: optiga_lib_common.h:586
optiga_calc_sign
Specifies the data structure for ECDSA signature.
Definition: optiga_lib_common.h:467
optiga_tls_prf_type
optiga_tls_prf_type
Specifies the key derivation types.
Definition: optiga_lib_common.h:275
OPTIGA_SYMMETRIC_AES_128
@ OPTIGA_SYMMETRIC_AES_128
Symmetric key type of AES-128.
Definition: optiga_lib_common.h:295
optiga_set_data_object::write_type
uint8_t write_type
Type of write - Write only or Erase and write.
Definition: optiga_lib_common.h:393
OPTIGA_SYMMETRIC_CMAC
@ OPTIGA_SYMMETRIC_CMAC
Symmetric encryption mode with CMAC mode.
Definition: optiga_lib_common.h:208
optiga_gen_keypair::key_usage
uint8_t key_usage
Key usage type.
Definition: optiga_lib_common.h:448
OPTIGA_RSA_KEY_1024_BIT_EXPONENTIAL
@ OPTIGA_RSA_KEY_1024_BIT_EXPONENTIAL
Generate 1024 bit RSA key.
Definition: optiga_lib_common.h:173
optiga_hkdf_type
optiga_hkdf_type
Specifies the HKDF key derivation types in OPTIGA.
Definition: optiga_lib_common.h:261
OPTIGA_TLS12_PRF_SHA_384
@ OPTIGA_TLS12_PRF_SHA_384
Key derivation using TLSv1.2 PRF SHA384.
Definition: optiga_lib_common.h:280
optiga_symmetric_enc_dec_params::sent_data_length
uint32_t sent_data_length
Length of sent data.
Definition: optiga_lib_common.h:610
optiga_calc_sign::p_signature_length
uint16_t * p_signature_length
Signature length.
Definition: optiga_lib_common.h:473
optiga_enc_dec_asym::private_key_id
optiga_key_id_t private_key_id
Store private key OID.
Definition: optiga_lib_common.h:560
OPTIGA_HASH_CONTEXT_LENGTH_SHA_256
@ OPTIGA_HASH_CONTEXT_LENGTH_SHA_256
Hash context length (in bytes) in case of SHA256.
Definition: optiga_lib_common.h:227
optiga_symmetric_enc_dec_params::iv_length
uint16_t iv_length
Length of initialization vector.
Definition: optiga_lib_common.h:594
optiga_symmetric_enc_dec_params::out_data
uint8_t * out_data
Pointer to output data.
Definition: optiga_lib_common.h:600
optiga_gen_keypair
Specifies the data structure for generate key pair.
Definition: optiga_lib_common.h:446
optiga_common_set_uint16
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.
optiga_enc_dec_asym::processed_message
uint8_t * processed_message
Pointer to buffer where encrypted or decrypted message is stored.
Definition: optiga_lib_common.h:558
hash_data_from_host::length
uint32_t length
Length of data.
Definition: optiga_lib_common.h:323
optiga_set_object_protected_params::p_protected_update_buffer_length
uint16_t p_protected_update_buffer_length
Manifest/Fragment length.
Definition: optiga_lib_common.h:572
optiga_symmetric_enc_dec_params::in_data_length
uint32_t in_data_length
Length of plain text.
Definition: optiga_lib_common.h:590
optiga_verify_sign::p_signature
const uint8_t * p_signature
Signature buffer pointer.
Definition: optiga_lib_common.h:490
OPTIGA_KEY_ID_E0FD
@ OPTIGA_KEY_ID_E0FD
Key from key store for RSA (non-volatile)
Definition: optiga_lib_common.h:98
OPTIGA_KEY_ID_E0F0
@ OPTIGA_KEY_ID_E0F0
Key from key store (non-volatile)
Definition: optiga_lib_common.h:88
OPTIGA_RSASSA_PKCS1_V15_SHA384
@ OPTIGA_RSASSA_PKCS1_V15_SHA384
Signature schemes RSA SSA PKCS1-v1.5 with SHA384 digest.
Definition: optiga_lib_common.h:187
public_key_from_host::public_key
uint8_t * public_key
Pointer to Public Key.
Definition: optiga_lib_common.h:345
optiga_calc_hash_params_t
struct optiga_calc_hash optiga_calc_hash_params_t
Specifies the data structure of calculate hash.
OPTIGA_SET_PROTECTED_UPDATE_FINAL
@ OPTIGA_SET_PROTECTED_UPDATE_FINAL
This enables to finish of the protected update.
Definition: optiga_lib_common.h:132
optiga_calc_hash::current_hash_sequence
uint8_t current_hash_sequence
Current type of hash operation.
Definition: optiga_lib_common.h:412
optiga_symmetric_enc_dec_params::in_data
const uint8_t * in_data
Pointer to plain text.
Definition: optiga_lib_common.h:588
optiga_rng_type
optiga_rng_type
Specifies the random generation types.
Definition: optiga_lib_common.h:234
optiga_hash_context::hash_algo
uint8_t hash_algo
hashing algorithm
Definition: optiga_lib_common.h:312
hash_data_in_optiga::length
uint16_t length
Number of data bytes starting from the offset.
Definition: optiga_lib_common.h:336
OPTIGA_SYMMETRIC_ECB
@ OPTIGA_SYMMETRIC_ECB
Symmetric encryption mode with ECB mode.
Definition: optiga_lib_common.h:202
OPTIGA_RSA_KEY_2048_BIT_EXPONENTIAL
@ OPTIGA_RSA_KEY_2048_BIT_EXPONENTIAL
Generate 2048 bit RSA key.
Definition: optiga_lib_common.h:175
optiga_calc_ssec::shared_secret
uint8_t * shared_secret
Pointer to a buffer where the exported shared secret to be stored.
Definition: optiga_lib_common.h:509
optiga_derive_key_params_t
struct optiga_derive_key optiga_derive_key_params_t
Specifies the structure for derivation of key using pseudo random function.
OPTIGA_SET_PROTECTED_UPDATE_START
@ OPTIGA_SET_PROTECTED_UPDATE_START
This enables to start of the protected update.
Definition: optiga_lib_common.h:128
OPTIGA_KEY_ID_E0F2
@ OPTIGA_KEY_ID_E0F2
Key from key store (non-volatile)
Definition: optiga_lib_common.h:92
OPTIGA_ECC_CURVE_BRAIN_POOL_P_256R1
@ OPTIGA_ECC_CURVE_BRAIN_POOL_P_256R1
Generate elliptic curve key based on ECC Brainpool 256R1.
Definition: optiga_lib_common.h:150
optiga_set_data_object::buffer
const uint8_t * buffer
Wrtie data buffer pointer.
Definition: optiga_lib_common.h:389
optiga_encrypt_asym_params_t
struct optiga_enc_dec_asym optiga_encrypt_asym_params_t
Specifies the structure for asymmetric encryption and decryption.
optiga_symmetric_enc_dec_params::original_sequence
uint8_t original_sequence
Requested sequence.
Definition: optiga_lib_common.h:606
optiga_common_get_uint16
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.
OPTIGA_KEY_USAGE_SIGN
@ OPTIGA_KEY_USAGE_SIGN
This enables the private key for the signature generation.
Definition: optiga_lib_common.h:115
optiga_gen_keypair::public_key
uint8_t * public_key
Public key buffer pointer.
Definition: optiga_lib_common.h:458
optiga_set_obj_protected_tag_t
enum optiga_set_obj_protected_tag optiga_set_obj_protected_tag_t
Specifies the set protected object tag.
optiga_gen_keypair::public_key_length
uint16_t * public_key_length
Public key length.
Definition: optiga_lib_common.h:460
optiga_rsa_signature_scheme
optiga_rsa_signature_scheme
Specifies the RSA signature schemes type in OPTIGA.
Definition: optiga_lib_common.h:183
OPTIGA_RSAES_PKCS1_V15
@ OPTIGA_RSAES_PKCS1_V15
RSA PKCS1 v1.5 encryption scheme.
Definition: optiga_lib_common.h:164
optiga_verify_sign::certificate_oid
uint16_t certificate_oid
Public key certificate OID.
Definition: optiga_lib_common.h:498
OPTIGA_HKDF_SHA_512
@ OPTIGA_HKDF_SHA_512
Key derivation using HKDF-SHA512.
Definition: optiga_lib_common.h:267
optiga_gen_symkey_params_t
struct optiga_gen_symkey_params optiga_gen_symkey_params_t
Specifies the data structure for symmetric generate key.
optiga_enc_dec_asym::public_key_source_type
uint8_t public_key_source_type
Source of provided public key for encryption and Private key for decryption.
Definition: optiga_lib_common.h:554
OPTIGA_KEY_ID_SECRET_BASED
@ OPTIGA_KEY_ID_SECRET_BASED
Key from key store for symmetric operations.
Definition: optiga_lib_common.h:103
optiga_calc_sign::p_digest
const uint8_t * p_digest
Digest buffer pointer.
Definition: optiga_lib_common.h:469
optiga_symmetric_enc_dec_params::iv
const uint8_t * iv
Pointer to initialization vector.
Definition: optiga_lib_common.h:592
optiga_get_random::optional_data
const uint8_t * optional_data
User buffer which holds the optional data.
Definition: optiga_lib_common.h:436
optiga_common_set_uint32
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.
optiga_hash_context_t
struct optiga_hash_context optiga_hash_context_t
Specifies the structure to the Hash context details managed by OPTIGA.
optiga_derive_key
Specifies the structure for derivation of key using pseudo random function.
Definition: optiga_lib_common.h:520
optiga_derive_key::info_length
uint16_t info_length
Info length.
Definition: optiga_lib_common.h:536