Infineon OPTIGA(TM) Trust X command library APIs

nRF5 SDK v16.0.0

Infineon OPTIGA(TM) Trust X command library APIS. More...

Data Structures

struct sCmdResponse_d
Structure to receive the response of the device for a command. More...
struct sOpenApp_d
Structure to specify open application command parameters. More...
struct sGetData_d
Structure to specify GetDataObject command parameters. More...
struct sSetData_d
Structure to specify SetDataObject command parameters. More...
struct sAuthMsg_d
Structure to specify authentication command parameters. More...
struct sAuthScheme_d
Structure to specify authentication Scheme parameters. More...
struct sRngOptions_d
Structure to specify option to generate random number. More...
struct sOIDInfo_d
Structure to specify OID information. More...
struct sContextInfo_d
Structure to specify the information for context information. More...
struct sCalcHash_d
Structure to specify parameters for Hash generation. More...
struct sHashinfo
Structure to specify hash information. More...
struct sPubKeyInput_d
Structure to specify public key for verify hash. More...
struct sVerifyOption_d
Structure to specify parameters for Signature verification. More...
struct sOutKeyPair_d
Structure to return key pair as output. More...
struct sKeyPairOption_d
Structure to specify parameters for Key Pair Generation. More...
struct sCalcSignOptions_d
Structure to specify parameters for signature generation. More...
struct sCalcSSecOptions_d
Structure to specify parameters for shared secret calculation. More...
struct sDeriveKeyOptions_d
Structure to specify parameters for derive key generation. More...
union uMsgParams_d
Union to specify message specific parameters. More...
struct sCallBack_d
Structure to specify Call back parameters for Get Message. More...
struct sProcMsgData_d
Structure to specify parameters for (D)TLS handshake messages. More...
struct sProcCryptoData_d
Structure to specify ProcUpLink/ProcDownLink command parameters. More...

Macros

#define CMD_LIB_OK 0x75E96B01
Requested operation completed without any error.
#define CMD_DEV_ERROR 0x80010000
Device error, the device error(last error code) is available in the least significant byte e.g. for Invalid OID 0x80010001 is returned.
#define CMD_DEV_EXEC_ERROR 0x80020000
An error to indicate that command execution failed.It is possibly that the application on security chip is not open or communication failure has occurred.
#define CMD_LIB_NULL_PARAM 0x80001001
Null parameter(s)
#define CMD_LIB_INVALID_PARAM ( CMD_LIB_NULL_PARAM + 1)
Invalid or unsupported parameter(s)
#define CMD_LIB_INSUFFICIENT_MEMORY ( CMD_LIB_NULL_PARAM + 2)
Insufficient memory.
#define CMD_LIB_LENZERO_ERROR ( CMD_LIB_NULL_PARAM + 3)
Length of Input is zero.
#define CMD_LIB_INVALID_SESSIONID ( CMD_LIB_NULL_PARAM + 4)
Invalid Session ID.
#define CMD_LIB_INVALID_TAG ( CMD_LIB_NULL_PARAM + 5)
Invalid Tag.
#define CMD_LIB_INVALID_TAGLEN ( CMD_LIB_NULL_PARAM + 6)
Invalid Tag Length.
#define CMD_LIB_INVALID_LEN ( CMD_LIB_NULL_PARAM + 7)
Invalid Length.
#define CMD_LIB_DECRYPT_FAILURE ( CMD_LIB_NULL_PARAM + 8)
Decryption failed.
#define CMD_LIB_INVALID_OID ( CMD_LIB_NULL_PARAM + 9)
Invalid OID.
#define CMD_LIB_ERROR 0xF87ECF01
Generic error condition.
#define CALC_HASH_SHA256_CONTEXT_SIZE (130)
Length of the hash context information for SHA 256.
#define CALC_HASH_FIXED_OVERHEAD_SIZE (0x03 + 0x04)
Overhead for all hash calculation operations (Tag and Length size (3 bytes) + APDU header (4 bytes))
#define CALC_HASH_IMPORT_OR_EXPORT_OVERHEAD_SIZE (0x03)
Overhead for import or export hash context (Tag and Length size (3 bytes))
#define CALC_HASH_IMPORT_AND_EXPORT_OVERHEAD_SIZE (0x06)
Overhead for import and export hash context.
#define CHALLENGE_MIN_LEN 0x08
Challenge minimum length.
#define CHALLENGE_MAX_LEN 0x100
Challenge maximum length.
#define LEN_APDUHEADER 0x04
Length of APDU header.
#define BYTES_SESSIONID 0x02
Number of bytes in Session ID field.
#define BITS_PER_BYTE 0x08
bits per byte
#define LEN_TAG_ENCODING 0x03
Tag Encoding length.
#define ADDITIONALBYTES_ENCDEC 10
Additional bytes for Encryption/Decryption.
#define OVERHEAD_UPDOWNLINK ( LEN_APDUHEADER + BYTES_SESSIONID + LEN_TAG_ENCODING + ADDITIONALBYTES_ENCDEC )
Overhead for all uplink/downlink messages.
#define OVERHEAD_ENCDEC_RESPONSE ( LEN_APDUHEADER + LEN_TAG_ENCODING )

