NXP Reader Library  v17.1.0.2535
Commands_CryptoAPI

Describes about the NTAG X DNA Crypto API commands. More...

Collaboration diagram for Commands_CryptoAPI:

Modules

 Defines
 Macro Definitions for Crypto API commands.
 

Functions

phStatus_t phalNtagXDna_CryptoRequestSHA (void *pDataParams, uint8_t bOption, uint8_t bOperation, uint8_t bAlgorithm, uint8_t bInputDataSource, uint8_t bResultDst, uint8_t *pInputData, uint8_t bInputDataLen, uint8_t **ppResponse, uint16_t *pRspLen)
 Perform CryptoRequest SHA. More...
 
phStatus_t phalNtagXDna_CryptoRequestRNG (void *pDataParams, uint8_t bOption, uint8_t bNumBytes, uint8_t bResultDst, uint8_t **ppResponse, uint16_t *pRspLen)
 Perform CryptoRequest RNG. More...
 
phStatus_t phalNtagXDna_CryptoRequestECCSign (void *pDataParams, uint8_t bOption, uint8_t bOperation, uint8_t bPrivateKeyID, uint8_t bInputDataSource, uint8_t *pInputData, uint8_t bInputDataLen, uint8_t **ppResponse, uint16_t *pRspLen)
 Perform CryptoRequest ECC Signature generation. More...
 
phStatus_t phalNtagXDna_CryptoRequestECCVerify (void *pDataParams, uint8_t bOption, uint8_t bOperation, uint8_t bCurveID, uint8_t *pHostPubKey, uint8_t bHostPubKeyLen, uint8_t *pSignature, uint8_t bSigLen, uint8_t bInputDataSource, uint8_t *pInputData, uint8_t bInputDataLen)
 Perform CryptoRequest ECC Signature verification. More...
 
phStatus_t phalNtagXDna_CryptoRequestECCDH (void *pDataParams, uint8_t bOption, uint8_t bOperation, uint8_t bKeyPairID, uint8_t bSSDestination, uint8_t *pHostPubKey, uint8_t bHostPubKeyLen, uint8_t **ppResponse, uint16_t *pRspLen)
 Perform CryptoRequest ECC Diffie-Hellman. More...
 
phStatus_t phalNtagXDna_CryptoRequestAES (void *pDataParams, uint8_t bOption, uint8_t bOperation, uint8_t bPrimitive, uint8_t bKeyID, uint8_t bKeyLen, uint8_t bICVSource, uint8_t *pICV, uint8_t bICVLen, uint8_t bInputDataSource, uint8_t bResultDst, uint8_t *pInputData, uint8_t bInputDataLen, uint8_t **ppResponse, uint16_t *pRspLen)
 Perform CryptoRequest AES ECB / CBC Encryption or Decryption. More...
 
phStatus_t phalNtagXDna_CryptoRequestAESCMAC (void *pDataParams, uint8_t bOption, uint8_t bOperation, uint8_t bPrimitive, uint8_t bKeyID, uint8_t bKeyLen, uint8_t *pCMACSignature, uint8_t bCMACSignLen, uint8_t bInputDataSource, uint8_t *pInputData, uint8_t bInputDataLen, uint8_t **ppResponse, uint16_t *pRspLen)
 Perform CryptoRequest AES CMAC Signing or Verification. More...
 
phStatus_t phalNtagXDna_CryptoRequestAESAEAD (void *pDataParams, uint8_t bOption, uint8_t bOperation, uint8_t bPrimitive, uint8_t bKeyID, uint8_t bKeyLen, uint8_t bNonceSource, uint8_t *pNonce, uint8_t bNonceLen, uint16_t wTotal_AAdLen, uint16_t wTotal_InputDataLen, uint8_t bAADSource, uint8_t *pAAD, uint8_t bAADLen, uint8_t bInputDataSource, uint8_t *pInputData, uint8_t bInputDataLen, uint8_t *pTagData, uint8_t bTagDataLen, uint8_t bResultDst, uint8_t **ppResponse, uint16_t *pRspLen)
 Perform CryptoRequest AES AEAD Encryption / Signing or Decryption / Verification. More...
 
