xilsecure
Vitis Drivers API Documentation
XilSecure ECDSA Server APIs

Data Structures

struct  XSecure_ElliptcPrivateKeyGen
 Ecc private key generation parameters. More...
 
struct  XSecure_EllipticKey
 Structure for pointers of public key curve points. More...
 
struct  XSecure_EllipticSign
 Structure for pointers of signature components. More...
 
struct  XSecure_EllipticKeyAddr
 Structure for addresses of public key curve points. More...
 
struct  XSecure_EllipticSignAddr
 Structure for addresses of signature components. More...
 
struct  XSecure_EllipticHashData
 Structure for input parameters Hash and Length for Elliptic Sign generation. More...
 

Macros

#define XSECURE_ECC_TRNG_DF_LENGTH   (2U)
 Default length of xilsecure ecc true random number generator. More...
 
#define XSECURE_ECC_TRNG_RANDOM_NUM_GEN_LEN   (60U)
 Length of xilsecure ecc true random number generator. More...
 
#define XSECURE_ECDSA_ALGN_CRV_SIZE_IN_BYTES   (2U)
 Align ECDSA curve size in bytes. More...
 
#define XSECURE_ECDSA_BITS_IN_BYTES   (8U)
 Bits in bytes. More...
 
#define XSECURE_ECC_P384_SIZE_IN_BYTES   (48U)
 Size of NIST P-384 curve in bytes. More...
 
#define XSECURE_ECC_P521_SIZE_IN_BYTES   (66U)
 Size of NIST P-521 curve in bytes. More...
 
#define XSECURE_ECC_P256_SIZE_IN_BYTES   (32U)
 Size of NIST P-256 curve in bytes. More...
 
#define XSECURE_ECC_P192_SIZE_IN_BYTES   (24U)
 Size of NIST P-192 curve in bytes. More...
 
#define XSECURE_ECC_P224_SIZE_IN_BYTES   (28U)
 Size of NIST P-224 curve in bytes. More...
 
#define XSECURE_ECDSA_P521_ALIGN_BYTES   (2U)
 Size of NIST P-521 curve is 66 bytes. More...
 
#define XSECURE_ELLIPTIC_LITTLE_ENDIAN   (0U)
 Operates APIs on little endian format. More...
 

Functions

EcdsaCrvInfoXSecure_EllipticGetCrvData (XSecure_EllipticCrvTyp CrvTyp)
 This function gets the curve related information. More...
 
int XSecure_EllipticPrvtKeyGenerate (XSecure_EllipticCrvTyp CrvType, XSecure_ElliptcPrivateKeyGen *PrivateKey)
 This function generates 48-byte key for P-384 curve using TRNG. More...
 
int XSecure_EllipticGenerateEphemeralKey (XSecure_EllipticCrvTyp CrvType, u32 EphemeralKeyAddr)
 This function generates 48-byte ephemeral key for P-384 curve using TRNG. More...
 
int XSecure_EllipticGenEphemeralNSign (XSecure_EllipticCrvTyp CrvType, const u8 *Hash, u32 HashLen, u8 *PrvtKey, u8 *Signature)
 This function generates the signature on provided hash using ecc. More...
 
int XSecure_EcdhGetSecret (XSecure_EllipticCrvTyp CrvType, u64 PrvtKeyAddr, u64 PubKeyAddr, u64 SharedSecretAddr)
 This is a wrapper function which calls the IPCores API to perform ECDH and generate shared secret. More...
 
int XSecure_PlatEllipticIpiHandler (XPlmi_Cmd *Cmd)
 This function calls respective IPI handler based on the API_ID. More...
 
int XSecure_EllipticGenerateKey_64Bit (XSecure_EllipticCrvTyp CrvType, const u64 DAddr, const XSecure_EllipticKeyAddr *KeyAddr)
 This function generates Public Key for a given curve type using private key where both keys located at 64 bit address. More...
 
int XSecure_EllipticGenerateKey (XSecure_EllipticCrvTyp CrvType, const u8 *D, const XSecure_EllipticKey *Key)
 This function generates Public Key for a given curve type. More...
 