Typedefs

typedef struct sCmdResponse_d sCmdResponse_d
Structure to receive the response of the device for a command.
typedef int32_t(* pFTransceive )(const void *ctx, const uint8_t *PprgbWriteBuffer, const uint16_t *PpwWriteBufferLen, uint8_t *PprgbReadBuffer, uint16_t *PpwReadBufferLen)
Function to send a command and receive response for the command.
typedef enum eOpenType_d eOpenType_d
Enumerations to open the application on security chip.
typedef struct sOpenApp_d sOpenApp_d
Structure to specify open application command parameters.
typedef enum eDataOrMedata_d eDataOrMedata_d
Enumeration to specify data or metadata.
typedef enum eWriteOption_d eWriteOption_d
Enumeration to specify write option.
typedef struct sGetData_d sGetData_d
Structure to specify GetDataObject command parameters.
typedef struct sSetData_d sSetData_d
Structure to specify SetDataObject command parameters.
typedef enum eAuthScheme_d eAuthScheme_d
Enumeration to specify an authentication scheme.
typedef struct sAuthMsg_d sAuthMsg_d
Structure to specify authentication command parameters.
typedef struct sAuthScheme_d sAuthScheme_d
Structure to specify authentication Scheme parameters.
typedef enum eRngType_d eRngType_d
Enumeration to specify the type of the random number.
typedef struct sRngOptions_d sRngOptions_d
Structure to specify option to generate random number.
typedef enum eHashAlg_d eHashAlg_d
Enumeration to specify Hashing algorithm.
typedef enum eHashSequence_d eHashSequence_d
Enumeration to specify Hashing Sequence.
typedef enum eDataType_d eDataType_d
Enumeration to specify Hashing data type.
typedef struct sOIDInfo_d sOIDInfo_d
Structure to specify OID information.
typedef enum eContextAction_d eContextAction_d
Enumeration to specify the action to be performed with the context.
typedef struct sContextInfo_d sContextInfo_d
Structure to specify the information for context information.
typedef struct sCalcHash_d sCalcHash_d
Structure to specify parameters for Hash generation.
typedef struct sHashinfo sHashinfo_d
Structure to specify hash information.
typedef enum eSignScheme_d eSignScheme_d
Enumeration for supported Signing scheme.
typedef enum eAlgId_d eAlgId_d
Enumeration for supported algorithm identifier.
typedef struct sPubKeyInput_d sPubKeyInput_d
Structure to specify public key for verify hash.
typedef struct sVerifyOption_d sVerifyOption_d
Structure to specify parameters for Signature verification.
typedef struct sOutKeyPair_d sOutKeyPair_d
Structure to return key pair as output.
typedef enum eKeyExport_d eKeyExport_d
Enumeration to specify the action on key pair.
typedef enum eKeyUsage_d eKeyUsage_d
Enumeration to specify supported key usage.
typedef struct sKeyPairOption_d sKeyPairOption_d
Structure to specify parameters for Key Pair Generation.
typedef struct sCalcSignOptions_d sCalcSignOptions_d
Structure to specify parameters for signature generation.
typedef enum eKeyAgreementType_d eKeyAgreementType_d
Enumeration to specify supported key agreement primitives.
typedef struct sCalcSSecOptions_d sCalcSSecOptions_d
Structure to specify parameters for shared secret calculation.
typedef enum eKeyDerivationMethod_d eKeyDerivationMethod_d
Enumeration to specify supported key derivation method.
typedef struct sDeriveKeyOptions_d sDeriveKeyOptions_d
Structure to specify parameters for derive key generation.
typedef enum eMsgType_d eMsgType_d
Enumeration to specify the type of message.
typedef union uMsgParams_d uMsgParams_d
Union to specify message specific parameters.
typedef int32_t(* fAcceptMessage )(Void *, const sbBlob_d *)
Callback to Caller to accept the message.
typedef struct sCallBack_d sCallBack_d
Structure to specify Call back parameters for Get Message.
typedef struct sProcMsgData_d sProcMsgData_d
Structure to specify parameters for (D)TLS handshake messages.
typedef struct sProcCryptoData_d sProcCryptoData_d
Structure to specify ProcUpLink/ProcDownLink command parameters.