phStatus_t phalNtagXDna_CryptoRequestWriteInternalBuffer (void *pDataParams, uint8_t bOption, uint8_t bDestination, uint8_t *pData, uint8_t bDataLen)
 Perform CryptoRequest Write Internal Buffer. More...
 
phStatus_t phalNtagXDna_CryptoRequestHMAC (void *pDataParams, uint8_t bOption, uint8_t bOperation, uint8_t bPrimitive, uint8_t bDigestAlgo, uint8_t bKeyID, uint8_t bKeyLen, uint8_t *pHMac, uint8_t bHMacLen, uint8_t bInputDataSource, uint8_t *pInputData, uint8_t bInputDataLen, uint8_t bResultDst, uint8_t **ppResponse, uint16_t *pRspLen)
 Perform CryptoRequest HMAC (Hash-Based Message Authentication Code) Signature generation and verification. More...
 
phStatus_t phalNtagXDna_CryptoRequestHKDF (void *pDataParams, uint8_t bOption, uint8_t bOperation, uint8_t bDigestAlgo, uint8_t bKeyID, uint8_t bKeyLen, uint8_t bSaltSource, uint8_t *pSaltData, uint8_t bSaltDataLen, uint8_t bInfoSource, uint8_t *pInfoData, uint8_t bInfoDataLen, uint8_t bResultDst, uint8_t bResultLen, uint8_t **ppResponse, uint16_t *pRspLen)
 Perform CryptoRequest HKDF (HMAC Key Derivation function) Extract and Expand. More...
 
phStatus_t phalNtagXDna_CryptoRequestECHO (void *pDataParams, uint8_t bOption, uint8_t *pData, uint8_t bDataLen, uint8_t **ppResponse, uint16_t *pRspLen)
 Perform CryptoRequest ECHO. More...
 

Detailed Description

Describes about the NTAG X DNA Crypto API commands.

Function Documentation

◆ phalNtagXDna_CryptoRequestSHA()

phStatus_t phalNtagXDna_CryptoRequestSHA ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bOperation,
uint8_t  bAlgorithm,
uint8_t  bInputDataSource,
uint8_t  bResultDst,
uint8_t pInputData,
uint8_t  bInputDataLen,
uint8_t **  ppResponse,
uint16_t pRspLen 
)

Perform CryptoRequest SHA.

It is possible to execute an SHA calculation using a single command or as a series of commands.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETER
  • If the buffers are null.
  • The values provided in bComOption is not supported.
XXXX
  • Depending on status codes return by tag.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Indicates the mode of communication to be used while exchanging the data from tag.
[in]bOperation[In] Indicates the Operation to be used. One of the following,
[in]bAlgorithm[In] Indicates the Algorithm to be used. One of the following,
[in]bInputDataSource[In] Crypto API Data Source Selection.
  • 0x00 : Command Buffer
  • 0x80 - 0x87: Transient buffer slot number (0 to 7)
  • 0xC0 - 0xCF: Static buffer slot number (0 to 15)
[in]bResultDst[In] Crypto API Data Destination Selection.
  • 0x00 : Command Buffer
  • 0x80 - 0x87: Transient buffer slot number (0 to 7)
  • 0xC0 - 0xCF: Static buffer slot number (0 to 15)
[in]pInputData[In] Input data to be hashed. One of the following
  • NULL if Input data source is not Command Buffer
  • Actual data to be hashed if Input data source is Command Buffer
[in]bInputDataLen[In] Length Input Data as mentioned below
  • Actual data length if Input data source is not Command Buffer
  • Length of bytes available in pInputData buffer.
[out]ppResponse[Out] Buffer containing the Hashed information.
[out]pRspLen[Out] Length of Bytes available in ppResponse buffer.

◆ phalNtagXDna_CryptoRequestRNG()

phStatus_t phalNtagXDna_CryptoRequestRNG ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bNumBytes,
uint8_t  bResultDst,
uint8_t **  ppResponse,
uint16_t pRspLen 
)

Perform CryptoRequest RNG.

It is possible to generate random data, which is compliant with NIST SP800-90B using a 256-bit key. The Maximum number of generated bytes is 128.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETER
  • If the buffers are null.
  • The values provided in bComOption is not supported.
XXXX
  • Depending on status codes return by tag.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Indicates the mode of communication to be used while exchanging the data from tag.
