![]() |
xilsecure
Vitis Drivers API Documentation
|
Data Structures | |
| struct | XSecure_RsaOaepParam |
| Input and output parameters for RSA Optimal Asymmetric Encryption Padding scheme. More... | |
| struct | XSecure_RsaKey |
| Input parameters pointers for RSA. More... | |
| struct | XSecure_Rsa |
| The RSA driver instance data structure. More... | |
Macros | |
| #define | XSECURE_RSA_MAX_MSG_SIZE_IN_BYTES |
| RSA maximum message size in bytes. More... | |
| #define | XSECURE_RSA_MAX_PS_SIZE_IN_BYTES (XSECURE_RSA_MAX_MSG_SIZE_IN_BYTES) |
| RSA maximum PS size in bytes. More... | |
| #define | XSECURE_RSA_MAX_DB_SIZE_IN_BYTES |
| RSA maximum DB size in bytes. More... | |
| #define | externC extern |
| For compilation in C++. More... | |
| #define | XSECURE_RSA_KEY_GEN_SIZE_IN_BYTES (XSECURE_RSA_3072_SIZE_WORDS * 4U) |
| RSA default key size in bytes. More... | |
| #define | XSECURE_RSA_KEY_GEN_SIZE_IN_WORDS (XSECURE_RSA_KEY_GEN_SIZE_IN_BYTES / 4U) |
| RSA key generation size in words. More... | |
| #define | XSECURE_RSA_MAX_KEY_GEN_SUPPORT (2U) |
| Maximum keys that needs to be generated. More... | |
| #define | XSECURE_RSA_KEY_STATUS_WAIT (1U) |
| RSA key status wait. More... | |
| #define | XSECURE_RSA_2048_QUANT_SIZE (5U) |
| RSA maximum quant size for 2048 bit key. More... | |
| #define | XSECURE_RSA_3072_QUANT_SIZE (2U) |
| RSA maximum quant size for 3072 bit key. More... | |
| #define | XSECURE_RSA_4096_QUANT_SIZE (1U) |
| RSA maximum quant size for 4096 bit key. More... | |
| #define | XSECURE_RSA_PUBLIC_EXPONENT (0x10001U) |
| RSA public exponent value. More... | |
| #define | XSECURE_RSA_PUB_EXP_SIZE (4U) |
| RSA public exponent size. More... | |
| #define | XSECURE_KEY_PAIR_GEN_POLL_INTERVAL (100U) |
| Key pair generation poll interval. More... | |
| #define | XSECURE_ECDSA_RSA_SOFT_RESET (0xF1200040U) |
| ECDSA/RSA soft reset address. More... | |
| #define | XSECURE_RSA_SIZE_IN_BYTES (512U) |
| 512 bytes for 4096 bit data More... | |
| #define | XSECURE_PRIME_FACTOR_P_SIZE (XSECURE_RSA_KEY_GEN_SIZE_IN_BYTES >> 1U) |
| size of first prime factor(P) More... | |
| #define | XSECURE_PRIME_FACTOR_Q_SIZE (XSECURE_RSA_KEY_GEN_SIZE_IN_BYTES >> 1U) |
| size of first prime factor(Q) More... | |
| #define | XSECURE_PRIME_FACTOR_MAX_P_SIZE (XSECURE_RSA_SIZE_IN_BYTES >> 1U) |
| 256 bytes size of first prime factor(P) More... | |
| #define | XSECURE_PRIME_FACTOR_MAX_Q_SIZE (XSECURE_RSA_SIZE_IN_BYTES >> 1U) |
| 256 bytes size of first prime factor(Q) More... | |
| #define | XSECURE_RSA_PUBLIC_EXPO_SIZE (4U) |
| Size of public key expo. More... | |
| #define | XSECURE_RSA_BYTE_PAD_LENGTH (3U) |
| PKCS Byte Padding. More... | |
| #define | XSECURE_RSA_T_PAD_LENGTH (19U) |
| PKCS T Padding. More... | |
| #define | XSECURE_RSA_BYTE_PAD1 (0X00U) |
| PKCS T Padding Byte. More... | |
| #define | XSECURE_RSA_BYTE_PAD2 (0X01U) |
| PKCS T Padding Byte. More... | |
| #define | XSECURE_RSA_BYTE_PAD3 (0XFFU) |
| PKCS T Padding Byte. More... | |
| #define | XSECURE_RSA_INVALID_PARAM (0x82U) |
| Invalid Argument. More... | |
| #define | XSECURE_RSA_STATE_MISMATCH_ERROR (0x84U) |
| State mismatch. More... | |
| #define | XSECURE_TIMEOUT_MAX (0x1FFFFFU) |
| Recommended software timeout. More... | |
| #define | SIZEOF_INT_IN_BYTES (0x4U) |
| Size of integer om bytes. More... | |
| #define | XSECURE_RSA_ECDSA_ZEROIZE_ERROR (0x80U) |
| for RSA zeroization Error More... | |
| #define | XSECURE_RSA_MAX_BUFF (6U) |
| RSA RAM Write Buffers. More... | |
| #define | XSECURE_RSA_MAX_RD_WR_CNT (22U) |
| No of writes or reads to RSA RAM buffers. More... | |
| #define | XSECURE_RSA_RAM_RES_Q (5U) |
| bit for RSA RAM Result(Q) More... | |
| #define | XSECURE_RSA_DATA_VALUE_ERROR (0x2U) |
| for RSA private decryption data should be lesser than modulus More... | |
| #define | XSECURE_HASH_TYPE_SHA3 (48U) |
| SHA-3 hash size. More... | |
| #define | XSECURE_FSBL_SIG_SIZE (512U) |
| FSBL signature size. More... | |
| #define | XSECURE_RSA_2048_KEY_SIZE (2048U/8U) |
| RSA 2048 key size. More... | |
| #define | XSECURE_RSA_3072_KEY_SIZE (3072U/8U) |
| RSA 3072 key size. More... | |
| #define | XSECURE_RSA_4096_KEY_SIZE (4096U/8U) |
| RSA 4096 key size. More... | |
| #define | XSECURE_RSA_2048_SIZE_WORDS (64) |
| RSA 2048 Size in words. More... | |
| #define | XSECURE_RSA_3072_SIZE_WORDS (96) |
| RSA 3072 Size in words. More... | |
| #define | XSECURE_RSA_4096_SIZE_WORDS (128U) |
| RSA 4096 Size in words. More... | |
| #define | XSECURE_RSA_RAM_EXPO (0U) |
| bit for RSA RAM Exponent More... | |
| #define | XSECURE_RSA_RAM_MOD (1U) |
| bit for RSA RAM modulus More... | |
| #define | XSECURE_RSA_RAM_DIGEST (2U) |
| bit for RSA RAM Digest More... | |
| #define | XSECURE_RSA_RAM_RES_Y (4U) |
| bit for RSA RAM Result(Y) More... | |
| #define | XSECURE_RSA_BYTE_PAD_LENGTH (3U) |
| PKCS Byte Padding. More... | |
| #define | XSECURE_RSA_T_PAD_LENGTH (19U) |
| PKCS T Padding. More... | |
| #define | XSECURE_RSA_BYTE_PAD1 (0X00U) |
| PKCS T Padding Byte. More... | |
| #define | XSECURE_RSA_BYTE_PAD2 (0X01U) |
| PKCS T Padding Byte. More... | |
| #define | XSECURE_RSA_BYTE_PAD3 (0XFFU) |
| PKCS T Padding Byte. More... | |
| #define | XSECURE_RSA_INVALID_PARAM (0x82U) |
| Invalid Argument. More... | |
| #define | XSECURE_RSA_STATE_MISMATCH_ERROR (0x84U) |
| State mismatch. More... | |
Enumerations | |
| enum | XSecure_RsaKeyOpState { XSECURE_RSA_KEY_DEFAULT_STATE = 0, XSECURE_RSA_KEY_INIT_STATE, XSECURE_RSA_KEY_GEN_STATE, XSECURE_RSA_KEY_READY_STATE } |
| enum | XSecure_RsaKeyStatus { XSECURE_RSA_KEY_FREE = 0, XSECURE_RSA_KEY_AVAIL } |
| enum | XSecure_RsaState { XSECURE_RSA_UNINITIALIZED = 0x0, XSECURE_RSA_INITIALIZED, XSECURE_RSA_UNINITIALIZED = 0, XSECURE_RSA_INITIALIZED } |
| Used for setting the state of RSA operation. More... | |
| enum | XSecure_RsaOps { XSECURE_RSA_SIGN_ENC = 0x0, XSECURE_RSA_SIGN_DEC } |
| Used for selecting the RSA operation. More... | |
Functions | |
| int | XSecure_RsaOaepEncrypt (XSecure_Rsa *InstancePtr, XSecure_RsaOaepParam *OaepParam) |
| This function encodes the given message using RSA OAEP and encrypts it. More... | |
| int | XSecure_RsaOaepDecrypt (XSecure_RsaPrivKey *PrivKey, XSecure_RsaOaepParam *OaepParam) |
| This function decodes the given message and decrypts it using RSA OAEP. More... | |
| int | XSecure_AddRsaKeyPairGenerationToScheduler (void) |
| This function adds periodic task of generation RSA key pair to scheduler. More... | |
| u32 | XSecure_GetRsaKeyInUseIdx (void) |
| This function returns RSA key inuse index. More... | |
| int | XSecure_RsaDestroyKeyInUse (void) |
| This function destroys the RSA key in use. More... | |
| XSecure_RsaPrivKey * | XSecure_GetRsaPrivateKey (u32 RsaIdx) |
| This function returns RSA private key. More... | |
| XSecure_RsaPubKey * | XSecure_GetRsaPublicKey (u32 RsaIdx) |
| This function returns RSA public key. More... | |
| int | XSecure_RsaInitialize_64Bit (XSecure_Rsa *InstancePtr, u64 Mod, u64 ModExt, u64 ModExpo) |
| This function initializes a a XSecure_Rsa structure with the default values located at a 64-bit address required for operating the RSA cryptographic engine. More... | |
| int | XSecure_RsaInitialize (XSecure_Rsa *InstancePtr, u8 *Mod, u8 *ModExt, u8 *ModExpo) |
| This function initializes a a XSecure_Rsa structure with the default values required for operating the RSA cryptographic engine. More... | |
| int | XSecure_RsaSignVerification_64Bit (const u64 Signature, const u64 Hash, u32 HashLen) |
| This function verifies the RSA decrypted data located at a 64-bit address provided is either matching with the provided expected hash by taking care of PKCS padding. More... | |
| int | XSecure_RsaSignVerification (const u8 *Signature, const u8 *Hash, u32 HashLen) |
| This function verifies the RSA decrypted data provided is either matching with the provided expected hash by taking care of PKCS padding. More... | |
| int | XSecure_RsaPublicEncrypt_64Bit (XSecure_Rsa *InstancePtr, u64 Input, u32 Size, u64 Result) |
| This function handles the RSA encryption for data available at 64-bit address with the public key components provided when initializing the RSA cryptographic core with the XSecure_RsaInitialize function. More... | |
| int | XSecure_RsaPublicEncrypt (XSecure_Rsa *InstancePtr, u8 *Input, u32 Size, u8 *Result) |
| This function handles the RSA encryption with the public key components provided when initializing the RSA cryptographic core with the XSecure_RsaInitialize function. More... | |
| int | XSecure_RsaPrivateDecrypt_64Bit (XSecure_Rsa *InstancePtr, u64 Input, u32 Size, u64 Result) |
| This function handles the RSA decryption for data available at 64-bit address with the private key components provided when initializing the RSA cryptographic core with the XSecure_RsaInitialize function. More... | |
| int | XSecure_RsaPrivateDecrypt (XSecure_Rsa *InstancePtr, u8 *Input, u32 Size, u8 *Result) |
| This function handles the RSA decryption with the private key components provided when initializing the RSA cryptographic core with the XSecure_RsaInitialize function. More... | |
| int | XSecure_RsaCfgInitialize (XSecure_Rsa *InstancePtr) |
| This function stores the base address of RSA core registers. More... | |
| int | XSecure_RsaOperation (XSecure_Rsa *InstancePtr, u64 Input, u64 Result, XSecure_RsaOps RsaOp, u32 KeySize) |
| This function handles the Public encryption and private decryption of RSA operations with provided inputs. More... | |
| int | XSecure_RsaZeroize (const XSecure_Rsa *InstancePtr) |
| This function clears whole RSA memory space. More... | |
| u8 * | XSecure_RsaGetTPadding (void) |
| This function returns PKCS padding as per the silicon version. More... | |
| int | XSecure_RsaEcdsaZeroizeAndVerifyRam (u32 BaseAddress) |
| This function clears and verifies whole RSA or ECDSA memory space. More... | |
| int | XSecure_RsaIpiHandler (XPlmi_Cmd *Cmd) |
| This function calls respective IPI handler based on the API_ID. More... | |
Control Register | |
| #define | XSECURE_RSA_CONTROL_EXP (0x01U) |
| Exponentiation Opcode. More... | |
| #define | XSECURE_RSA_CONTROL_EXP_PRE (0x05U) |
| Expo. More... | |
Config registers values | |
CFG0 is for Qsel and multiplication passes CFG1 is for Mont digits CFG2 is for location size CFG5 is for No.of groups | |
| #define | XSECURE_ECDSA_RSA_CFG0_4096_VALUE (0x0000006BU) |
| CFG0 4096 value. More... | |
| #define | XSECURE_ECDSA_RSA_CFG1_4096_VALUE (0x00000081U) |
| CFG1 4096 value. More... | |
| #define | XSECURE_ECDSA_RSA_CFG2_4096_VALUE (0x00000016U) |
| CFG2 4096 value. More... | |
| #define | XSECURE_ECDSA_RSA_CFG5_4096_VALUE (0x00000015U) |
| CFG3 4096 value. More... | |
| #define | XSECURE_ECDSA_RSA_CFG0_3072_VALUE (0x000000A0U) |
| CFG0 3072 value. More... | |
| #define | XSECURE_ECDSA_RSA_CFG1_3072_VALUE (0x00000061U) |
| CFG1 3072 value. More... | |
| #define | XSECURE_ECDSA_RSA_CFG2_3072_VALUE (0x00000016U) |
| CFG2 3072 value. More... | |
| #define | XSECURE_ECDSA_RSA_CFG5_3072_VALUE (0x00000010U) |
| CFG3 3072 value. More... | |
| #define | XSECURE_ECDSA_RSA_CFG0_2048_VALUE (0x00000016U) |
| CFG0 2048 value. More... | |
| #define | XSECURE_ECDSA_RSA_CFG1_2048_VALUE (0x00000041U) |
| CFG1 2048 value. More... | |
| #define | XSECURE_ECDSA_RSA_CFG2_2048_VALUE (0x00000016U) |
| CFG2 2048 value. More... | |
| #define | XSECURE_ECDSA_RSA_CFG5_2048_VALUE (0x0000000AU) |
| CFG3 2048 value. More... | |
RSA status Register | |
The Status Register(SR) indicates the current state of RSA device. Status Register Bit Definition | |
| #define | XSECURE_RSA_STATUS_DONE (0x1U) |
| Operation Done. More... | |
| #define | XSECURE_RSA_STATUS_ERROR (0x4U) |
| Error. More... | |
| #define externC extern |
For compilation in C++.
| #define SIZEOF_INT_IN_BYTES (0x4U) |
Size of integer om bytes.
| #define XSECURE_ECDSA_RSA_CFG0_2048_VALUE (0x00000016U) |
CFG0 2048 value.
Referenced by XSecure_RsaOperation().
| #define XSECURE_ECDSA_RSA_CFG0_3072_VALUE (0x000000A0U) |
CFG0 3072 value.
Referenced by XSecure_RsaOperation().
| #define XSECURE_ECDSA_RSA_CFG0_4096_VALUE (0x0000006BU) |
CFG0 4096 value.
Referenced by XSecure_RsaOperation().
| #define XSECURE_ECDSA_RSA_CFG1_2048_VALUE (0x00000041U) |
CFG1 2048 value.
Referenced by XSecure_RsaOperation().
| #define XSECURE_ECDSA_RSA_CFG1_3072_VALUE (0x00000061U) |
CFG1 3072 value.
Referenced by XSecure_RsaOperation().
| #define XSECURE_ECDSA_RSA_CFG1_4096_VALUE (0x00000081U) |
CFG1 4096 value.
Referenced by XSecure_RsaOperation().
| #define XSECURE_ECDSA_RSA_CFG2_2048_VALUE (0x00000016U) |
CFG2 2048 value.
Referenced by XSecure_RsaOperation().
| #define XSECURE_ECDSA_RSA_CFG2_3072_VALUE (0x00000016U) |
CFG2 3072 value.
Referenced by XSecure_RsaOperation().
| #define XSECURE_ECDSA_RSA_CFG2_4096_VALUE (0x00000016U) |
CFG2 4096 value.
Referenced by XSecure_RsaOperation().
| #define XSECURE_ECDSA_RSA_CFG5_2048_VALUE (0x0000000AU) |
CFG3 2048 value.
Referenced by XSecure_RsaOperation().
| #define XSECURE_ECDSA_RSA_CFG5_3072_VALUE (0x00000010U) |
CFG3 3072 value.
Referenced by XSecure_RsaOperation().
| #define XSECURE_ECDSA_RSA_CFG5_4096_VALUE (0x00000015U) |
CFG3 4096 value.
Referenced by XSecure_RsaOperation().
| #define XSECURE_ECDSA_RSA_SOFT_RESET (0xF1200040U) |
ECDSA/RSA soft reset address.
Referenced by XSecure_RsaExp(), XSecure_RsaExpCRT(), and XSecure_RsaExpopt().
| #define XSECURE_FSBL_SIG_SIZE (512U) |
FSBL signature size.
Referenced by XSecure_RsaSignVerification_64Bit().
| #define XSECURE_HASH_TYPE_SHA3 (48U) |
SHA-3 hash size.
Referenced by XSecure_DataAuth(), XSecure_PpkVerify(), XSecure_RsaSignVerification_64Bit(), and XSecure_SpkAuthentication().
| #define XSECURE_KEY_PAIR_GEN_POLL_INTERVAL (100U) |
Key pair generation poll interval.
Referenced by XSecure_AddRsaKeyPairGenerationToScheduler().
| #define XSECURE_PRIME_FACTOR_MAX_P_SIZE (XSECURE_RSA_SIZE_IN_BYTES >> 1U) |
256 bytes size of first prime factor(P)
| #define XSECURE_PRIME_FACTOR_MAX_Q_SIZE (XSECURE_RSA_SIZE_IN_BYTES >> 1U) |
256 bytes size of first prime factor(Q)
| #define XSECURE_PRIME_FACTOR_P_SIZE (XSECURE_RSA_KEY_GEN_SIZE_IN_BYTES >> 1U) |
size of first prime factor(P)
| #define XSECURE_PRIME_FACTOR_Q_SIZE (XSECURE_RSA_KEY_GEN_SIZE_IN_BYTES >> 1U) |
size of first prime factor(Q)
| #define XSECURE_RSA_2048_KEY_SIZE (2048U/8U) |
RSA 2048 key size.
Referenced by XSecure_RsaOperation(), XSecure_RsaPrivateDecryptKat(), and XSecure_RsaPublicEncryptKat().
| #define XSECURE_RSA_2048_QUANT_SIZE (5U) |
RSA maximum quant size for 2048 bit key.
| #define XSECURE_RSA_2048_SIZE_WORDS (64) |
RSA 2048 Size in words.
Referenced by XSecure_GetKatRsaPrivateExp(), XSecure_RsaOperation(), XSecure_RsaPrivateDecryptKat(), and XSecure_RsaPublicEncryptKat().
| #define XSECURE_RSA_3072_KEY_SIZE (3072U/8U) |
RSA 3072 key size.
Referenced by XSecure_RsaOperation().
| #define XSECURE_RSA_3072_QUANT_SIZE (2U) |
RSA maximum quant size for 3072 bit key.
| #define XSECURE_RSA_3072_SIZE_WORDS (96) |
RSA 3072 Size in words.
Referenced by XSecure_RsaOperation().
| #define XSECURE_RSA_4096_KEY_SIZE (4096U/8U) |
RSA 4096 key size.
Referenced by XSecure_RsaOperation().
| #define XSECURE_RSA_4096_QUANT_SIZE (1U) |
RSA maximum quant size for 4096 bit key.
| #define XSECURE_RSA_4096_SIZE_WORDS (128U) |
RSA 4096 Size in words.
Referenced by XSecure_RsaInitialize_64Bit(), and XSecure_RsaOperation().
| #define XSECURE_RSA_BYTE_PAD1 (0X00U) |
PKCS T Padding Byte.
Referenced by XSecure_RsaSignVerification_64Bit().
| #define XSECURE_RSA_BYTE_PAD1 (0X00U) |
PKCS T Padding Byte.
| #define XSECURE_RSA_BYTE_PAD2 (0X01U) |
PKCS T Padding Byte.
Referenced by XSecure_RsaSignVerification_64Bit().
| #define XSECURE_RSA_BYTE_PAD2 (0X01U) |
PKCS T Padding Byte.
| #define XSECURE_RSA_BYTE_PAD3 (0XFFU) |
PKCS T Padding Byte.
Referenced by XSecure_RsaSignVerification_64Bit().
| #define XSECURE_RSA_BYTE_PAD3 (0XFFU) |
PKCS T Padding Byte.
| #define XSECURE_RSA_BYTE_PAD_LENGTH (3U) |
PKCS Byte Padding.
Referenced by XSecure_RsaSignVerification_64Bit().
| #define XSECURE_RSA_BYTE_PAD_LENGTH (3U) |
PKCS Byte Padding.
| #define XSECURE_RSA_CONTROL_EXP (0x01U) |
Exponentiation Opcode.
Referenced by XSecure_RsaOperation().
| #define XSECURE_RSA_CONTROL_EXP_PRE (0x05U) |
| #define XSECURE_RSA_DATA_VALUE_ERROR (0x2U) |
for RSA private decryption data should be lesser than modulus
Referenced by XSecure_RsaPrivateDecrypt_64Bit().
| #define XSECURE_RSA_ECDSA_ZEROIZE_ERROR (0x80U) |
for RSA zeroization Error
| #define XSECURE_RSA_INVALID_PARAM (0x82U) |
| #define XSECURE_RSA_INVALID_PARAM (0x82U) |
Invalid Argument.
| #define XSECURE_RSA_KEY_GEN_SIZE_IN_BYTES (XSECURE_RSA_3072_SIZE_WORDS * 4U) |
RSA default key size in bytes.
Referenced by XSecure_KeyUnwrap(), XSecure_RsaOaepDecrypt(), XSecure_RsaOaepEncrypt(), and XSecure_RsaPwct().
| #define XSECURE_RSA_KEY_GEN_SIZE_IN_WORDS (XSECURE_RSA_KEY_GEN_SIZE_IN_BYTES / 4U) |
RSA key generation size in words.
| #define XSECURE_RSA_KEY_STATUS_WAIT (1U) |
RSA key status wait.
| #define XSECURE_RSA_MAX_BUFF (6U) |
RSA RAM Write Buffers.
| #define XSECURE_RSA_MAX_DB_SIZE_IN_BYTES |
RSA maximum DB size in bytes.
| #define XSECURE_RSA_MAX_KEY_GEN_SUPPORT (2U) |
Maximum keys that needs to be generated.
Referenced by XSecure_GetRsaPrivateKey(), XSecure_GetRsaPublicKey(), and XSecure_RsaDestroyKeyInUse().
| #define XSECURE_RSA_MAX_MSG_SIZE_IN_BYTES |
RSA maximum message size in bytes.
| #define XSECURE_RSA_MAX_PS_SIZE_IN_BYTES (XSECURE_RSA_MAX_MSG_SIZE_IN_BYTES) |
RSA maximum PS size in bytes.
| #define XSECURE_RSA_MAX_RD_WR_CNT (22U) |
No of writes or reads to RSA RAM buffers.
Referenced by XSecure_RsaEcdsaZeroizeAndVerifyRam().
| #define XSECURE_RSA_PUB_EXP_SIZE (4U) |
RSA public exponent size.
Referenced by XSecure_RsaPwct().
| #define XSECURE_RSA_PUBLIC_EXPO_SIZE (4U) |
Size of public key expo.
Referenced by XSecure_RsaPublicEncrypt_64Bit().
| #define XSECURE_RSA_PUBLIC_EXPONENT (0x10001U) |
RSA public exponent value.
| #define XSECURE_RSA_RAM_DIGEST (2U) |
bit for RSA RAM Digest
Referenced by XSecure_RsaOperation().
| #define XSECURE_RSA_RAM_EXPO (0U) |
bit for RSA RAM Exponent
| #define XSECURE_RSA_RAM_MOD (1U) |
bit for RSA RAM modulus
| #define XSECURE_RSA_RAM_RES_Q (5U) |
bit for RSA RAM Result(Q)
Referenced by XSecure_RsaEcdsaZeroizeAndVerifyRam().
| #define XSECURE_RSA_RAM_RES_Y (4U) |
bit for RSA RAM Result(Y)
| #define XSECURE_RSA_SIZE_IN_BYTES (512U) |
512 bytes for 4096 bit data
| #define XSECURE_RSA_STATE_MISMATCH_ERROR (0x84U) |
State mismatch.
Referenced by XSecure_RsaPrivateDecrypt_64Bit(), and XSecure_RsaPublicEncrypt_64Bit().
| #define XSECURE_RSA_STATE_MISMATCH_ERROR (0x84U) |
State mismatch.
| #define XSECURE_RSA_STATUS_DONE (0x1U) |
Operation Done.
Referenced by XSecure_RsaOperation().
| #define XSECURE_RSA_STATUS_ERROR (0x4U) |
Error.
Referenced by XSecure_RsaOperation().
| #define XSECURE_RSA_T_PAD_LENGTH (19U) |
PKCS T Padding.
Referenced by XSecure_RsaSignVerification_64Bit().
| #define XSECURE_RSA_T_PAD_LENGTH (19U) |
PKCS T Padding.
| #define XSECURE_TIMEOUT_MAX (0x1FFFFFU) |
Recommended software timeout.
Referenced by XSecure_RsaOperation().
| enum XSecure_RsaKeyStatus |
| enum XSecure_RsaOps |
| enum XSecure_RsaState |
| int XSecure_AddRsaKeyPairGenerationToScheduler | ( | void | ) |
This function adds periodic task of generation RSA key pair to scheduler.
References XSECURE_KEY_PAIR_GEN_POLL_INTERVAL, and XSecure_Printf.
Referenced by XSecure_Init(), and XSecure_RsaDestroyKeyInUse().
| u32 XSecure_GetRsaKeyInUseIdx | ( | void | ) |
This function returns RSA key inuse index.
API to destroy key pair that is in use.
References XSECURE_RSA_KEY_AVAIL.
Referenced by XSecure_KeyUnwrap().
| XSecure_RsaPrivKey * XSecure_GetRsaPrivateKey | ( | u32 | RsaIdx | ) |
This function returns RSA private key.
References XSECURE_RSA_MAX_KEY_GEN_SUPPORT.
Referenced by XSecure_KeyUnwrap().
| XSecure_RsaPubKey * XSecure_GetRsaPublicKey | ( | u32 | RsaIdx | ) |
This function returns RSA public key.
API to retrieve RSA KEY in use index.
References XSECURE_RSA_MAX_KEY_GEN_SUPPORT.
| int XSecure_RsaCfgInitialize | ( | XSecure_Rsa * | InstancePtr | ) |
This function stores the base address of RSA core registers.
| InstancePtr | Pointer to the XSecure_Rsa instance |
Validate the input arguments
Set RSA in use flag
Referenced by XSecure_RsaInitialize_64Bit().
| int XSecure_RsaDestroyKeyInUse | ( | void | ) |
This function destroys the RSA key in use.
API to add key pair generation to scheduler.
References XSecure_AddRsaKeyPairGenerationToScheduler(), and XSECURE_RSA_MAX_KEY_GEN_SUPPORT.
| int XSecure_RsaEcdsaZeroizeAndVerifyRam | ( | u32 | BaseAddress | ) |
This function clears and verifies whole RSA or ECDSA memory space.
| BaseAddress | BaseAddress of ECDSA or RSA controller. |
Clears whole RSA or ECDSA RAM space
Verify whether whole RSA or ECDSA RAM space is zeroized or not
References XSECURE_RSA_MAX_RD_WR_CNT, and XSECURE_RSA_RAM_RES_Q.
Referenced by XSecure_RsaZeroize().
| u8 * XSecure_RsaGetTPadding | ( | void | ) |
This function returns PKCS padding as per the silicon version.
Referenced by XSecure_RsaSignVerification_64Bit().
| int XSecure_RsaInitialize | ( | XSecure_Rsa * | InstancePtr, |
| u8 * | Mod, | ||
| u8 * | ModExt, | ||
| u8 * | ModExpo | ||
| ) |
This function initializes a a XSecure_Rsa structure with the default values required for operating the RSA cryptographic engine.
| InstancePtr | Pointer to the XSecure_Rsa instance |
| Mod | A character Pointer which contains the key Modulus of key size |
| ModExt | A Pointer to the pre-calculated exponential (R^2 Mod N) value
|
| ModExpo | Pointer to the buffer which contains key exponent |
Modulus, ModExt and ModExpo are part of partition signature when authenticated boot image is generated by bootgen, else the all of them should be extracted from the key References XSecure_RsaInitialize_64Bit().
Referenced by XSecure_DataAuth(), XSecure_RsaCore(), XSecure_RsaPrivateDecryptKat(), XSecure_RsaPublicEncryptKat(), XSecure_RsaPwct(), and XSecure_SpkAuthentication().
| int XSecure_RsaInitialize_64Bit | ( | XSecure_Rsa * | InstancePtr, |
| u64 | Mod, | ||
| u64 | ModExt, | ||
| u64 | ModExpo | ||
| ) |
This function initializes a a XSecure_Rsa structure with the default values located at a 64-bit address required for operating the RSA cryptographic engine.
| InstancePtr | Pointer to the XSecure_Rsa instance |
| Mod | Address of the key Modulus of key size |
| ModExt | Address of the pre-calculated exponential (R^2 Mod N) value
|
| ModExpo | Address of the buffer which contains key exponent |
Modulus, ModExt and ModExpo are part of partition signature when authenticated boot image is generated by bootgen, else the all of them should be extracted from the key References XSecure_Rsa::Mod, XSecure_Rsa::ModAddr, XSecure_Rsa::ModExpo, XSecure_Rsa::ModExpoAddr, XSecure_Rsa::ModExt, XSecure_Rsa::ModExtAddr, XSecure_Rsa::RsaState, XSecure_Rsa::SizeInWords, XSECURE_RSA_4096_SIZE_WORDS, XSECURE_RSA_INITIALIZED, XSECURE_RSA_INVALID_PARAM, and XSecure_RsaCfgInitialize().
Referenced by XSecure_RsaInitialize().
| int XSecure_RsaIpiHandler | ( | XPlmi_Cmd * | Cmd | ) |
This function calls respective IPI handler based on the API_ID.
| Cmd | is pointer to the command structure |
Call the respective API handler according to API ID
References XSECURE_API, XSECURE_API_ID_MASK, XSECURE_API_RSA_PUBLIC_ENCRYPT, XSECURE_API_RSA_SIGN_VERIFY, and XSecure_Printf.
| int XSecure_RsaOaepDecrypt | ( | XSecure_RsaPrivKey * | PrivKey, |
| XSecure_RsaOaepParam * | OaepParam | ||
| ) |
This function decodes the given message and decrypts it using RSA OAEP.
| PrivKey | is pointer to the XSecure_RsaPrivKey instance. |
| OaepParam | is pointer to the XSecure_RsaOaepParam instance. |
References XSecure_RsaOaepParam::InputDataAddr, XSECURE_BYTE_IN_BITS, XSECURE_RSA_KEY_GEN_SIZE_IN_BYTES, XSECURE_RSA_OAEP_INVALID_PARAM, and XSecure_RsaExpCRT().
Referenced by XSecure_KeyUnwrap(), and XSecure_RsaPwct().
| int XSecure_RsaOaepEncrypt | ( | XSecure_Rsa * | InstancePtr, |
| XSecure_RsaOaepParam * | OaepParam | ||
| ) |
This function encodes the given message using RSA OAEP and encrypts it.
| InstancePtr | is pointer to the XSecure_Rsa instance. |
| OaepParam | is pointer to the XSecure_RsaOaepParam instance. |
References XSecure_RsaOaepParam::OutputDataAddr, XSECURE_RSA_KEY_GEN_SIZE_IN_BYTES, XSECURE_RSA_OAEP_INVALID_PARAM, and XSecure_RsaPublicEncrypt_64Bit().
Referenced by XSecure_RsaPwct().
| int XSecure_RsaOperation | ( | XSecure_Rsa * | InstancePtr, |
| u64 | Input, | ||
| u64 | Result, | ||
| XSecure_RsaOps | RsaOp, | ||
| u32 | KeySize | ||
| ) |
This function handles the Public encryption and private decryption of RSA operations with provided inputs.
| InstancePtr | Pointer to the XSecure_Rsa instance |
| Input | Address of the buffer which contains the input data to be encrypted/decrypted |
| Result | Address of buffer where resultant encrypted/decrypted data to be stored |
| RsaOp | Flag to inform the operation to be performed is either encryption/decryption |
| KeySize | Size of the key in bytes |
Validate the input arguments
Put Modulus, exponent, Mod extension in RSA RAM
Initialize MINV values from Mod.
Start the RSA operation.
References XSecure_Rsa::BaseAddress, XSecure_Rsa::EncDec, XSecure_Rsa::ModExtAddr, XSecure_Rsa::SizeInWords, XSECURE_ECDSA_RSA_CFG0_2048_VALUE, XSECURE_ECDSA_RSA_CFG0_3072_VALUE, XSECURE_ECDSA_RSA_CFG0_4096_VALUE, XSECURE_ECDSA_RSA_CFG1_2048_VALUE, XSECURE_ECDSA_RSA_CFG1_3072_VALUE, XSECURE_ECDSA_RSA_CFG1_4096_VALUE, XSECURE_ECDSA_RSA_CFG2_2048_VALUE, XSECURE_ECDSA_RSA_CFG2_3072_VALUE, XSECURE_ECDSA_RSA_CFG2_4096_VALUE, XSECURE_ECDSA_RSA_CFG5_2048_VALUE, XSECURE_ECDSA_RSA_CFG5_3072_VALUE, XSECURE_ECDSA_RSA_CFG5_4096_VALUE, XSecure_ReleaseReset(), XSECURE_RSA_2048_KEY_SIZE, XSECURE_RSA_2048_SIZE_WORDS, XSECURE_RSA_3072_KEY_SIZE, XSECURE_RSA_3072_SIZE_WORDS, XSECURE_RSA_4096_KEY_SIZE, XSECURE_RSA_4096_SIZE_WORDS, XSECURE_RSA_CONTROL_EXP, XSECURE_RSA_CONTROL_EXP_PRE, XSECURE_RSA_INVALID_PARAM, XSECURE_RSA_RAM_DIGEST, XSECURE_RSA_SIGN_DEC, XSECURE_RSA_SIGN_ENC, XSECURE_RSA_STATUS_DONE, XSECURE_RSA_STATUS_ERROR, XSecure_RsaZeroize(), XSecure_SetReset(), XSECURE_TIMEOUT_MAX, XSECURE_WORD_IN_BITS, and XSECURE_WORD_SIZE.
Referenced by XSecure_RsaPrivateDecrypt_64Bit(), and XSecure_RsaPublicEncrypt_64Bit().
| int XSecure_RsaPrivateDecrypt | ( | XSecure_Rsa * | InstancePtr, |
| u8 * | Input, | ||
| u32 | Size, | ||
| u8 * | Result | ||
| ) |
This function handles the RSA decryption with the private key components provided when initializing the RSA cryptographic core with the XSecure_RsaInitialize function.
| InstancePtr | Pointer to the XSecure_Rsa instance |
| Input | Pointer to the buffer which contains the input data to be decrypted |
| Size | Key size in bytes, Input size also should be same as Key size mentioned. Inputs supported are
|
| Result | Pointer to the buffer where resultant decrypted data to be stored |
References XSecure_RsaPrivateDecrypt_64Bit().
| int XSecure_RsaPrivateDecrypt_64Bit | ( | XSecure_Rsa * | InstancePtr, |
| u64 | Input, | ||
| u32 | Size, | ||
| u64 | Result | ||
| ) |
This function handles the RSA decryption for data available at 64-bit address with the private key components provided when initializing the RSA cryptographic core with the XSecure_RsaInitialize function.
| InstancePtr | Pointer to the XSecure_Rsa instance |
| Input | Address of the buffer which contains the input data to be decrypted |
| Size | Key size in bytes, Input size also should be same as Key size mentioned. Inputs supported are
|
| Result | Address of buffer where resultant decrypted data to be stored |
References XSecure_Rsa::Mod, XSecure_Rsa::ModAddr, XSecure_Rsa::ModExpo, XSecure_Rsa::ModExpoAddr, XSecure_Rsa::RsaState, XSECURE_RSA_DATA_VALUE_ERROR, XSECURE_RSA_INITIALIZED, XSECURE_RSA_INVALID_PARAM, XSECURE_RSA_SIGN_DEC, XSECURE_RSA_STATE_MISMATCH_ERROR, and XSecure_RsaOperation().
Referenced by XSecure_RsaPrivateDecrypt().
| int XSecure_RsaPublicEncrypt | ( | XSecure_Rsa * | InstancePtr, |
| u8 * | Input, | ||
| u32 | Size, | ||
| u8 * | Result | ||
| ) |
This function handles the RSA encryption with the public key components provided when initializing the RSA cryptographic core with the XSecure_RsaInitialize function.
| InstancePtr | Pointer to the XSecure_Rsa instance |
| Input | Pointer to the buffer which contains the input data to be encrypted |
| Size | Key size in bytes, Input size also should be same as Key size mentioned. Inputs supported are
|
| Result | Pointer to the buffer where resultant decrypted data to be stored |
References XSecure_RsaPublicEncrypt_64Bit().
| int XSecure_RsaPublicEncrypt_64Bit | ( | XSecure_Rsa * | InstancePtr, |
| u64 | Input, | ||
| u32 | Size, | ||
| u64 | Result | ||
| ) |
This function handles the RSA encryption for data available at 64-bit address with the public key components provided when initializing the RSA cryptographic core with the XSecure_RsaInitialize function.
| InstancePtr | Pointer to the XSecure_Rsa instance |
| Input | Address of the buffer which contains the input data to be encrypted |
| Size | Key size in bytes, Input size also should be same as Key size mentioned. Inputs supported are
|
| Result | Address of buffer where resultant decrypted data to be stored |
References XSecure_Rsa::ModExpo, XSecure_Rsa::ModExpoAddr, XSecure_Rsa::RsaState, XSECURE_RSA_INITIALIZED, XSECURE_RSA_INVALID_PARAM, XSECURE_RSA_PUBLIC_EXPO_SIZE, XSECURE_RSA_SIGN_ENC, XSECURE_RSA_STATE_MISMATCH_ERROR, and XSecure_RsaOperation().
Referenced by XSecure_RsaOaepEncrypt(), and XSecure_RsaPublicEncrypt().
| int XSecure_RsaSignVerification | ( | const u8 * | Signature, |
| const u8 * | Hash, | ||
| u32 | HashLen | ||
| ) |
This function verifies the RSA decrypted data provided is either matching with the provided expected hash by taking care of PKCS padding.
| Signature | Pointer to the buffer which holds the decrypted RSA signature |
| Hash | Pointer to the buffer which has the hash calculated on the data to be authenticated |
| HashLen | Length of Hash used For SHA3 it should be 48 bytes |
References XSecure_RsaSignVerification_64Bit().
| int XSecure_RsaSignVerification_64Bit | ( | const u64 | Signature, |
| const u64 | Hash, | ||
| u32 | HashLen | ||
| ) |
This function verifies the RSA decrypted data located at a 64-bit address provided is either matching with the provided expected hash by taking care of PKCS padding.
| Signature | Address of the buffer which holds the decrypted RSA signature |
| Hash | Address of the buffer which has the hash calculated on the data to be authenticated |
| HashLen | Length of Hash used For SHA3 it should be 48 bytes |
References XSECURE_FSBL_SIG_SIZE, XSECURE_HASH_TYPE_SHA3, XSECURE_RSA_BYTE_PAD1, XSECURE_RSA_BYTE_PAD2, XSECURE_RSA_BYTE_PAD3, XSECURE_RSA_BYTE_PAD_LENGTH, XSECURE_RSA_INVALID_PARAM, XSECURE_RSA_T_PAD_LENGTH, and XSecure_RsaGetTPadding().
Referenced by XSecure_RsaSignVerification().
| int XSecure_RsaZeroize | ( | const XSecure_Rsa * | InstancePtr | ) |
This function clears whole RSA memory space.
This function clears stored exponent, modulus and exponentiation key components along with digest
| InstancePtr | Pointer to the XSecure_Rsa instance |
Zeroize and verify whole RSA RAM space
References XSecure_Rsa::BaseAddress, XSECURE_RSA_INVALID_PARAM, and XSecure_RsaEcdsaZeroizeAndVerifyRam().
Referenced by XSecure_RsaOperation().