Enumerations

enum eOpenType_d { eInit = 0x00 }
Enumerations to open the application on security chip. More...
enum eDataOrMedata_d {
eDATA ,
eMETA_DATA
}
Enumeration to specify data or metadata. More...
enum eWriteOption_d {
eWRITE ,
eERASE_AND_WRITE
}
Enumeration to specify write option. More...
enum eAuthScheme_d {
eECDSA = 0x91,
eDTLSClient = 0x99
}
Enumeration to specify an authentication scheme. More...
enum eRngType_d {
eTRNG = 0x00,
eDRNG = 0x01
}
Enumeration to specify the type of the random number. More...
enum eHashAlg_d { eSHA256 = 0xE2 }
Enumeration to specify Hashing algorithm. More...
enum eHashSequence_d {
eStartHash = 0x00,
eStartFinalizeHash = 0x01,
eContinueHash = 0x02,
eFinalizeHash = 0x03,
eTerminateHash = 0x04,
eIntermediateHash = 0x05
}
Enumeration to specify Hashing Sequence. More...
enum eDataType_d {
eDataStream = 0x00,
eOIDData = 0x01
}
Enumeration to specify Hashing data type. More...
enum eContextAction_d {
eUnused = 0x00,
eImport = 0x06,
eExport = 0x07,
eImportExport = 0x67
}
Enumeration to specify the action to be performed with the context. More...
enum eSignScheme_d { eECDSA_FIPS_186_3_WITHOUT_HASH = 0x11 }
Enumeration for supported Signing scheme. More...
enum eAlgId_d {
eECC_NIST_P256 = 0x03,
eECC_NIST_P384 = 0x04
}
Enumeration for supported algorithm identifier. More...
enum eKeyExport_d {
eStorePrivKeyOnly = 0x01,
eExportKeyPair = 0x07
}
Enumeration to specify the action on key pair. More...
enum eKeyUsage_d {
eAuthentication = 0x01,
eEncryption = 0x02,
eHostFwUpdate = 0x04,
eDevMgmt = 0x08,
eSign = 0x10,
eKeyAgreement = 0x20
}
Enumeration to specify supported key usage. More...
enum eKeyAgreementType_d { eECDH_NISTSP80056A = 0x01 }
Enumeration to specify supported key agreement primitives. More...
enum eKeyDerivationMethod_d { eTLS_PRF_SHA256 = 0x01 }
Enumeration to specify supported key derivation method. More...
enum eMsgType_d {
eClientHello = 0x01,
eClientHelloWithCookie = 0x03,
eClientCertificate = 0x0B,
eClientKeyExchange = 0x10,
eCertificateVerify = 0x0F,
eClientFinished = 0x14,
eHelloVerifyRequest = 0x03,
eServerHello = 0x02,
eServerCertificate = 0x0B,
eServerKeyExchange = 0x0C,
eCertificateRequest = 0x0D,
eServerHelloDone = 0x0E,
eServerFinished = 0x14,
eChangeCipherSpec = 0x13,
eCloseSession = 0x71
}
Enumeration to specify the type of message. More...

Functions

