xilsecure
Vitis Drivers API Documentation
XilSecure KAT Server APIs

Macros

#define XSECURE_KAT_MSG_LEN_IN_BYTES   (32U)
 Message length of known answer test in bytes. More...
 
#define XSECURE_KAT_AAD_SIZE_IN_BYTES   (16U)
 AAD size of known answer test in bytes. More...
 
#define XSECURE_KAT_IV_SIZE_IN_BYTES   (16U)
 IV size of known answer test in bytes. More...
 
#define XSECURE_KAT_KEY_SIZE_IN_BYTES   (32U)
 Key size of known answer test in bytes. More...
 
#define XSECURE_KAT_MSG_LEN_IN_WORDS   (8U)
 Message length of known answer test in words. More...
 
#define XSECURE_KAT_RSA_PUB_EXP   (0x1000100U)
 RSA public exponent of known answer test. More...
 
#define XSECURE_KAT_ECC_P521_SHA3_HASH_SIZE_IN_BYTES   (66U)
 Hash size of ECC P521 and SHA3 in bytes. More...
 
#define XSECURE_KAT_MAX_CMD_LEN   (4U)
 Maximum command length. More...
 
#define XSECURE_DDR_KAT_MASK_MUL   (4U)
 Multiplier to get DDR KAT mask. More...
 
#define XSECURE_DDR_MAX_SUPPORT   (7U)
 Maximum supported DDR. More...
 
#define XSECURE_DEF_KAT_MASK   (0xFFFFFFFFU)
 KAT mask. More...
 

Functions

u8 * XSecure_GetKatMessage (void)
 This function returns message to perform KAT. More...
 
u8 * XSecure_GetKatAesKey (void)
 This function returns AES key for KAT. More...
 
u8 * XSecure_GetKatSha3ExpHash (void)
 This function returns expected SHA3 hash for KAT. More...
 
u32 * XSecure_GetKatRsaModulus (void)
 This function returns modulus for RSA KAT. More...
 
u32 * XSecure_GetKatRsaModExt (void)
 This function returns public pre-calculated exponential (R^2 Mod N) value for RSA KAT. More...
 
u32 * XSecure_GetKatRsaData (void)
 This function returns data for RSA KAT. More...
 
u32 * XSecure_GetKatRsaCtData (void)
 This function returns cipher text data for RSA KAT. More...
 
u32 * XSecure_GetKatRsaPrivateExp (void)
 This function returns private exponent for RSA KAT. More...
 
XSecure_EllipticKeyXSecure_GetKatEccPublicKey (XSecure_EllipticCrvClass CrvClass)
 This function returns ECC public key to perform KAT. More...
 
XSecure_EllipticSignXSecure_GetKatEccExpSign (XSecure_EllipticCrvClass CrvClass)
 This function returns ECC expected signature to perform KAT. More...
 
u8 * XSecure_GetKatEccPrivateKey (XSecure_EllipticCrvClass CrvClass)
 This function returns ECC private key to perform KAT. More...
 
u8 * XSecure_GetKatEccEphemeralKey (XSecure_EllipticCrvTyp CrvType)
 This function returns ECC ephemeral key to perform KAT. More...
 
int XSecure_AesDecryptCmKat (const XSecure_Aes *AesInstance)
 This function performs known answer test(KAT) on AES engine to confirm DPA counter measures is working fine. More...
 
int XSecure_AesDecryptKat (XSecure_Aes *AesInstance)
 This function performs decryption known answer test(KAT) on AES engine. More...
 
int XSecure_AesEncryptKat (XSecure_Aes *AesInstance)
 This function performs encryption known answer test(KAT) on AES engine. More...
 
int XSecure_Sha3Kat (XSecure_Sha3 *SecureSha3)
 This function performs known answer test(KAT) on SHA crypto engine. More...
 
int XSecure_RsaPublicEncryptKat (void)
 This function performs KAT on RSA core. More...
 
int XSecure_EllipticVerifySignKat (XSecure_EllipticCrvClass CrvClass)
 This function performs ECC sign verify known answer test(KAT) on ECC core. More...
 
int XSecure_EllipticSignGenerateKat (XSecure_EllipticCrvClass CrvClass)
 This function performs ECC sign generate known answer test(KAT) on ECC core. More...
 
int XSecure_EllipticPwct (XSecure_EllipticCrvTyp Curvetype, u64 DAddr, XSecure_EllipticKeyAddr *PubKeyAddr)
 This function performs ECC pairwise consistency test on ECC core. More...
 
int XSecure_KatIpiHandler (XPlmi_Cmd *Cmd)
 This function calls respective IPI handler based on the API_ID. More...
 
int XSecure_RsaPrivateDecryptKat (void)
 This function performs private decrypt KAT on RSA core. More...
 