[in]bNumBytes[In] The number of bytes to generate random bytes.
[in]bResultDst[In] Crypto API Data Destination Selection.
  • 0x00 : Command Buffer
  • 0x80 - 0x87: Transient buffer slot number (0 to 7)
  • 0xC0 - 0xCF: Static buffer slot number (0 to 15)
[out]ppResponse[Out] Buffer containing the Random data.
[out]pRspLen[Out] Length of Bytes available in ppResponse buffer.

◆ phalNtagXDna_CryptoRequestECCSign()

phStatus_t phalNtagXDna_CryptoRequestECCSign ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bOperation,
uint8_t  bPrivateKeyID,
uint8_t  bInputDataSource,
uint8_t pInputData,
uint8_t  bInputDataLen,
uint8_t **  ppResponse,
uint16_t pRspLen 
)

Perform CryptoRequest ECC Signature generation.

The ECC signature generation API supports signing of a data stream or a pre-computed hash.

Note
: Before using this interface, a PrivateKey should be generated or Imported using Manage Key-Pair interface with Key-Policy set to Request ECC Signature.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETER
  • If the buffers are null.
  • The values provided in bComOption is not supported.
XXXX
  • Depending on status codes return by tag.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Indicates the mode of communication to be used while exchanging the data from tag.
[in]bOperation[In] Indicates the Operation to be used. One of the following,
[in]bPrivateKeyID[In] Id of the ECC key pair containing the private key to use. Note a key pair must be marked as ‘Crypto API Signature’.
[in]bInputDataSource[In] Crypto API Data Source Selection.
  • 0x00 : Command Buffer
  • 0x80 - 0x87: Transient buffer slot number (0 to 7)
  • 0xC0 - 0xCF: Static buffer slot number (0 to 15)
[in]pInputData[In] Input data to be Signed. One of the following
  • NULL if Input data source is not Command Buffer
  • Actual data to be Signed if Input data source is Command Buffer
[in]bInputDataLen[In] Length Input Data as mentioned below
  • Actual data length if Input data source is not Command Buffer
  • Length of bytes available in pInputData buffer.
[out]ppResponse[Out] Buffer containing the Signature information.
[out]pRspLen[Out] Length of Bytes available in ppResponse buffer.

◆ phalNtagXDna_CryptoRequestECCVerify()

phStatus_t phalNtagXDna_CryptoRequestECCVerify ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bOperation,
uint8_t  bCurveID,
uint8_t pHostPubKey,
uint8_t  bHostPubKeyLen,
uint8_t pSignature,
uint8_t  bSigLen,
uint8_t  bInputDataSource,
uint8_t pInputData,
uint8_t  bInputDataLen 
)

Perform CryptoRequest ECC Signature verification.

The ECC signature verification API supports verification of a data stream or data, which has already been hashed.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETER
  • If the buffers are null.
  • The values provided in bComOption is not supported.
PHAL_NTAGXDNA_ERR_SIGNATURE_VERIFICATION_FAILUREVerification of Message / Signature combination failed.
XXXX
  • Depending on status codes return by tag.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Indicates the mode of communication to be used while exchanging the data from tag.
[in]bOperation[In] Indicates the Operation to be used. One of the following,
[in]bCurveID[In] The targeted curve. Should be one of the below values.
[in]pHostPubKey[In] The public key to use for signature verification provided in uncompressed format. i.e. leading 0x04 byte
[in]bHostPubKeyLen[In] Length of Bytes available in pHostPubKey buffer.
[in]pSignature[In] Signature to verify.
[in]bSigLen[In] Length of Bytes available in pSignature buffer.
[in]bInputDataSource[In] Crypto API Data Source Selection.
  • 0x00 : Command Buffer
  • 0x80 - 0x87: Transient buffer slot number (0 to 7)
  • 0xC0 - 0xCF: Static buffer slot number (0 to 15)
[in]pInputData[In] Input data to be verified. One of the following
  • NULL if Input data source is not Command Buffer
  • Actual data to be verified if Input data source is Command Buffer
[in]bInputDataLen[In] Length Input Data as mentioned below
  • Actual data length if Input data source is not Command Buffer
  • Length of bytes available in pInputData buffer.

◆ phalNtagXDna_CryptoRequestECCDH()