LIBRARY_EXPORTS int32_t CmdLib_OpenApplication (const sOpenApp_d *PpsOpenApp)
Opens the Security Chip Application.
LIBRARY_EXPORTS int32_t CmdLib_GetSignature (const sAuthMsg_d *PpsAuthMsg, sCmdResponse_d *PpsResponse)
Gets the signature generated by Security Chip.
LIBRARY_EXPORTS int32_t CmdLib_GetRandom (const sRngOptions_d *PpsRng, sCmdResponse_d *PpsResponse)
Gets the true random bytes generated by Security Chip.
LIBRARY_EXPORTS int32_t CmdLib_SetAuthScheme (const sAuthScheme_d *PpsAuthVector)
Sets the Authentication Scheme by issuing SetAuthScheme command to Security Chip.

Detailed Description

Infineon OPTIGA(TM) Trust X command library APIS.

Enumeration Type Documentation

Enumeration for supported algorithm identifier.

Enumerator
eECC_NIST_P256

Elliptic curve key on NIST P256 curve.

eECC_NIST_P384

Elliptic curve key on NIST P384 curve.

Enumeration to specify an authentication scheme.

Enumerator
eECDSA

The ECDSA signature scheme as specified within FIPS 186-3 (SHA256)

eDTLSClient

DTLS Client scheme with cipher suite as DTLS_ECDHE_ECDSA_WITH_AES_128_CCM_8.

Enumeration to specify the action to be performed with the context.

Enumerator
eUnused

Context data is not used.

eImport

Import hash context to perform the hash.

eExport

Export the current active hash context.

eImportExport

Import the provided hash context and export back the hash context after hashing.

Enumeration to specify data or metadata.

Enumerator
eDATA

Read or write data.

eMETA_DATA

Read or write metadata.

Enumeration to specify Hashing data type.

Enumerator
eDataStream

Data stream.

eOIDData

OID contents.

Enumeration to specify Hashing algorithm.

Enumerator
eSHA256

SHA256 for Hashing.

Enumeration to specify Hashing Sequence.

Enumerator
eStartHash

Start hashing.

eStartFinalizeHash

Start and Finalize hashing.

eContinueHash

Continue hashing.

eFinalizeHash

Finalize hashing.

eTerminateHash

Terminate hashing.

eIntermediateHash

Get Intermediate hash.

Enumeration to specify supported key agreement primitives.

Enumerator
eECDH_NISTSP80056A

Elliptic Curve Diffie-Hellman shared secret agreement according to NIST SP-800 56A.

Enumeration to specify supported key derivation method.

Enumerator
eTLS_PRF_SHA256

IETF 5246 TLS PRF SHA256.

Enumeration to specify the action on key pair.

Enumerator
eStorePrivKeyOnly

Stores only the private key in the OID and exports the public key.

eExportKeyPair

Exports both public and private key as the output.

Enumeration to specify supported key usage.

Enumerator
eAuthentication

The key is used for authentication.

eEncryption

The key is used for encryption.

eHostFwUpdate

The key is used for host firmware update.

eDevMgmt

The key is used for device management.

eSign

The key is used for signature.

eKeyAgreement

The key agreement.

Enumeration to specify the type of message.

Enumerator
eClientHello

Client Hello.

eClientHelloWithCookie

Client Hello with Cookie.

eClientCertificate

Client Certificate.

eClientKeyExchange

Client Key Exchange.

eCertificateVerify

Certificate Verify.

eClientFinished

Client Finished.

eHelloVerifyRequest

Hello Verify Request.

eServerHello

Server Hello.

eServerCertificate

Server Certificate.

eServerKeyExchange

Server Key Exchange.

eCertificateRequest

Certificate Request.

eServerHelloDone

Server Hello Done.

eServerFinished

Server Finished.

eChangeCipherSpec

Change cipher spec.

eCloseSession

Close session.

Enumerations to open the application on security chip.

Enumerator
eInit

Initialise a clean application context.

Enumeration to specify the type of the random number.

Enumerator
eTRNG

True random number.

eDRNG

Deterministic random number.

Enumeration for supported Signing scheme.

Enumerator
eECDSA_FIPS_186_3_WITHOUT_HASH

ECDSA FIPS 186-3 w/o hash.

Enumeration to specify write option.

Enumerator
eWRITE

Perform write operation.

eERASE_AND_WRITE

Perform erase and write operation.