int XSecure_HmacKat (XSecure_Sha *SecureSha)
 This function performs KAT on HMAC (SHA3-384). More...
 
int XSecure_Sha384Kat (void)
 This function performs KAT on SHA-384. More...
 
int XSecure_Sha2256Kat (XSecure_Sha *SecureSha2)
 This function performs known answer test(KAT) on SHA-2 crypto engine. More...
 
int XSecure_ShakeKat (XSecure_Sha *SecureShake)
 This function performs known answer test(KAT) on SHAKE crypto engine. More...
 
int XSecure_HssSha2256Kat (XSecure_Sha *ShaInstPtr, XPmcDma *DmaPtr)
 This function performs KAT on HSS SHA2 256. More...
 
int XSecure_HssShake256Kat (XSecure_Sha *ShaInstPtr, XPmcDma *DmaPtr)
 This function performs KAT on HSS SHAKE 256. More...
 
int XSecure_LmsSha2256Kat (XSecure_Sha *ShaInstPtr, XPmcDma *DmaPtr)
 This function performs KAT on LMS - SHA2 256. More...
 
int XSecure_LmsShake256Kat (XSecure_Sha *ShaInstPtr, XPmcDma *DmaPtr)
 This function performs KAT on LMS SHAKE 256. More...
 
int XSecure_KatPlatIpiHandler (XPlmi_Cmd *Cmd)
 This function calls respective IPI handler based on the API_ID. More...
 
int XSecure_RsaPwct (XSecure_RsaPrivKey *PrivKey, XSecure_RsaPubKey *PubKey, void *ShaInstancePtr, XSecure_ShaMode Shatype)
 This function performs pairwise consistency test for generated RSA key pair using OAEP encrypt and decrypt operation. More...
 
int XSecure_UpdateKatStatusIpiHandler (XPlmi_Cmd *Cmd)
 This function calls respective IPI handler based on the API_ID. More...
 

AES KAT parameters

#define XSECURE_KAT_AES_SPLIT_DATA_SIZE   (4U)
 < AES KAT parameters More...
 
#define XSECURE_KAT_KEY_SIZE_IN_WORDS   (8U)
 
#define XSECURE_KAT_OPER_DATA_SIZE_IN_WORDS   (16U)
 

Macro Definition Documentation

#define XSECURE_DDR_KAT_MASK_MUL   (4U)

Multiplier to get DDR KAT mask.

Referenced by XSecure_UpdateKatStatusIpiHandler().

#define XSECURE_DDR_MAX_SUPPORT   (7U)

Maximum supported DDR.

Referenced by XSecure_UpdateKatStatusIpiHandler().

#define XSECURE_DEF_KAT_MASK   (0xFFFFFFFFU)

KAT mask.

Referenced by XSecure_UpdateKatStatusIpiHandler().

#define XSECURE_KAT_AAD_SIZE_IN_BYTES   (16U)

AAD size of known answer test in bytes.

Referenced by XSecure_AesDecryptKat(), and XSecure_AesEncryptKat().

#define XSECURE_KAT_AES_SPLIT_DATA_SIZE   (4U)

< AES KAT parameters

#define XSECURE_KAT_ECC_P521_SHA3_HASH_SIZE_IN_BYTES   (66U)

Hash size of ECC P521 and SHA3 in bytes.

#define XSECURE_KAT_IV_SIZE_IN_BYTES   (16U)

IV size of known answer test in bytes.

#define XSECURE_KAT_KEY_SIZE_IN_BYTES   (32U)

Key size of known answer test in bytes.

Referenced by XSecure_HmacKat().

#define XSECURE_KAT_MAX_CMD_LEN   (4U)

Maximum command length.

Referenced by XSecure_UpdateKatStatusIpiHandler().

#define XSECURE_KAT_MSG_LEN_IN_BYTES   (32U)
#define XSECURE_KAT_MSG_LEN_IN_WORDS   (8U)

Message length of known answer test in words.

Referenced by XSecure_AesDecryptKat(), and XSecure_AesEncryptKat().

#define XSECURE_KAT_RSA_PUB_EXP   (0x1000100U)

RSA public exponent of known answer test.

Referenced by XSecure_RsaPublicEncryptKat().

Function Documentation

int XSecure_AesDecryptCmKat ( const XSecure_Aes *  AesInstance)

This function performs known answer test(KAT) on AES engine to confirm DPA counter measures is working fine.