phStatus_t phalNtagXDna_CryptoRequestECCDH ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bOperation,
uint8_t  bKeyPairID,
uint8_t  bSSDestination,
uint8_t pHostPubKey,
uint8_t  bHostPubKeyLen,
uint8_t **  ppResponse,
uint16_t pRspLen 
)

Perform CryptoRequest ECC Diffie-Hellman.

The ECC Diffie-Hellman API supports the use of static keys or ephemeral keys. In addition, it allows the shared secret to be generated using a single or two-step approach.

Note
: Before using this interface, a PrivateKey should be generated or Imported using Manage Key-Pair interface with Key-Policy set to Request ECC DH.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETER
  • If the buffers are null.
  • The values provided in bComOption is not supported.
XXXX
  • Depending on status codes return by tag.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Indicates the mode of communication to be used while exchanging the data from tag.
[in]bOperation[In] Indicates the Operation to be used. One of the following,
[in]bKeyPairID[In] Should be one of the below values.
  • 0x00 - 0x04: Static key pair - the key pair must be marked as Crypto API ECDH
  • 0xFE : Use NIST 256 ephemeral key pair
  • 0xFF : Use Brain-pool 256 ephemeral key pair
[in]bSSDestination[In] Crypto API Shared Secret destination Selection.
  • 0x00 : Command Buffer
  • 0x80 - 0x87: Transient buffer slot number (0 to 7)
  • 0xC0 - 0xCF: Static buffer slot number (0 to 15)
[in]pHostPubKey[In] The host's public key to use for shared secret generation, provided in uncompressed format I.e leading 0x04 byte
[in]bHostPubKeyLen[In] Length of Bytes available in pHostPubKey buffer.
[out]ppResponse[Out] Buffer containing,
  • [Card's ephemeral PublicKey]: If key pair Id indicates an ephemeral key and single step or two-step step 1
  • [Shared Secret]: If single step or two-step step 2 and output destination is the command buffer
[out]pRspLen[Out] Length of Bytes available in ppResponse buffer.

◆ phalNtagXDna_CryptoRequestAES()

phStatus_t phalNtagXDna_CryptoRequestAES ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bOperation,
uint8_t  bPrimitive,
uint8_t  bKeyID,
uint8_t  bKeyLen,
uint8_t  bICVSource,
uint8_t pICV,
uint8_t  bICVLen,
uint8_t  bInputDataSource,
uint8_t  bResultDst,
uint8_t pInputData,
uint8_t  bInputDataLen,
uint8_t **  ppResponse,
uint16_t pRspLen 
)

Perform CryptoRequest AES ECB / CBC Encryption or Decryption.

Note
: The AES primitives supported by a static key are defined by the KeyPolicy set via the ChangeKey command.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETER
  • If the buffers are null.
  • The values provided in bComOption is not supported.
XXXX
  • Depending on status codes return by tag.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Indicates the mode of communication to be used while exchanging the data from tag.
[in]bOperation[In] Indicates the Operation to be used. One of the following,
[in]bPrimitive[In] One of the following Primitive.
[in]bKeyID[In] Id of the AES key.
  • 0x10 - 0x17: Id of AES Key (must be in crypto API range: ‘10’ – ‘17’), the key length from the static key.
  • 0x80 - 0x87: Transient buffer slot number containing the AES key, the key length shall be in the following field
  • 0xC0 - 0xCF: Static buffer slot number containing the AES key, the key length shall be in the following field
[in]bKeyLen[In] Length of AES key, only present when the key source is an internal buffer.
[in]bICVSource[In] Crypto API ICV Source Selection. Only present for CBC operations.
  • 0x00 : Command Buffer
  • 0x80 - 0x87: Transient buffer slot number (0 to 7)
  • 0xC0 - 0xCF: Static buffer slot number (0 to 15)
[in]pICV[In] Only present for CBC operations and the ICV is in the command buffer.
[in]bICVLen[In] Length of Bytes available in pICV buffer.
[in]bInputDataSource[In] Crypto API Data Source Selection.
  • 0x00 : Command Buffer
  • 0x80 - 0x87: Transient buffer slot number (0 to 7)
  • 0xC0 - 0xCF: Static buffer slot number (0 to 15)