int XSecure_EllipticGenerateSignature_64Bit (XSecure_EllipticCrvTyp CrvType, const XSecure_EllipticHashData *HashInfo, const u64 DAddr, const u64 KAddr, const XSecure_EllipticSignAddr *SignAddr)
 This function generates signature for a given hash and curve type where data is located at 64-bit address. More...
 
int XSecure_EllipticGenerateSignature (XSecure_EllipticCrvTyp CrvType, const u8 *Hash, const u32 HashLen, const u8 *D, const u8 *K, const XSecure_EllipticSign *Sign)
 This function generates signature for a given hash and curve type. More...
 
int XSecure_EllipticValidateKey_64Bit (XSecure_EllipticCrvTyp CrvType, const XSecure_EllipticKeyAddr *KeyAddr)
 This function validates the public key for a given curve type where key is located at 64-bit address. More...
 
int XSecure_EllipticValidateKey (XSecure_EllipticCrvTyp CrvType, const XSecure_EllipticKey *Key)
 This function validates the public key for a given curve type. More...
 
int XSecure_EllipticVerifySign_64Bit (XSecure_EllipticCrvTyp CrvType, const XSecure_EllipticHashData *HashInfo, const XSecure_EllipticKeyAddr *KeyAddr, const XSecure_EllipticSignAddr *SignAddr)
 This function verifies the signature for a given hash, key and curve type where data is located at 64-bit address. More...
 
int XSecure_EllipticVerifySign (XSecure_EllipticCrvTyp CrvType, const u8 *Hash, const u32 HashLen, const XSecure_EllipticKey *Key, const XSecure_EllipticSign *Sign)
 This function verifies the signature for a given hash, key and curve type. More...
 
void XSecure_PutData (const u32 Size, u8 *Dst, const u64 SrcAddr)
 This function copies data from 32/64 bit address to local buffer. More...
 
void XSecure_GetData (const u32 Size, const u8 *Src, const u64 DstAddr)
 This function copies data to 32/64 bit address from local buffer. More...
 
void XSecure_FixEndiannessNCopy (const u32 Size, u64 DstAddr, const u64 SrcAddr)
 This function copies data to destination based on library endianness selection. More...
 
u32 XSecure_EllipticGetCrvSize (const XSecure_EllipticCrvTyp CrvType)
 This function gets curve size in bytes. More...
 
int XSecure_EllipticIpiHandler (XPlmi_Cmd *Cmd)
 This function calls respective IPI handler based on the API_ID. More...
 
u32 XSecure_EllipticCrvsGetCount (void)
 This function calculates the total number of curves supported. More...
 

Supported ECC curves

#define XSECURE_ECC_SUPPORT_NIST_P384
 < Macros to enable /disable support of NIST P-384 and NIST P-521 curve More...
 

Macro Definition Documentation

#define XSECURE_ECC_P192_SIZE_IN_BYTES   (24U)

Size of NIST P-192 curve in bytes.

Referenced by XSecure_EllipticPwct().

#define XSECURE_ECC_P224_SIZE_IN_BYTES   (28U)

Size of NIST P-224 curve in bytes.

Referenced by XSecure_EllipticPwct().

#define XSECURE_ECC_P256_SIZE_IN_BYTES   (32U)

Size of NIST P-256 curve in bytes.

Referenced by XSecure_EcdhGetSecret(), and XSecure_EllipticPwct().

#define XSECURE_ECC_SUPPORT_NIST_P384

< Macros to enable /disable support of NIST P-384 and NIST P-521 curve

#define XSECURE_ECC_TRNG_DF_LENGTH   (2U)

Default length of xilsecure ecc true random number generator.

Referenced by XSecure_EllipticPrvtKeyGenerate().

#define XSECURE_ECC_TRNG_RANDOM_NUM_GEN_LEN   (60U)

Length of xilsecure ecc true random number generator.