Parameters
AesInstancePointer to the XSecure_Aes instance
Returns
  • XST_SUCCESS When KAT Pass
  • XSECURE_AESKAT_INVALID_PARAM On invalid argument
  • XSECURE_AES_KAT_BUSY when AES is busy
  • XSECURE_AES_STATE_MISMATCH_ERROR If AES state is mismatched
  • XSECURE_AESDPACM_KAT_CHECK1_FAILED_ERROR Error when AESDPACM data not matched with expected data
  • XSECURE_AESDPACM_KAT_CHECK2_FAILED_ERROR Error when AESDPACM data not matched with expected data
  • XSECURE_AESDPACM_KAT_CHECK3_FAILED_ERROR Error when AESDPACM data not matched with expected data
  • XSECURE_AESDPACM_KAT_CHECK4_FAILED_ERROR Error when AESDPACM data not matched with expected data
  • XSECURE_AESDPACM_KAT_CHECK5_FAILED_ERROR Error when AESDPACM data not matched with expected data
  • XST_FAILURE On failure

Perform KAT on AES engine to know performance integrity

References XSECURE_AES_KAT_BUSY, XSECURE_AES_STATE_MISMATCH_ERROR, XSECURE_AES_USER_KEY_7, XSECURE_AESDPACM_KAT_CHECK1_FAILED_ERROR, XSECURE_AESDPACM_KAT_CHECK2_FAILED_ERROR, XSECURE_AESDPACM_KAT_CHECK3_FAILED_ERROR, XSECURE_AESDPACM_KAT_CHECK4_FAILED_ERROR, XSECURE_AESDPACM_KAT_CHECK5_FAILED_ERROR, XSecure_AesDpaCmDecryptData(), XSECURE_AESKAT_INVALID_PARAM, and XSecure_AesKeyZero().

int XSecure_AesDecryptKat ( XSecure_Aes *  AesInstance)

This function performs decryption known answer test(KAT) on AES engine.

Parameters
AesInstancePointer to the XSecure_Aes instance
Returns
  • XST_SUCCESS When KAT Pass
  • XSECURE_AESKAT_INVALID_PARAM Invalid Argument
  • XSECURE_AES_KAT_BUSY Error when AES is busy
  • XSECURE_AES_STATE_MISMATCH_ERROR Error when AES state is mismatched
  • XSECURE_AES_KAT_WRITE_KEY_FAILED_ERROR Error when AES key write fails
  • XSECURE_AES_KAT_DECRYPT_INIT_FAILED_ERROR Error when AES decrypt init fails
  • XSECURE_AES_KAT_UPDATE_AAD_FAILED_ERROR Error when update AAD fails
  • XSECURE_AES_KAT_DECRYPT_UPDATE_FAILED_ERROR Error when decrypt update fails
  • XSECURE_AES_KAT_GCM_TAG_MISMATCH_ERROR Error when GCM tag not matched with user provided tag
  • XSECURE_AES_KAT_DATA_MISMATCH_ERROR Error when AES data not matched with expected data

Write AES key

Configure AES engine to decryption

Update AAD

Update input and output addresses to AES engine

Verify the GCM Tag

Validate the decrypted data with expected data provided

References XSECURE_AES_KAT_BUSY, XSECURE_AES_KAT_DATA_MISMATCH_ERROR, XSECURE_AES_KAT_DECRYPT_INIT_FAILED_ERROR, XSECURE_AES_KAT_DECRYPT_UPDATE_FAILED_ERROR, XSECURE_AES_KAT_GCM_TAG_MISMATCH_ERROR, XSECURE_AES_KAT_UPDATE_AAD_FAILED_ERROR, XSECURE_AES_KAT_WRITE_KEY_FAILED_ERROR, XSECURE_AES_STATE_MISMATCH_ERROR, XSECURE_AES_USER_KEY_7, XSecure_AesDecryptFinal(), XSecure_AesDecryptInit(), XSecure_AesDecryptUpdate(), XSECURE_AESKAT_INVALID_PARAM, XSecure_AesKeyZero(), XSecure_AesUpdateAad(), XSecure_AesWriteKey(), XSecure_ConfigureDmaByteSwap(), XSECURE_ENABLE_BYTE_SWAP, XSecure_GetKatMessage(), XSECURE_KAT_AAD_SIZE_IN_BYTES, XSECURE_KAT_MSG_LEN_IN_BYTES, and XSECURE_KAT_MSG_LEN_IN_WORDS.

int XSecure_AesEncryptKat ( XSecure_Aes *  AesInstance)

This function performs encryption known answer test(KAT) on AES engine.

Parameters
AesInstancePointer to the XSecure_Aes instance
Returns
  • XST_SUCCESS When KAT Pass
  • XSECURE_AESKAT_INVALID_PARAM Invalid Argument
  • XSECURE_AES_KAT_BUSY Error when AES is busy
  • XSECURE_AES_STATE_MISMATCH_ERROR Error when AES state is mismatched
  • XSECURE_AES_KAT_WRITE_KEY_FAILED_ERROR Error when AES key write fails
  • XSECURE_AES_KAT_ENCRYPT_INIT_FAILED_ERROR Error when AES encrypt init fails
  • XSECURE_AES_KAT_UPDATE_AAD_FAILED_ERROR Error when update AAD fails
  • XSECURE_AES_KAT_ENCRYPT_UPDATE_FAILED_ERROR Error when AES encrypt update fails
  • XSECURE_AES_KAT_ENCRYPT_FINAL_FAILED_ERROR Error when AES encrypt final fails
  • XSECURE_KAT_GCM_TAG_MISMATCH_ERROR Error when GCM tag not matched with user provided tag
  • XSECURE_AES_KAT_DATA_MISMATCH_ERROR Error when AES data not matched with expected data