[in]bResultDst[In] Crypto API Data Destination Selection.
  • 0x00 : Command Buffer
  • 0x80 - 0x87: Transient buffer slot number (0 to 7)
  • 0xC0 - 0xCF: Static buffer slot number (0 to 15)
[in]pInputData[In] Data to be Encrypted or Decrypted. One of the following
  • NULL if Input data source is not Command Buffer
  • Actual data to be encrypted or decrypted if Input data source is Command Buffer
[in]bInputDataLen[In] Length Input Data as mentioned below
  • Actual data length if Input data source is not Command Buffer
  • Length of bytes available in pInputData buffer.
[out]ppResponse[Out] Buffer containing the Encrypted or Decrypted data.
[out]pRspLen[Out] Length of Bytes available in ppResponse buffer.

◆ phalNtagXDna_CryptoRequestAESCMAC()

phStatus_t phalNtagXDna_CryptoRequestAESCMAC ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bOperation,
uint8_t  bPrimitive,
uint8_t  bKeyID,
uint8_t  bKeyLen,
uint8_t pCMACSignature,
uint8_t  bCMACSignLen,
uint8_t  bInputDataSource,
uint8_t pInputData,
uint8_t  bInputDataLen,
uint8_t **  ppResponse,
uint16_t pRspLen 
)

Perform CryptoRequest AES CMAC Signing or Verification.

Note
: The AES API supports the use of static crypto API keys or keys stored in an internal buffer. The AES primitives supported by a static key are defined by the KeyPolicy set via the ChangeKey command.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETER
  • If the buffers are null.
  • The values provided in bComOption is not supported.
PHAL_NTAGXDNA_ERR_SIGNATURE_VERIFICATION_FAILUREVerification of Message / Signature combination failed.
XXXX
  • Depending on status codes return by tag.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Indicates the mode of communication to be used while exchanging the data from tag.
[in]bOperation[In] Indicates the Operation to be used. One of the following,
[in]bPrimitive[In] One of the following Primitive.
[in]bKeyID[In] Id of the AES key.
  • 0x10 - 0x17: Id of AES Key (must be in crypto API range: ‘10’ – ‘17’), the key length from the static key.
  • 0x80 - 0x87: Transient buffer slot number containing the AES key, the key length shall be in the following field
  • 0xC0 - 0xCF: Static buffer slot number containing the AES key, the key length shall be in the following field
[in]bKeyLen[In] Length of AES key, only present when the key source is an internal buffer.
[in]pCMACSignature[In] CMAC Signature to be verified.
[in]bCMACSignLen[In] Length of Bytes available in pCMACSignature buffer.
[in]bInputDataSource[In] Crypto API Data Source Selection.
  • 0x00 : Command Buffer
  • 0x80 - 0x87: Transient buffer slot number (0 to 7)
  • 0xC0 - 0xCF: Static buffer slot number (0 to 15)
[in]pInputData[In] Data to be Signed or Verified. One of the following
  • NULL if Input data source is not Command Buffer
  • Actual data to be Signed or Verified if Input data source is Command Buffer
[in]bInputDataLen[In] Length Input Data as mentioned below
  • Actual data length if Input data source is not Command Buffer
  • Length of bytes available in pInputData buffer.
[out]ppResponse[Out] Buffer containing the following,
[out]pRspLen[Out] Length of Bytes available in ppResponse buffer.

◆ phalNtagXDna_CryptoRequestAESAEAD()

phStatus_t phalNtagXDna_CryptoRequestAESAEAD ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bOperation,
uint8_t  bPrimitive,
uint8_t  bKeyID,
uint8_t  bKeyLen,
uint8_t  bNonceSource,
uint8_t pNonce,
uint8_t  bNonceLen,
uint16_t  wTotal_AAdLen,
uint16_t  wTotal_InputDataLen,
uint8_t  bAADSource,
uint8_t pAAD,
uint8_t  bAADLen,
uint8_t  bInputDataSource,
uint8_t pInputData,
uint8_t  bInputDataLen,
uint8_t pTagData,
uint8_t  bTagDataLen,
uint8_t  bResultDst,
uint8_t **  ppResponse,
uint16_t pRspLen 
)