Referenced by XSecure_EllipticGenerateEphemeralKey(), and XSecure_EllipticPrvtKeyGenerate().

#define XSECURE_ECDSA_ALGN_CRV_SIZE_IN_BYTES   (2U)

Align ECDSA curve size in bytes.

Referenced by XSecure_EllipticGetCrvSize().

#define XSECURE_ECDSA_BITS_IN_BYTES   (8U)

Bits in bytes.

Referenced by XSecure_EllipticGetCrvSize().

#define XSECURE_ECDSA_P521_ALIGN_BYTES   (2U)

Size of NIST P-521 curve is 66 bytes.

This macro is used to make the address word aligned

Referenced by XSecure_EcdhGetSecret(), XSecure_EllipticGenerateKey_64Bit(), XSecure_EllipticGenerateSignature_64Bit(), XSecure_EllipticValidateKey_64Bit(), and XSecure_EllipticVerifySign_64Bit().

#define XSECURE_ELLIPTIC_LITTLE_ENDIAN   (0U)

Operates APIs on little endian format.

Referenced by XSecure_FixEndiannessNCopy(), XSecure_GetData(), and XSecure_PutData().

Function Documentation

int XSecure_EcdhGetSecret ( XSecure_EllipticCrvTyp  CrvType,
u64  PrvtKeyAddr,
u64  PubKeyAddr,
u64  SharedSecretAddr 
)

This is a wrapper function which calls the IPCores API to perform ECDH and generate shared secret.

Parameters
CrvTypeCurve Type of the keys used to generate shared secret
PrvtKeyAddr64-bit address of the private key
PubKeyAddr64-bit address of public key
SharedSecretAddr64-bit address of buffer for storing shared secret
Returns
  • XST_SUCCESS On success
  • XSECURE_ELLIPTIC_INVALID_PARAM If any input parameter is invalid
  • XSECURE_ELLIPTIC_NON_SUPPORTED_CRV If elliptic curve data received is NULL
  • XST_FAILURE On failure
Note
Shared secret is calculated by performing scalar multiplication on public key and private key provided as input.

Zeroize local copy of key

Zeroize local copy of shared secret

References XSecure_EllipticKeyAddr::Qx, XSecure_EllipticKeyAddr::Qy, XSecure_CryptoCheck(), XSECURE_ECC_NIST_P256, XSECURE_ECC_NIST_P384, XSECURE_ECC_NIST_P521, XSECURE_ECC_P256_SIZE_IN_BYTES, XSECURE_ECC_P384_SIZE_IN_BYTES, XSECURE_ECC_P521_SIZE_IN_BYTES, XSecure_ECCRandInit(), XSECURE_ECDSA_P521_ALIGN_BYTES, XSECURE_ELLIPTIC_INVALID_PARAM, XSecure_EllipticGetCrvData(), XSecure_GetData(), XSecure_PutData(), XSecure_ReleaseReset(), and XSecure_SetReset().

u32 XSecure_EllipticCrvsGetCount ( void  )

This function calculates the total number of curves supported.

Returns
  • Number of curves supported

Referenced by XSecure_EllipticGetCrvData().

int XSecure_EllipticGenEphemeralNSign ( XSecure_EllipticCrvTyp  CrvType,
const u8 *  Hash,
u32  HashLen,
u8 *  PrvtKey,
u8 *  Signature 
)

This function generates the signature on provided hash using ecc.

Parameters
CrvTypespecifies the type of the ECC curve.
Hashis the pointer to the hash of the data to be signed
HashLenis the length of the hash.
PrvtKeyis the pointer to ECC private key.
Signatureis the pointer to the buffer where the ECC signature shall be stored.
Returns
  • XST_SUCCESS On success
  • XSECURE_ELLIPTIC_INVALID_PARAM If any input parameter is invalid
  • XST_FAILURE On failure

Generate Ephemeral Key using TRNG for generating ECDSA signature

Generate Signature using Private Key to the provided hash

Clear ephemeral key and private key