Write AES key

Configure AES engine to encryption

Update AAD

Update input and output addresses to AES engine

Update output address to AES engine to store GCM Tag

Validate the encrypted data with expected data provided

Validate the GCM Tag

References XSECURE_AES_KAT_BUSY, XSECURE_AES_KAT_DATA_MISMATCH_ERROR, XSECURE_AES_KAT_ENCRYPT_FINAL_FAILED_ERROR, XSECURE_AES_KAT_ENCRYPT_INIT_FAILED_ERROR, XSECURE_AES_KAT_ENCRYPT_UPDATE_FAILED_ERROR, XSECURE_AES_KAT_UPDATE_AAD_FAILED_ERROR, XSECURE_AES_KAT_WRITE_KEY_FAILED_ERROR, XSECURE_AES_STATE_MISMATCH_ERROR, XSECURE_AES_USER_KEY_7, XSecure_AesEncryptFinal(), XSecure_AesEncryptInit(), XSecure_AesEncryptUpdate(), XSECURE_AESKAT_INVALID_PARAM, XSecure_AesKeyZero(), XSecure_AesUpdateAad(), XSecure_AesWriteKey(), XSecure_ConfigureDmaByteSwap(), XSECURE_ENABLE_BYTE_SWAP, XSecure_GetKatMessage(), XSECURE_KAT_AAD_SIZE_IN_BYTES, XSECURE_KAT_GCM_TAG_MISMATCH_ERROR, XSECURE_KAT_MSG_LEN_IN_BYTES, and XSECURE_KAT_MSG_LEN_IN_WORDS.

int XSecure_EllipticPwct ( XSecure_EllipticCrvTyp  Curvetype,
u64  DAddr,
XSecure_EllipticKeyAddr PubKeyAddr 
)

This function performs ECC pairwise consistency test on ECC core.

Parameters
CurvetypeType of ECC curve used for authentication
DAddrAddress of ECC private key
PubKeyAddrAddress of ECC public key
Returns
  • XST_SUCCESS When KAT passes
  • XSECURE_ELLIPTIC_KAT_INVLD_CRV_ERROR When input is invalid
  • XSECURE_ELLIPTIC_KAT_GENERATE_SIGN_64BIT_ERROR When generate signature fails
  • XSECURE_ELLIPTIC_KAT_64BIT_SIGN_VERIFY_ERROR When verify sign is invalid

Get size as per the curve type

Generate signature for given Hash and curve type

Verify the signature

References XSecure_EllipticHashData::Addr, K, XSecure_EllipticHashData::Len, XSecure_EllipticSignAddr::SignR, XSecure_EllipticSignAddr::SignS, XSECURE_ECC_NIST_P192, XSECURE_ECC_NIST_P224, XSECURE_ECC_NIST_P256, XSECURE_ECC_NIST_P384, XSECURE_ECC_NIST_P521, XSECURE_ECC_P192_SIZE_IN_BYTES, XSECURE_ECC_P224_SIZE_IN_BYTES, XSECURE_ECC_P256_SIZE_IN_BYTES, XSECURE_ECC_P384_SIZE_IN_BYTES, XSECURE_ECC_P521_SIZE_IN_BYTES, XSECURE_ELLIPTIC_KAT_64BIT_SIGN_VERIFY_ERROR, XSECURE_ELLIPTIC_KAT_GENERATE_SIGN_64BIT_ERROR, XSECURE_ELLIPTIC_KAT_INVLD_CRV_ERROR, XSecure_EllipticGenerateSignature_64Bit(), XSecure_EllipticVerifySign_64Bit(), and XSecure_GetKatEccEphemeralKey().

int XSecure_EllipticSignGenerateKat ( XSecure_EllipticCrvClass  CrvClass)

This function performs ECC sign generate known answer test(KAT) on ECC core.

Parameters
CrvClassType of ECC curve class either prime or binary class
Returns
  • XST_SUCCESS When KAT passes
  • XSECURE_ELLIPTIC_KAT_INVLD_CRV_ERROR When input is invalid.
  • XSECURE_ELLIPTIC_KAT_GENERATE_SIGN_ERROR When generate sign fails
  • XSECURE_ELLIPTIC_KAT_GENERATE_SIGNR_ERROR When SignR is mismatched

Generates signature for the provided hash and curve type and then perform KAT using that signature.