Perform CryptoRequest AES AEAD Encryption / Signing or Decryption / Verification.

  • The AES API supports the use of static crypto API keys or keys stored in an internal buffer. The AES primitives supported by a static key are defined by the KeyPolicy set via the ChangeKey command.
  • The output destination for multi-part AEAD shall always be the command buffer. For a one-shot operation, the result destination can be an internal static or transient buffer
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETER
  • If the buffers are null.
  • The values provided in bComOption is not supported.
PHAL_NTAGXDNA_ERR_SIGNATURE_VERIFICATION_FAILUREVerification of Message / Signature combination failed.
XXXX
  • Depending on status codes return by tag.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Indicates the mode of communication to be used while exchanging the data from tag.
[in]bOperation[In] Indicates the Operation to be used. One of the following,
[in]bPrimitive[In] One of the following Primitive.
[in]bKeyID[In] Id of the AES key.
  • 0x10 - 0x17: Id of AES Key (must be in crypto API range: ‘10’ – ‘17’), the key length from the static key.
  • 0x80 - 0x87: Transient buffer slot number containing the AES key, the key length shall be in the following field
  • 0xC0 - 0xCF: Static buffer slot number containing the AES key, the key length shall be in the following field
[in]bKeyLen[In] Length of AES key, only present when the key source is an internal buffer.
[in]bNonceSource[In] Crypto API Nonce Source Selection. Not present when bPrimitive is AES Primitive for CCM Encryption / Signing with Internal Nonce or AES Primitive for GCM Encryption / Signing with Internal Nonce
  • 0x00 : Command Buffer
  • 0x80 - 0x87: Transient buffer slot number (0 to 7)
  • 0xC0 - 0xCF: Static buffer slot number (0 to 15)
[in]pNonce[In] Nonce to be used. One of the following,
  • Present for bPrimitive = Internally generated
  • NULL Otherwise
[in]bNonceLen[In] Length of Nonce.One of the following,
  • 0x0D : AES CCM
  • 0x0C - 0x3C: AES GCM
wTotal_AAdLenTotal length of AAD information that will be exchanged. This will be application for below primitives,
wTotal_InputDataLenTotal length of Input data that will be exchanged. This will be application for below primitives,
[in]bAADSource[In] Crypto API AAD Source Selection.
  • 0x00 : Command Buffer
  • 0x80 - 0x87: Transient buffer slot number (0 to 7)
  • 0xC0 - 0xCF: Static buffer slot number (0 to 15)
[in]pAAD[In] AAD data. One of the following
  • NULL if Input data source is not Command Buffer
  • Actual data to be encrypted or decrypted if Input data source is Command Buffer
[in]bAADLen[In] Length AAD as mentioned below
  • Actual data length if Input AAD source is not Command Buffer
  • Length of bytes available in pAAD buffer.
[in]bInputDataSource[In] Crypto API Data Source Selection.
  • 0x00 : Command Buffer
  • 0x80 - 0x87: Transient buffer slot number (0 to 7)
  • 0xC0 - 0xCF: Static buffer slot number (0 to 15)
[in]pInputData[In] Data to be Encrypted / Signed or Decrypted / Verified. One of the following
  • NULL if Input data source is not Command Buffer
  • Actual data to be Encrypted / Signed or Decrypted / Verified if Input data source is Command Buffer
[in]bInputDataLen[In] Length Input Data as mentioned below
  • Actual data length if Input data source is not Command Buffer
  • Length of bytes available in pInputData buffer.
[in]pTagData[In] Tag Data to be used. One of the following
  • Tag information to be used. Only present when bPrimitive is Decrypt or Verify.
  • NULL otherwise.
[in]bTagDataLen[In] Tag length as mentioned below
  • 0x08 or 0x10: CCM
  • 0x0C or 0x10: GCM
[in]bResultDst[In] Crypto API Data Destination Selection.
  • 0x00 : Command Buffer
  • 0x80 - 0x87: Transient buffer slot number (0 to 7)
  • 0xC0 - 0xCF: Static buffer slot number (0 to 15)
[out]ppResponse[Out] Buffer containing the following
  • Nonce if
    • bOperation is One-Shot or Initialize
    • bPrimitive is Encrypt / Sign with internally generated Nonce.
  • Encrypted / Decrypted data for any of the operation.
  • Tag Data bPrimitive is Encryption / Sign and bOperation is One-Shot or Finalize