References XSECURE_ECC_NIST_P521, XSECURE_ECC_P384_SIZE_IN_BYTES, XSECURE_ELLIPTIC_INVALID_PARAM, XSecure_EllipticGenerateEphemeralKey(), and XSecure_EllipticGenerateSignature().

int XSecure_EllipticGenerateEphemeralKey ( XSecure_EllipticCrvTyp  CrvType,
u32  EphemeralKeyAddr 
)

This function generates 48-byte ephemeral key for P-384 curve using TRNG.

Parameters
CrvTypeSpecifies the type of the ECC curve.
EphemeralKeyAddrAddress of ephemeral key
Returns
  • XST_SUCCESS On success
  • XSECURE_ELLIPTIC_INVALID_PARAM If any input parameter is invalid
  • XST_FAILURE On failure
Note
This API expects TRNG HW to be in HEALTHY state, This can be achieved by running preoperational health tests.

References XSECURE_ECC_NIST_P384, XSECURE_ECC_NIST_P521, XSECURE_ECC_P384_SIZE_IN_BYTES, XSECURE_ECC_PRVT_KEY_GEN_ERR, XSECURE_ECC_TRNG_RANDOM_NUM_GEN_LEN, XSECURE_ELLIPTIC_INVALID_PARAM, XSecure_EllipticGetCrvData(), XSecure_GetData(), XSecure_GetRandomNum(), XSecure_ReleaseReset(), and XSecure_SetReset().

Referenced by XSecure_EllipticGenEphemeralNSign().

int XSecure_EllipticGenerateKey ( XSecure_EllipticCrvTyp  CrvType,
const u8 *  D,
const XSecure_EllipticKey Key 
)

This function generates Public Key for a given curve type.

Parameters
CrvTypeIs a type of elliptic curve
DPointer to static private key
KeyPointer to public key
Returns
  • XST_SUCCESS On success
  • XSECURE_ELLIPTIC_NON_SUPPORTED_CRV When elliptic Curve is not supported
  • XSECURE_ELLIPTIC_INVALID_PARAM On invalid argument

Generate public key with provided private key and curve type

References XSecure_EllipticKey::Qx, XSecure_EllipticKeyAddr::Qx, XSecure_EllipticKey::Qy, XSecure_EllipticKeyAddr::Qy, XSECURE_ECC_NIST_P192, XSECURE_ECC_NIST_P224, XSECURE_ECC_NIST_P256, XSECURE_ECC_NIST_P384, XSECURE_ECC_NIST_P521, XSECURE_ELLIPTIC_INVALID_PARAM, and XSecure_EllipticGenerateKey_64Bit().

int XSecure_EllipticGenerateKey_64Bit ( XSecure_EllipticCrvTyp  CrvType,
const u64  DAddr,
const XSecure_EllipticKeyAddr KeyAddr 
)

This function generates Public Key for a given curve type using private key where both keys located at 64 bit address.

Parameters
CrvTypeIs a type of elliptic curve
DAddrAddress of static private key
KeyAddrPointer to public key address
Returns
  • XST_SUCCESS On success
  • XSECURE_ELLIPTIC_NON_SUPPORTED_CRV When elliptic Curve is not supported
  • XSECURE_ELLIPTIC_INVALID_PARAM On invalid argument
  • XSECURE_ELLIPTIC_GEN_KEY_ERR Error in generating Public key

Generate public key with provided private key and curve type

References D, XSecure_EllipticKeyAddr::Qx, XSecure_EllipticKeyAddr::Qy, XSecure_CryptoCheck(), XSECURE_ECC_NIST_P521, XSECURE_ECC_P521_SIZE_IN_BYTES, XSecure_ECCRandInit(), XSECURE_ECDSA_P521_ALIGN_BYTES, XSECURE_ELLIPTIC_GEN_KEY_ERR, XSECURE_ELLIPTIC_INVALID_PARAM, XSecure_GetData(), XSecure_PutData(), XSecure_ReleaseReset(), and XSecure_SetReset().

Referenced by XSecure_EllipticGenerateKey().