References D, K, XSecure_EllipticSign::SignR, XSecure_EllipticSign::SignS, XSECURE_ECC_NIST_P384, XSECURE_ECC_P384_SIZE_IN_BYTES, XSECURE_ELLIPTIC_KAT_GENERATE_SIGN_ERROR, XSECURE_ELLIPTIC_KAT_GENERATE_SIGNR_ERROR, XSECURE_ELLIPTIC_KAT_INVLD_CRV_ERROR, XSecure_EllipticGenerateSignature(), XSecure_GetKatEccEphemeralKey(), XSecure_GetKatEccExpSign(), and XSecure_GetKatEccPrivateKey().

int XSecure_EllipticVerifySignKat ( XSecure_EllipticCrvClass  CrvClass)

This function performs ECC sign verify known answer test(KAT) on ECC core.

Parameters
CrvClassType of ECC curve class either prime or binary curve
Returns
  • XST_SUCCESS On success
  • XSECURE_ELLIPTIC_KAT_KEY_NOTVALID_ERROR When elliptic key is invalid
  • XSECURE_ELLIPTIC_KAT_INVLD_CRV_ERROR Error when input is invalid
  • XSECURE_ELLIPTIC_KAT_SIGN_VERIFY_ERROR When signature is invalid

References XSecure_EllipticKey::Qx, XSecure_EllipticKey::Qy, XSecure_EllipticSign::SignR, XSecure_EllipticSign::SignS, XSECURE_ECC_NIST_P384, XSECURE_ELLIPTIC_KAT_INVLD_CRV_ERROR, XSECURE_ELLIPTIC_KAT_KEY_NOTVALID_ERROR, XSECURE_ELLIPTIC_KAT_SIGN_VERIFY_ERROR, XSecure_EllipticValidateKey(), XSecure_EllipticVerifySign(), XSecure_GetKatEccExpSign(), and XSecure_GetKatEccPublicKey().

u8 * XSecure_GetKatAesKey ( void  )

This function returns AES key for KAT.

Returns
  • AES key for KAT

Referenced by XSecure_HmacKat().

u8 * XSecure_GetKatEccEphemeralKey ( XSecure_EllipticCrvTyp  CrvType)

This function returns ECC ephemeral key to perform KAT.

Parameters
CrvTypeECC curve type
Returns
  • ECC ephemeral key

References K, XSECURE_ECC_NIST_P192, XSECURE_ECC_NIST_P224, XSECURE_ECC_NIST_P256, XSECURE_ECC_NIST_P384, and XSECURE_ECC_NIST_P521.

Referenced by XSecure_EllipticPwct(), and XSecure_EllipticSignGenerateKat().

XSecure_EllipticSign * XSecure_GetKatEccExpSign ( XSecure_EllipticCrvClass  CrvClass)

This function returns ECC expected signature to perform KAT.

Parameters
CrvClassECC curve class
Returns
  • ECC expected signature

References XSecure_EllipticSign::SignR, XSecure_EllipticSign::SignS, XSECURE_ECC_P384_SIZE_IN_BYTES, and XSECURE_ECC_PRIME.

Referenced by XSecure_EllipticSignGenerateKat(), and XSecure_EllipticVerifySignKat().

u8 * XSecure_GetKatEccPrivateKey ( XSecure_EllipticCrvClass  CrvClass)

This function returns ECC private key to perform KAT.

Parameters
CrvClassECC curve class
Returns
  • ECC private key

References D, and XSECURE_ECC_PRIME.

Referenced by XSecure_EllipticSignGenerateKat().

XSecure_EllipticKey * XSecure_GetKatEccPublicKey ( XSecure_EllipticCrvClass  CrvClass)

This function returns ECC public key to perform KAT.

Parameters
CrvClassECC curve class
Returns
  • ECC public key

References XSecure_EllipticKey::Qx, XSecure_EllipticKey::Qy, XSECURE_ECC_P384_SIZE_IN_BYTES, and XSECURE_ECC_PRIME.

Referenced by XSecure_EllipticVerifySignKat().

u8 * XSecure_GetKatMessage ( void  )

This function returns message to perform KAT.

Returns
  • Message to perform KAT

Referenced by XSecure_AesDecryptKat(), XSecure_AesEncryptKat(), XSecure_HmacKat(), XSecure_RsaPwct(), and XSecure_Sha384Kat().

u32 * XSecure_GetKatRsaCtData ( void  )

This function returns cipher text data for RSA KAT.

Returns
  • Expected cipher text for RSA KAT

Referenced by XSecure_RsaPrivateDecryptKat().

u32 * XSecure_GetKatRsaData ( void  )

This function returns data for RSA KAT.

Returns
  • Input data to be encrypted for RSA KAT

Referenced by XSecure_RsaPrivateDecryptKat().

u32 * XSecure_GetKatRsaModExt ( void  )