[out]pRspLen[Out] Length of Bytes available in ppResponse buffer.

◆ phalNtagXDna_CryptoRequestWriteInternalBuffer()

phStatus_t phalNtagXDna_CryptoRequestWriteInternalBuffer ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bDestination,
uint8_t pData,
uint8_t  bDataLen 
)

Perform CryptoRequest Write Internal Buffer.

It is possible to write a specific value to an internal buffer using this command option. This allows data to be loaded for use within other crypto API operations

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETER
  • If the buffers are null.
  • The values provided in bComOption is not supported.
XXXX
  • Depending on status codes return by tag.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Indicates the mode of communication to be used while exchanging the data from tag.
[in]bDestination[In] Crypto API Data Destination Selection.
  • 0x00 : Command Buffer
  • 0x80 - 0x87: Transient buffer slot number (0 to 7)
  • 0xC0 - 0xCF: Static buffer slot number (0 to 15)
[in]pData[In] Data to write to the internal buffer.
[in]bDataLen[In] Length of Bytes available in pData buffer.

◆ phalNtagXDna_CryptoRequestHMAC()

phStatus_t phalNtagXDna_CryptoRequestHMAC ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bOperation,
uint8_t  bPrimitive,
uint8_t  bDigestAlgo,
uint8_t  bKeyID,
uint8_t  bKeyLen,
uint8_t pHMac,
uint8_t  bHMacLen,
uint8_t  bInputDataSource,
uint8_t pInputData,
uint8_t  bInputDataLen,
uint8_t  bResultDst,
uint8_t **  ppResponse,
uint16_t pRspLen 
)

Perform CryptoRequest HMAC (Hash-Based Message Authentication Code) Signature generation and verification.

Note
: It is possible to execute an HMAC calculation using a single command or as a series of commands. Using multiple steps allows the input data to be taken from different sources. The API uses a secure SHA implementation.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETER
  • If the buffers are null.
  • The values provided in bComOption is not supported.
PHAL_NTAGXDNA_ERR_SIGNATURE_VERIFICATION_FAILUREVerification of Message / Signature combination failed.
XXXX
  • Depending on status codes return by tag.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Indicates the mode of communication to be used while exchanging the data from tag.
[in]bOperation[In] Indicates the Operation to be used. One of the following,
[in]bPrimitive[In] One of the following Primitive.
[in]bDigestAlgo[In] Indicates the Algorithm to be used. One of the following,
[in]bKeyID[In] Id of the HMAC key.
  • 0x10 - 0x17: Id of AES Key (must be in crypto API range: ‘10’ – ‘17’), the key length from the static key.
  • 0x80 - 0x87: Transient buffer slot number containing the AES key, the key length shall be in the following field
  • 0xC0 - 0xCF: Static buffer slot number containing the AES key, the key length shall be in the following field
[in]bKeyLen[In] Length of HMAC key, only present when the key source is an internal buffer.
[in]pHMac[In] Hash MAC Signature to be verified.
[in]bHMacLen[In] Length of Bytes available in pHMac buffer.
[in]bInputDataSource[In] Crypto API Data Source Selection.
  • 0x00 : Command Buffer
  • 0x80 - 0x87: Transient buffer slot number (0 to 7)
  • 0xC0 - 0xCF: Static buffer slot number (0 to 15)
[in]pInputData[In] Data to be Signed or Verified. One of the following
  • NULL if Input data source is not Command Buffer
  • Actual data to be Signed or Verified if Input data source is Command Buffer
[in]bInputDataLen[In] Length Input Data as mentioned below
  • Actual data length if Input data source is not Command Buffer
  • Length of bytes available in pInputData buffer.
[in]bResultDst[In] Crypto API Data Destination Selection.
  • 0x00 : Command Buffer
  • 0x80 - 0x87: Transient buffer slot number (0 to 7)
  • 0xC0 - 0xCF: Static buffer slot number (0 to 15)
[out]ppResponse[Out] Buffer containing the following,
  • 32 byte or 48 byte HMac signature if bPrimitive is HMAC Sign
  • NULL otherwise
[out]pRspLen[Out] Length of Bytes available in ppResponse buffer.

◆ phalNtagXDna_CryptoRequestHKDF()