int XSecure_EllipticGenerateSignature ( XSecure_EllipticCrvTyp  CrvType,
const u8 *  Hash,
const u32  HashLen,
const u8 *  D,
const u8 *  K,
const XSecure_EllipticSign Sign 
)

This function generates signature for a given hash and curve type.

Parameters
CrvTypeType of elliptic curve
HashPointer to the hash for which sign has to be generated
HashLenLength of the hash in bytes
DPointer to the static private key
KEphemeral private key
SignPointer to the signature
Returns
  • XST_SUCCESS On success
  • XSECURE_ELLIPTIC_INVALID_PARAM On invalid argument
Note
K, the ephemeral private key, shall be an unpredictable (cryptographically secure) random number unique for each signature Note that reuse or external predictability of this number generally breaks the security of ECDSA

Generate signature with provided hash, private key, ephemeral key and curve type

References XSecure_EllipticHashData::Addr, XSecure_EllipticHashData::Len, XSecure_EllipticSign::SignR, XSecure_EllipticSignAddr::SignR, XSecure_EllipticSign::SignS, 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_P521_SIZE_IN_BYTES, XSECURE_ELLIPTIC_INVALID_PARAM, and XSecure_EllipticGenerateSignature_64Bit().

Referenced by XSecure_EllipticGenEphemeralNSign(), and XSecure_EllipticSignGenerateKat().

int XSecure_EllipticGenerateSignature_64Bit ( XSecure_EllipticCrvTyp  CrvType,
const XSecure_EllipticHashData HashInfo,
const u64  DAddr,
const u64  KAddr,
const XSecure_EllipticSignAddr SignAddr 
)

This function generates signature for a given hash and curve type where data is located at 64-bit address.

Parameters
CrvTypeType of elliptic curve
HashInfoPointer to Hash Data i.e. Hash Address and length
DAddrAddress of the static private key
KAddrEphemeral private key
SignAddrPointer to signature address
Returns
  • XST_SUCCESS On success
  • XSECURE_ELLIPTIC_INVALID_PARAM On invalid argument
  • XSECURE_ELLIPTIC_NON_SUPPORTED_CRV If curve data pointer is NULL
  • XSECURE_ELLIPTIC_GEN_SIGN_BAD_RAND_NUM When Bad random number used for sign generation
  • XSECURE_ELLIPTIC_GEN_SIGN_INCORRECT_HASH_LEN Incorrect hash length for sign generation
  • XST_FAILURE On any other failures
Note
K, the ephemeral private key, shall be an unpredictable (cryptographically secure) random number unique for each signature Note that reuse or external predictability of this number generally breaks the security of ECDSA

Generate signature with provided hash, private key, ephemeral key and curve type.

References XSecure_EllipticHashData::Addr, EcdsaCrvInfo::Bits, D, K, XSecure_EllipticHashData::Len, XSecure_EllipticSignAddr::SignR, XSecure_EllipticSignAddr::SignS, XSecure_CryptoCheck(), XSECURE_ECC_NIST_P521, XSECURE_ECC_P521_SIZE_IN_BYTES, XSecure_ECCRandInit(), XSECURE_ECDSA_P521_ALIGN_BYTES, XSECURE_ELLIPTIC_GEN_SIGN_BAD_RAND_NUM, XSECURE_ELLIPTIC_GEN_SIGN_INCORRECT_HASH_LEN, XSECURE_ELLIPTIC_INVALID_PARAM, XSecure_GetData(), XSecure_PutData(), XSecure_ReleaseReset(), and XSecure_SetReset().

Referenced by XSecure_EllipticGenerateSignature(), and XSecure_EllipticPwct().

EcdsaCrvInfo * XSecure_EllipticGetCrvData ( XSecure_EllipticCrvTyp  CrvTyp)

This function gets the curve related information.

Parameters
CrvTypType of the elliptic curve
Returns
  • Crv Curve information

Get the curve data