This function returns public pre-calculated exponential (R^2 Mod N) value for RSA KAT.

Returns
  • RSA pre-calculated exponential (R^2 Mod N) value for KAT

Referenced by XSecure_RsaPrivateDecryptKat().

u32 * XSecure_GetKatRsaModulus ( void  )

This function returns modulus for RSA KAT.

Returns
  • RSA modulus for KAT

Referenced by XSecure_RsaPrivateDecryptKat().

u32 * XSecure_GetKatRsaPrivateExp ( void  )

This function returns private exponent for RSA KAT.

Returns
  • RSA private exponent for KAT

References XSECURE_RSA_2048_SIZE_WORDS.

Referenced by XSecure_RsaPrivateDecryptKat().

u8 * XSecure_GetKatSha3ExpHash ( void  )

This function returns expected SHA3 hash for KAT.

Returns
  • Expected SHA3 hash for KAT
int XSecure_HmacKat ( XSecure_Sha *  SecureSha)

This function performs KAT on HMAC (SHA3-384).

Parameters
SecureSha3Pointer to SHA3 instance
Returns
  • XST_SUCCESS On success
  • XSECURE_HMAC_KAT_INIT_ERROR If HMAC init fails
  • XSECURE_HMAC_KAT_UPDATE_ERROR If HMAC update fails
  • XSECURE_HMAC_KAT_FINAL_ERROR If HMAC final fails
  • XSECURE_HMAC_KAT_ERROR If HMAC KAT fails

References XSecure_GetKatAesKey(), XSecure_GetKatMessage(), XSECURE_HMAC_KAT_ERROR, XSECURE_HMAC_KAT_FINAL_ERROR, XSECURE_HMAC_KAT_INIT_ERROR, XSECURE_HMAC_KAT_UPDATE_ERROR, XSecure_HmacFinal(), XSecure_HmacInit(), XSecure_HmacUpdate(), XSECURE_KAT_KEY_SIZE_IN_BYTES, and XSECURE_KAT_MSG_LEN_IN_BYTES.

int XSecure_HssSha2256Kat ( XSecure_Sha *  ShaInstPtr,
XPmcDma *  DmaPtr 
)

This function performs KAT on HSS SHA2 256.

Parameters
ShaInstPtrPointer to the XSecure_Sha instance
DmaPtrPointer to the XPmcDma instance
Returns
  • XST_SUCCESS - If HSS SHA2 256 KAT is passed.
  • XSECURE_HSS_SHA2_256_KAT_ERROR - HSS SHA2-256 KAT error

References XSECURE_HSS_PUBLIC_KEY_TOTAL_SIZE, XSECURE_HSS_SHA2_256_KAT_ERROR, XSecure_HssFinish(), XSecure_HssInit(), and XSecure_LmsHashMessage().

int XSecure_HssShake256Kat ( XSecure_Sha *  ShaInstPtr,
XPmcDma *  DmaPtr 
)

This function performs KAT on HSS SHAKE 256.

Parameters
ShaInstPtrPointer to the XSecure_Sha instance
DmaPtrPointer to the XPmcDma instance
Returns
  • XST_SUCCESS - If HSS SHAKE256 KAT is passed.
  • XSECURE_HSS_SHAKE_256_KAT_ERROR - HSS SHAKE 256 KAT error

References XSECURE_HSS_PUBLIC_KEY_TOTAL_SIZE, XSECURE_HSS_SHAKE_256_KAT_ERROR, XSecure_HssFinish(), XSecure_HssInit(), XSecure_LmsHashMessage(), and XSECURE_SHAKE_256.

int XSecure_KatIpiHandler ( XPlmi_Cmd *  Cmd)

This function calls respective IPI handler based on the API_ID.

Parameters
Cmdis pointer to the command structure
Returns
  • XST_SUCCESS If the handler execution is successful
  • XST_INVALID_PARAM If Cmd is NULL or invalid API ID is received.
  • XST_FAILURE If there is a failure

Call the respective API handler according to API ID

SHA IPI event handling

References XSECURE_API, XSECURE_API_AES_DECRYPT_CM_KAT, XSECURE_API_AES_DECRYPT_KAT, XSECURE_API_AES_ENCRYPT_KAT, XSECURE_API_ELLIPTIC_SIGN_GEN_KAT, XSECURE_API_ELLIPTIC_SIGN_VERIFY_KAT, XSECURE_API_ID_MASK, XSECURE_API_RSA_PRIVATE_DEC_KAT, XSECURE_API_RSA_PUB_ENC_KAT, XSECURE_API_SHA3_KAT, XSecure_EllipticSignGenKat(), XSecure_EllipticSignVerifyKat(), XSecure_GetAesInstance(), XSecure_GetSha3Instance(), XSecure_IpiEventHandling(), XSecure_MakeResFree(), XSecure_Printf, and XSecure_RsaPrivateDecKat().

