xilsecure
Vitis Drivers API Documentation
Xilsecure RSA QMODE Server APIs

Macros

#define externC   extern
 For compilation in C++. 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_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_PUB_EXP_SIZE   (4U)
 RSA public exponent size. More...
 

Functions

int XSecure_RsaExpCRT (u8 *Hash, u8 *P, u8 *Q, u8 *Dp, u8 *Dq, u8 *Qinv, u8 *Pub, u8 *Mod, int Len, u8 *Res)
 This function performs the RSA exponentiation using CRT (Chinese Remainder Theorem). More...
 
int XSecure_RsaExp (u8 *Hash, u8 *Exp, u8 *Mod, u8 *P, u8 *Q, u8 *Pub, u8 *Tot, int Len, u8 *Res)
 This function performs the RSA exponentiation. More...
 
int XSecure_RsaExpopt (u8 *Hash, u8 *Exp, u8 *Mod, u8 *RN, u8 *RRN, u8 *P, u8 *Q, u8 *Pub, u8 *Tot, int Len, u8 *Res)
 This function perofrms the RSA exponentiation using pre-calculated modulus. More...
 

Macro Definition Documentation

#define externC   extern

For compilation in C++.

#define XSECURE_ECDSA_RSA_SOFT_RESET   (0xF1200040U)

ECDSA/RSA soft reset address.

#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_RSA_PUB_EXP_SIZE   (4U)

RSA public exponent size.

#define XSECURE_RSA_SIZE_IN_BYTES   (512U)

512 bytes for 4096 bit data

Function Documentation

int XSecure_RsaExp ( u8 *  Hash,
u8 *  Exp,
u8 *  Mod,
u8 *  P,
u8 *  Q,
u8 *  Pub,
u8 *  Tot,
int  Len,
u8 *  Res 
)

This function performs the RSA exponentiation.

Parameters
Hashis Hash of the exponentiation.
Expis exponent, a positive integer.
Modis public modulus (p*q), NULL is invalid param.
Pis first factor, a positive integer.
Qis second factor, a positive integer.
Pubis public exponent to protect against the fault insertions.
Totis totient, a secret value equal to (p-1)*(q-1). if NULL, calculated internally with p and q.
Lenis length of the full-length integer in bits.
Resis result of exponentiation r = (h^e) mod n.
Returns
  • XST_SUCCESS On success.
  • XSECURE_RSA_EXPONENT_INVALID_PARAM If any input parameter is invalid.
  • XST_FAILURE On failure.

Validate input parameters

Release the RSA engine from reset

Perform the RSA exponentiation

Reset the RSA engine

References XSECURE_ECDSA_RSA_SOFT_RESET, XSecure_Out32, and XSECURE_RSA_EXPONENT_INVALID_PARAM.

int XSecure_RsaExpCRT ( u8 *  Hash,
u8 *  P,
u8 *  Q,
u8 *  Dp,
u8 *  Dq,
u8 *  Qinv,
u8 *  Pub,
u8 *  Mod,
int  Len,
u8 *  Res 
)

This function performs the RSA exponentiation using CRT (Chinese Remainder Theorem).

Parameters
Hashis the Hash of the exponentiation.
Pis first factor, a positive integer.
Qis second factor, a positive integer.
Dpis first factor's CRT exponent, a positive integer.
Dqis second factor's CRT exponent, a positive integer.
Qinvis (first) CRT coefficient, a positive integer.
Pubis the public exponent to protect against the fault insertions.
Modis the public modulus (p*q), if NULL, calculated internally.
Lenis length of the full-length integer in bits.
Resis result of exponentiation r = (h^e) mod n.
Returns
  • XST_SUCCESS On success.
  • XSECURE_RSA_EXPONENT_INVALID_PARAM If any input parameter is invalid.
  • XST_FAILURE On failure.

Validate input parameters

Release the RSA engine from reset

Perform the RSA exponentiation using CRT

Reset the RSA engine

References XSECURE_ECDSA_RSA_SOFT_RESET, XSecure_Out32, and XSECURE_RSA_EXPONENT_INVALID_PARAM.

Referenced by XSecure_RsaOaepDecrypt().

int XSecure_RsaExpopt ( u8 *  Hash,
u8 *  Exp,
u8 *  Mod,
u8 *  RN,
u8 *  RRN,
u8 *  P,
u8 *  Q,
u8 *  Pub,
u8 *  Tot,
int  Len,
u8 *  Res 
)

This function perofrms the RSA exponentiation using pre-calculated modulus.

Parameters
Hashis Hash of the exponentiation.
Expis exponent, a positive integer.
Modis public modulus (p*q), NULL is invalid param.
RNis pre-calculated modulus RmodN
RRNis pre-calculated modulus RRmodN
Pis first factor, a positive integer.
Qis second factor, a positive integer.
Pubis public exponent to protect against the fault insertions.
Totis totient, a secret value equal to (p-1)*(q-1). if NULL, calculated internally with p and q.
Lenis length of the full-length integer in bits.
Resis result of exponentiation r = (h^e) mod n.
Returns
  • XST_SUCCESS On success.
  • XSECURE_RSA_EXPONENT_INVALID_PARAM If any input parameter is invalid.
  • XST_FAILURE On failure.

Validate input parameters

Release the RSA engine from reset

Perform the RSA exponentiation with pre-calculated modulus

Reset the RSA engine

References XSECURE_ECDSA_RSA_SOFT_RESET, XSecure_Out32, and XSECURE_RSA_EXPONENT_INVALID_PARAM.