References XSECURE_ECC_NIST_P192, XSECURE_ECC_NIST_P224, XSECURE_ECC_NIST_P256, XSECURE_ECC_NIST_P384, XSECURE_ECC_NIST_P521, and XSecure_EllipticCrvsGetCount().

Referenced by XSecure_EcdhGetSecret(), XSecure_EllipticGenerateEphemeralKey(), XSecure_EllipticGetCrvSize(), and XSecure_EllipticPrvtKeyGenerate().

u32 XSecure_EllipticGetCrvSize ( const XSecure_EllipticCrvTyp  CrvType)

This function gets curve size in bytes.

Parameters
CrvTypeIs a type of elliptic curve
Returns
  • CrvSize Size of curve in bytes

Get curve size

References EcdsaCrvInfo::Bits, XSECURE_ECDSA_ALGN_CRV_SIZE_IN_BYTES, XSECURE_ECDSA_BITS_IN_BYTES, and XSecure_EllipticGetCrvData().

int XSecure_EllipticIpiHandler ( 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 API ID is invalid
  • XST_FAILURE If there is a failure

Call the respective API handler according to API ID

  • XSecure_EllipticGenKey
  • XSecure_EllipticGenSign
  • XSecure_EllipticValidatePubKey
  • XSecure_EllipticVerifySignature

References XSECURE_API, XSECURE_API_ELLIPTIC_GENERATE_KEY, XSECURE_API_ELLIPTIC_GENERATE_SIGN, XSECURE_API_ELLIPTIC_VALIDATE_KEY, XSECURE_API_ELLIPTIC_VERIFY_SIGN, XSECURE_API_ID_MASK, and XSecure_Printf.

int XSecure_EllipticPrvtKeyGenerate ( XSecure_EllipticCrvTyp  CrvType,
XSecure_ElliptcPrivateKeyGen PrivateKey 
)

This function generates 48-byte key for P-384 curve using TRNG.

Parameters
CrvTypespecifies the type of the ECC curve.
PrivateKeyis the pointer to XSecure_ElliptcPrivateKeyGen
Returns
  • XST_SUCCESS On success
  • XSECURE_ELLIPTIC_INVALID_PARAM If any input parameter is invalid
  • XST_FAILURE On failure
Note
This API expects TRNG HW to be in HEALTHY state, This can be achieved by running preoperational health tests.

References XSecure_ElliptcPrivateKeyGen::KeyOutPutAddr, XSecure_ElliptcPrivateKeyGen::PerStringAddr, XSecure_ElliptcPrivateKeyGen::SeedAddr, XSecure_ElliptcPrivateKeyGen::SeedLength, XSECURE_CLEAR_BIT, XSECURE_ECC_NIST_P384, XSECURE_ECC_NIST_P521, XSECURE_ECC_P384_SIZE_IN_BYTES, XSECURE_ECC_PRVT_KEY_GEN_ERR, XSECURE_ECC_TRNG_DF_LENGTH, XSECURE_ECC_TRNG_RANDOM_NUM_GEN_LEN, XSECURE_ELLIPTIC_INVALID_PARAM, XSecure_EllipticGetCrvData(), XSecure_GetData(), XSecure_GetTrngInstance(), XSecure_ReleaseReset(), XSecure_SetReset(), XSECURE_TRNG_USER_CFG_SEED_LIFE, and XSecure_UpdateTrngCryptoStatus().

int XSecure_EllipticValidateKey ( XSecure_EllipticCrvTyp  CrvType,
const XSecure_EllipticKey Key 
)

This function validates the public key for a given curve type.

Parameters
CrvTypeType of elliptic curve
KeyPointer to the public key
Returns
  • XST_SUCCESS On success
  • XSECURE_ELLIPTIC_INVALID_PARAM On invalid argument

Validate the public key for a given curve type

References XSecure_EllipticKey::Qx, XSecure_EllipticKeyAddr::Qx, XSecure_EllipticKey::Qy, XSecure_EllipticKeyAddr::Qy, XSECURE_ECC_NIST_P192, XSECURE_ECC_NIST_P224, XSECURE_ECC_NIST_P256, XSECURE_ECC_NIST_P384, XSECURE_ECC_NIST_P521, XSECURE_ELLIPTIC_INVALID_PARAM, and XSecure_EllipticValidateKey_64Bit().

int XSecure_EllipticValidateKey_64Bit ( XSecure_EllipticCrvTyp  CrvType,
const XSecure_EllipticKeyAddr KeyAddr 
)

This function validates the public key for a given curve type where key is located at 64-bit address.

Parameters
CrvTypeType of elliptic curve
KeyAddrPointer to public key address
Returns
  • XST_SUCCESS On success
  • XSECURE_ELLIPTIC_INVALID_PARAM On invalid argument
  • XSECURE_ELLIPTIC_NON_SUPPORTED_CRV If curve data pointer is NULL
  • XSECURE_ELLIPTIC_KEY_ZERO When Public key is zero
  • XSECURE_ELLIPTIC_KEY_WRONG_ORDER Wrong order of Public key
  • XSECURE_ELLIPTIC_KEY_NOT_ON_CRV When Key is not found on the curve
  • XST_FAILURE On any other failures

Validate the public key for a given curve type

References XSecure_EllipticKeyAddr::Qx, XSecure_EllipticKeyAddr::Qy, XSecure_CryptoCheck(), XSECURE_ECC_NIST_P521, XSECURE_ECC_P521_SIZE_IN_BYTES, XSECURE_ECDSA_P521_ALIGN_BYTES, XSECURE_ELLIPTIC_INVALID_PARAM, XSECURE_ELLIPTIC_KEY_NOT_ON_CRV, XSECURE_ELLIPTIC_KEY_WRONG_ORDER, XSECURE_ELLIPTIC_KEY_ZERO, XSecure_PutData(), XSecure_ReleaseReset(), and XSecure_SetReset().

Referenced by XSecure_EllipticValidateKey().

int XSecure_EllipticVerifySign ( XSecure_EllipticCrvTyp  CrvType,
const u8 *  Hash,
const u32  HashLen,
const XSecure_EllipticKey Key,
const XSecure_EllipticSign Sign 
)

This function verifies the signature for a given hash, key and curve type.

Parameters
CrvTypeType of elliptic curve
HashPointer to the hash for which sign has to be generated
HashLenLength of hash in bytes
KeyPointer to the public key
SignPointer to the signature
Returns
  • XST_SUCCESS On success
  • XSECURE_ELLIPTIC_INVALID_PARAM On invalid argument

Verify signature with provided hash, public key and curve type

References XSecure_EllipticHashData::Addr, XSecure_EllipticHashData::Len, XSecure_EllipticKey::Qx, XSecure_EllipticKeyAddr::Qx, XSecure_EllipticKey::Qy, XSecure_EllipticKeyAddr::Qy, XSecure_EllipticSign::SignR, XSecure_EllipticSignAddr::SignR, XSecure_EllipticSign::SignS, 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_P521_SIZE_IN_BYTES, XSECURE_ELLIPTIC_INVALID_PARAM, and XSecure_EllipticVerifySign_64Bit().

int XSecure_EllipticVerifySign_64Bit ( XSecure_EllipticCrvTyp  CrvType,
const XSecure_EllipticHashData HashInfo,
const XSecure_EllipticKeyAddr KeyAddr,
const XSecure_EllipticSignAddr SignAddr 
)

This function verifies the signature for a given hash, key and curve type where data is located at 64-bit address.

Parameters
CrvTypeType of elliptic curve
HashInfoPointer to Hash Data i.e. Hash Address and length
KeyAddrPointer to public key address
SignAddrPointer to signature address
Returns
  • XST_SUCCESS On success
  • XSECURE_ELLIPTIC_INVALID_PARAM On invalid argument
  • XSECURE_ELLIPTIC_NON_SUPPORTED_CRV If curve data pointer is NULL
  • XSECURE_ELLIPTIC_BAD_SIGN When signature provided for verification is bad
  • XSECURE_ELLIPTIC_VER_SIGN_INCORRECT_HASH_LEN Incorrect hash length for sign verification
  • XSECURE_ELLIPTIC_VER_SIGN_R_ZERO R set to zero
  • XSECURE_ELLIPTIC_VER_SIGN_S_ZERO S set to zero
  • XSECURE_ELLIPTIC_VER_SIGN_R_ORDER_ERROR R is not within ECC order
  • XSECURE_ELLIPTIC_VER_SIGN_S_ORDER_ERROR S is not within ECC order
  • XST_FAILURE On any other failures

Verify signature with provided hash, public key and curve type

References XSecure_EllipticHashData::Addr, EcdsaCrvInfo::Bits, XSecure_EllipticHashData::Len, XSecure_EllipticKeyAddr::Qx, XSecure_EllipticKeyAddr::Qy, XSecure_EllipticSignAddr::SignR, XSecure_EllipticSignAddr::SignS, XSecure_CryptoCheck(), XSECURE_ECC_NIST_P521, XSECURE_ECC_P521_SIZE_IN_BYTES, XSECURE_ECDSA_P521_ALIGN_BYTES, XSECURE_ELLIPTIC_BAD_SIGN, XSECURE_ELLIPTIC_INVALID_PARAM, XSECURE_ELLIPTIC_VER_SIGN_INCORRECT_HASH_LEN, XSECURE_ELLIPTIC_VER_SIGN_R_ORDER_ERROR, XSECURE_ELLIPTIC_VER_SIGN_R_ZERO, XSECURE_ELLIPTIC_VER_SIGN_S_ORDER_ERROR, XSECURE_ELLIPTIC_VER_SIGN_S_ZERO, XSecure_PutData(), XSecure_ReleaseReset(), and XSecure_SetReset().

Referenced by XSecure_EllipticPwct(), and XSecure_EllipticVerifySign().

void XSecure_FixEndiannessNCopy ( const u32  Size,
u64  DstAddr,
const u64  SrcAddr 
)

This function copies data to destination based on library endianness selection.

    - Changes the endianness when library is operating in little endian
    - Copies data without changing any endianness when library is
    operating in big endain.
Parameters
SizeLength of data in bytes
SrcAddrAddress of the source buffer
DstAddrDestination address
Note
This is the helper function to convert the endianness as required.

References XSECURE_ELLIPTIC_LITTLE_ENDIAN.

void XSecure_GetData ( const u32  Size,
const u8 *  Src,
const u64  DstAddr 
)

This function copies data to 32/64 bit address from local buffer.

Parameters
SizeLength of data in bytes
SrcPointer to the source buffer
DstAddrDestination address

Copies data to provided address from local buffer based on the endianness configured

References XSECURE_ELLIPTIC_LITTLE_ENDIAN.

Referenced by XSecure_EcdhGetSecret(), XSecure_EllipticGenerateEphemeralKey(), XSecure_EllipticGenerateKey_64Bit(), XSecure_EllipticGenerateSignature_64Bit(), and XSecure_EllipticPrvtKeyGenerate().

int XSecure_PlatEllipticIpiHandler ( 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 parameter is invalid.
  • XST_FAILURE If there is a failure

References XSECURE_API, XSECURE_API_GEN_SHARED_SECRET, XSECURE_API_ID_MASK, XSecure_GenSharedSecret(), and XSecure_Printf.

void XSecure_PutData ( const u32  Size,
u8 *  Dst,
const u64  SrcAddr 
)

This function copies data from 32/64 bit address to local buffer.

Parameters
SizeLength of data in bytes
DstPointer to the destination buffer
SrcAddrSource address

Copies data from provided address to local buffer based on the endianness configured

References XSECURE_ELLIPTIC_LITTLE_ENDIAN.

Referenced by XSecure_EcdhGetSecret(), XSecure_EllipticGenerateKey_64Bit(), XSecure_EllipticGenerateSignature_64Bit(), XSecure_EllipticValidateKey_64Bit(), and XSecure_EllipticVerifySign_64Bit().