Referenced by XSecure_KatPlatIpiHandler().

int XSecure_KatPlatIpiHandler ( XPlmi_Cmd *  Cmd)

This function calls respective IPI handler based on the API_ID.

Parameters
Cmdis pointer to the command structure
Returns
  • XST_SUCCESS If the handler execution is successful
  • XST_INVALID_PARAM If any input parameter is invalid
  • XST_FAILURE If there is a failure
  • XSecure_ShaKat

SHA IPI event handling

References XSECURE_API, XSECURE_API_ID_MASK, XSECURE_API_SHA2_KAT, XSECURE_API_TRNG_KAT, XSecure_GetSha2Instance(), XSecure_IpiEventHandling(), XSecure_KatIpiHandler(), XSecure_MakeResFree(), and XSecure_TrngKat().

int XSecure_LmsSha2256Kat ( XSecure_Sha *  ShaInstPtr,
XPmcDma *  DmaPtr 
)

This function performs KAT on LMS - SHA2 256.

Parameters
ShaInstPtrPointer to the XSecure_Sha instance
DmaPtrPointer to the XPmcDma instance
Returns
  • XST_SUCCESS - If LMS SHA2 256 KAT is passed.
  • ErrorCode - Upon failure.

References XSecure_LmsSignatureVerification().

int XSecure_LmsShake256Kat ( XSecure_Sha *  ShaInstPtr,
XPmcDma *  DmaPtr 
)

This function performs KAT on LMS SHAKE 256.

Parameters
ShaInstPtrPointer to the XSecure_Sha instance
DmaPtrPointer to the XPmcDma instance
Returns
  • XST_SUCCESS - If LMS SHAKE256 KAT is passed.
  • ErrorCode - Upon failure.

References XSecure_LmsSignatureVerification().

int XSecure_RsaPrivateDecryptKat ( void  )

This function performs private decrypt KAT on RSA core.

Returns
  • XST_SUCCESS On success
  • XSECURE_RSA_KAT_INIT_ERROR When RSA initialization fails
  • XSECURE_RSA_KAT_DECRYPT_FAILED_ERROR When RSA KAT fails
  • XSECURE_RSA_KAT_DECRYPT_DATA_MISMATCH_ERROR Error when RSA data not matched with expected data
  • XST_SUCCESS On success
  • XSECURE_RSA_KAT_DECRYPT_DATA_MISMATCH_ERROR Error when RSA data not matched with expected data
  • XST_FAILURE On failure

Initialize RSA

Perform RSA private decrypt operation

Validate the decrypted data with the expected data provided

References XSecure_GetKatRsaCtData(), XSecure_GetKatRsaData(), XSecure_GetKatRsaModExt(), XSecure_GetKatRsaModulus(), XSecure_GetKatRsaPrivateExp(), XSECURE_RSA_2048_KEY_SIZE, XSECURE_RSA_2048_SIZE_WORDS, XSECURE_RSA_KAT_DECRYPT_DATA_MISMATCH_ERROR, XSECURE_RSA_KAT_DECRYPT_FAILED_ERROR, XSECURE_RSA_KAT_ENCRYPT_DATA_MISMATCH_ERROR, XSECURE_RSA_KAT_INIT_ERROR, XSecure_RsaInitialize(), and XSecure_RsaPrivateDecrypt().

int XSecure_RsaPublicEncryptKat ( void  )

This function performs KAT on RSA core.

Returns
  • XST_SUCCESS On success
  • XSECURE_RSA_KAT_INIT_ERROR Error when RSA init fails
  • XSECURE_RSA_KAT_ENCRYPT_FAILED_ERROR When RSA KAT fails
  • XSECURE_RSA_KAT_ENCRYPT_DATA_MISMATCH_ERROR Error when RSA data not matched with expected data

Initialize the RSA instance

Perform the public encrypt operation

Validate the encrypted data with the expected data provided

References XSECURE_KAT_RSA_PUB_EXP, XSECURE_RSA_2048_KEY_SIZE, XSECURE_RSA_2048_SIZE_WORDS, XSECURE_RSA_KAT_ENCRYPT_DATA_MISMATCH_ERROR, XSECURE_RSA_KAT_ENCRYPT_FAILED_ERROR, XSECURE_RSA_KAT_INIT_ERROR, XSecure_RsaInitialize(), and XSecure_RsaPublicEncrypt().

int XSecure_RsaPwct ( XSecure_RsaPrivKey *  PrivKey,
XSecure_RsaPubKey *  PubKey,
void *  ShaInstancePtr,
XSecure_ShaMode  Shatype 
)

This function performs pairwise consistency test for generated RSA key pair using OAEP encrypt and decrypt operation.