phStatus_t phalNtagXDna_CryptoRequestHKDF ( void *  pDataParams,
uint8_t  bOption,
uint8_t  bOperation,
uint8_t  bDigestAlgo,
uint8_t  bKeyID,
uint8_t  bKeyLen,
uint8_t  bSaltSource,
uint8_t pSaltData,
uint8_t  bSaltDataLen,
uint8_t  bInfoSource,
uint8_t pInfoData,
uint8_t  bInfoDataLen,
uint8_t  bResultDst,
uint8_t  bResultLen,
uint8_t **  ppResponse,
uint16_t pRspLen 
)

Perform CryptoRequest HKDF (HMAC Key Derivation function) Extract and Expand.

HKDF, as defined in RFC5869, requires execution of the extract operation followed by the expand operation. The API uses a secure SHA implementation

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETER
  • If the buffers are null.
  • The values provided in bComOption is not supported.
XXXX
  • Depending on status codes return by tag.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Indicates the mode of communication to be used while exchanging the data from tag.
[in]bOperation[In] Indicates the Operation to be used. One of the following,
[in]bDigestAlgo[In] Indicates the Algorithm to be used. One of the following,
[in]bKeyID[In] Id of the HMAC key.
  • 0x10 - 0x17: Id of AES Key (must be in crypto API range: ‘10’ – ‘17’), the key length from the static key.
  • 0x80 - 0x87: Transient buffer slot number containing the AES key, the key length shall be in the following field
  • 0xC0 - 0xCF: Static buffer slot number containing the AES key, the key length shall be in the following field
[in]bKeyLen[In] Length of HMAC key, only present when the key source is an internal buffer.
[in]bSaltSource[In] Crypto API Salt Source Selection.
  • 0x00 : Command Buffer
  • 0x80 - 0x87: Transient buffer slot number (0 to 7)
  • 0xC0 - 0xCF: Static buffer slot number (0 to 15)
[in]pSaltData[In] Salt data. One of the following
  • NULL if Input data source is not Command Buffer
  • Actual data to be Signed or Verified if Input data source is Command Buffer
[in]bSaltDataLen[In] Length of Salt data as mentioned below
  • Actual data length if Salt data source is not Command Buffer
  • Length of bytes available in pInfoData buffer.
[in]bInfoSource[In] Crypto API Info Source Selection.
  • 0x00 : Command Buffer
  • 0x80 - 0x87: Transient buffer slot number (0 to 7)
  • 0xC0 - 0xCF: Static buffer slot number (0 to 15)
[in]pInfoData[In] Context data. One of the following
  • NULL if Input data source is not Command Buffer
  • Actual Context data if Input data source is Command Buffer
[in]bInfoDataLen[In] Length Input Data as mentioned below
  • Actual data length if Input data source is not Command Buffer
  • Length of bytes available in pInfoData buffer.
[in]bResultDst[In] Crypto API Data Destination Selection.
  • 0x00 : Command Buffer
  • 0x80 - 0x87: Transient buffer slot number (0 to 7)
  • 0xC0 - 0xCF: Static buffer slot number (0 to 15)
[in]bResultLen[In] Number of bytes to output
[out]ppResponse[Out] Buffer containing HKDF result.
[out]pRspLen[Out] Length of Bytes available in ppResponse buffer.

◆ phalNtagXDna_CryptoRequestECHO()

phStatus_t phalNtagXDna_CryptoRequestECHO ( void *  pDataParams,
uint8_t  bOption,
uint8_t pData,
uint8_t  bDataLen,
uint8_t **  ppResponse,
uint16_t pRspLen 
)

Perform CryptoRequest ECHO.

It is possible to have the device echo the command data provided to it. This may be useful to verify system setup.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSIf DataParams is null.
PH_ERR_INVALID_PARAMETER
  • If the buffers are null.
  • The values provided in bComOption is not supported.
XXXX
  • Depending on status codes return by tag.
  • Other Depending on implementation and underlying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Indicates the mode of communication to be used while exchanging the data from tag.
[in]pData[In] Data to be Echoed back.
[in]bDataLen[In] Length of Bytes available in pData buffer.
[out]ppResponse[Out] Buffer containing the transmitted data.
[out]pRspLen[Out] Length of Bytes available in ppResponse buffer.