Parameters
PrivKeyPointer to the XSecure_RsaKey
PubKeyPointer to the XSecure_RsaPubKey
ShaInstancePtrPointer to the SHA instance used during OAEP encoding for MGF
Shatypeis SHA algorithm type used for MGF
Returns
  • XST_SUCCESS On Success
  • XST_INVALID_PARAM If any input parameter is invalid
  • XSECURE_RSA_PWCT_MEM_CMP_FAILED_ERROR If RSA pwct comparison fails
  • XST_FAILURE On Failure

References XSecure_RsaOaepParam::InputDataAddr, XSecure_RsaOaepParam::InputDataSize, XSecure_Rsa::Mod, XSecure_RsaOaepParam::OutputDataAddr, XSecure_RsaOaepParam::OutputDataSize, XSecure_RsaOaepParam::ShaInstancePtr, XSecure_RsaOaepParam::ShaType, XSecure_GetKatMessage(), XSECURE_KAT_MSG_LEN_IN_BYTES, XSECURE_RSA_KEY_GEN_SIZE_IN_BYTES, XSECURE_RSA_PUB_EXP_SIZE, XSECURE_RSA_PWCT_MEM_CMP_FAILED_ERROR, XSecure_RsaInitialize(), XSecure_RsaOaepDecrypt(), and XSecure_RsaOaepEncrypt().

int XSecure_Sha2256Kat ( XSecure_Sha *  SecureSha2)

This function performs known answer test(KAT) on SHA-2 crypto engine.

Parameters
SecureSha2Pointer to the XSecure_Sha instance
Returns
  • XST_SUCCESS On success.
  • XST_FAILURE On KAT failure.

References XSecure_SetReset(), and XSECURE_SHA2_256_HASH_LEN.

int XSecure_Sha384Kat ( void  )

This function performs KAT on SHA-384.

Returns
  • XST_SUCCESS On success
  • XSECURE_SHA384_KAT_ERROR If SHA384 KAT fails
  • XST_FAILURE On failure

References XSecure_GetKatMessage(), XSECURE_KAT_MSG_LEN_IN_BYTES, and XSECURE_SHA384_KAT_ERROR.

int XSecure_Sha3Kat ( XSecure_Sha3 *  SecureSha3)

This function performs known answer test(KAT) on SHA crypto engine.

Parameters
SecureSha3Pointer to the XSecure_Sha3 instance
Returns
  • XST_SUCCESS When KAT Pass
  • XSECURE_SHA3_INVALID_PARAM On invalid argument
  • XSECURE_SHA3_KAT_BUSY Error when SHA3 is busy
  • XSECURE_SHA3_LAST_UPDATE_ERROR Error when SHA3 last update fails
  • XSECURE_SHA3_KAT_FAILED_ERROR Error when SHA3 hash not matched with expected hash
  • XSECURE_SHA3_PMC_DMA_UPDATE_ERROR Error when DMA driver fails to update the data to SHA3
  • XSECURE_SHA3_FINISH_ERROR Error when SHA3 finish fails

Configure SSS and start SHA-3 engine

Update SHA3 engine with input data

Update SHA3 engine with padded data if required and reads the hash

Validate the generated hash with the provided expected hash

References XSECURE_KAT_MSG_LEN_IN_BYTES, XSecure_SetReset(), XSECURE_SHA3_KAT_BUSY, and XSecure_Sha3Hash().

int XSecure_ShakeKat ( XSecure_Sha *  SecureShake)

This function performs known answer test(KAT) on SHAKE crypto engine.

Parameters
SecureShakePointer to the XSecure_Sha instance
Returns
  • XST_SUCCESS On success.
  • XST_FAILURE On KAT failure.

References XSecure_SetReset(), XSECURE_SHAKE_256, and XSECURE_SHAKE_256_HASH_LEN.

int XSecure_UpdateKatStatusIpiHandler ( XPlmi_Cmd *  Cmd)

This function calls respective IPI handler based on the API_ID.

Parameters
Cmdis pointer to the command structure
Returns
  • XST_SUCCESS On Success
  • XST_INVALID_PARAM If any input parameter is invalid
  • XST_FAILURE On failure

References XSECURE_API, XSECURE_API_KAT_CLEAR, XSECURE_API_KAT_SET, XSECURE_API_UPDATE_CPM5N_KAT_STATUS, XSECURE_API_UPDATE_DDR_KAT_STATUS, XSECURE_API_UPDATE_HNIC_KAT_STATUS, XSECURE_API_UPDATE_PCIDE_KAT_STATUS, XSECURE_API_UPDATE_PKI_KAT_STATUS, XSECURE_DDR_KAT_MASK_MUL, XSECURE_DDR_MAX_SUPPORT, XSECURE_DEF_KAT_MASK, XSECURE_KAT_HDR_LEN, XSECURE_KAT_MAX_CMD_LEN, XSECURE_MAX_KAT_MASK_LEN, and XSecure_Printf.