M480 BSP V3.05.005
The Board Support Package for M480 Series
Enumerator | Functions

Functions

void PRNG_Open (CRPT_T *crpt, uint32_t u32KeySize, uint32_t u32SeedReload, uint32_t u32Seed)
 Open PRNG function. More...
 
void PRNG_Start (CRPT_T *crpt)
 Start to generate one PRNG key. More...
 
void PRNG_Read (CRPT_T *crpt, uint32_t u32RandKey[])
 Read the PRNG key. More...
 
void AES_Open (CRPT_T *crpt, uint32_t u32Channel, uint32_t u32EncDec, uint32_t u32OpMode, uint32_t u32KeySize, uint32_t u32SwapType)
 Open AES encrypt/decrypt function. More...
 
void AES_Start (CRPT_T *crpt, uint32_t u32Channel, uint32_t u32DMAMode)
 Start AES encrypt/decrypt. More...
 
void AES_SetKey (CRPT_T *crpt, uint32_t u32Channel, uint32_t au32Keys[], uint32_t u32KeySize)
 Set AES keys. More...
 
void AES_SetInitVect (CRPT_T *crpt, uint32_t u32Channel, uint32_t au32IV[])
 Set AES initial vectors. More...
 
void AES_SetDMATransfer (CRPT_T *crpt, uint32_t u32Channel, uint32_t u32SrcAddr, uint32_t u32DstAddr, uint32_t u32TransCnt)
 Set AES DMA transfer configuration. More...
 
void TDES_Open (CRPT_T *crpt, uint32_t u32Channel, uint32_t u32EncDec, int32_t Is3DES, int32_t Is3Key, uint32_t u32OpMode, uint32_t u32SwapType)
 Open TDES encrypt/decrypt function. More...
 
void TDES_Start (CRPT_T *crpt, int32_t u32Channel, uint32_t u32DMAMode)
 Start TDES encrypt/decrypt. More...
 
void TDES_SetKey (CRPT_T *crpt, uint32_t u32Channel, uint32_t au32Keys[3][2])
 Set TDES keys. More...
 
void TDES_SetInitVect (CRPT_T *crpt, uint32_t u32Channel, uint32_t u32IVH, uint32_t u32IVL)
 Set TDES initial vectors. More...
 
void TDES_SetDMATransfer (CRPT_T *crpt, uint32_t u32Channel, uint32_t u32SrcAddr, uint32_t u32DstAddr, uint32_t u32TransCnt)
 Set TDES DMA transfer configuration. More...
 
void SHA_Open (CRPT_T *crpt, uint32_t u32OpMode, uint32_t u32SwapType, uint32_t hmac_key_len)
 Open SHA encrypt function. More...
 
void SHA_Start (CRPT_T *crpt, uint32_t u32DMAMode)
 Start SHA encrypt. More...
 
void SHA_SetDMATransfer (CRPT_T *crpt, uint32_t u32SrcAddr, uint32_t u32TransCnt)
 Set SHA DMA transfer. More...
 
void SHA_Read (CRPT_T *crpt, uint32_t u32Digest[])
 Read the SHA digest. More...
 
void ECC_Complete (CRPT_T *crpt)
 ECC interrupt service routine. User application must invoke this function in his CRYPTO_IRQHandler() to let Crypto driver know ECC processing was done. More...
 
int ECC_IsPrivateKeyValid (CRPT_T *crpt, E_ECC_CURVE ecc_curve, char private_k[])
 Check if the private key is located in valid range of curve. More...
 
int32_t ECC_GeneratePublicKey (CRPT_T *crpt, E_ECC_CURVE ecc_curve, char *private_k, char public_k1[], char public_k2[])
 Given a private key and curve to generate the public key pair. More...
 
int32_t ECC_Mutiply (CRPT_T *crpt, E_ECC_CURVE ecc_curve, char x1[], char y1[], char *k, char x2[], char y2[])
 Given a private key and curve to generate the public key pair. More...
 
int32_t ECC_GenerateSecretZ (CRPT_T *crpt, E_ECC_CURVE ecc_curve, char *private_k, char public_k1[], char public_k2[], char secret_z[])
 Given a curve parameter, the other party's public key, and one's own private key to generate the secret Z. More...
 
int32_t ECC_GenerateSignature (CRPT_T *crpt, E_ECC_CURVE ecc_curve, char *message, char *d, char *k, char *R, char *S)
 ECDSA digital signature generation. More...
 
int32_t ECC_VerifySignature (CRPT_T *crpt, E_ECC_CURVE ecc_curve, char *message, char *public_k1, char *public_k2, char *R, char *S)
 ECDSA dogotal signature verification. More...
 

Detailed Description

Function Documentation

◆ AES_Open()

void AES_Open ( CRPT_T crpt,
uint32_t  u32Channel,
uint32_t  u32EncDec,
uint32_t  u32OpMode,
uint32_t  u32KeySize,
uint32_t  u32SwapType 
)

Open AES encrypt/decrypt function.

Parameters
[in]crptReference to Crypto module.
[in]u32ChannelAES channel. Must be 0~3.
[in]u32EncDec1: AES encode; 0: AES decode
[in]u32OpModeAES operation mode, including:
[in]u32KeySizeis AES key size, including:
[in]u32SwapTypeis AES input/output data swap control, including:
Returns
None

Definition at line 140 of file crypto.c.

◆ AES_SetDMATransfer()

void AES_SetDMATransfer ( CRPT_T crpt,
uint32_t  u32Channel,
uint32_t  u32SrcAddr,
uint32_t  u32DstAddr,
uint32_t  u32TransCnt 
)

Set AES DMA transfer configuration.

Parameters
[in]crptReference to Crypto module.
[in]u32ChannelAES channel. Must be 0~3.
[in]u32SrcAddrAES DMA source address
[in]u32DstAddrAES DMA destination address
[in]u32TransCntAES DMA transfer byte count
Returns
None

Definition at line 221 of file crypto.c.

◆ AES_SetInitVect()

void AES_SetInitVect ( CRPT_T crpt,
uint32_t  u32Channel,
uint32_t  au32IV[] 
)

Set AES initial vectors.

Parameters
[in]crptReference to Crypto module.
[in]u32ChannelAES channel. Must be 0~3.
[in]au32IVA four entry word array contains AES initial vectors.
Returns
None

Definition at line 199 of file crypto.c.

◆ AES_SetKey()

void AES_SetKey ( CRPT_T crpt,
uint32_t  u32Channel,
uint32_t  au32Keys[],
uint32_t  u32KeySize 
)

Set AES keys.

Parameters
[in]crptReference to Crypto module.
[in]u32ChannelAES channel. Must be 0~3.
[in]au32KeysAn word array contains AES keys.
[in]u32KeySizeis AES key size, including:
Returns
None

Definition at line 178 of file crypto.c.

◆ AES_Start()

void AES_Start ( CRPT_T crpt,
uint32_t  u32Channel,
uint32_t  u32DMAMode 
)

Start AES encrypt/decrypt.

Parameters
[in]crptReference to Crypto module.
[in]u32ChannelAES channel. Must be 0~3.
[in]u32DMAModeAES DMA control, including:
Returns
None

Definition at line 161 of file crypto.c.

◆ ECC_Complete()

void ECC_Complete ( CRPT_T crpt)

ECC interrupt service routine. User application must invoke this function in his CRYPTO_IRQHandler() to let Crypto driver know ECC processing was done.

HIDDEN_SYMBOLS

Parameters
[in]crptReference to Crypto module.
Returns
none

Definition at line 1138 of file crypto.c.

◆ ECC_GeneratePublicKey()

int32_t ECC_GeneratePublicKey ( CRPT_T crpt,
E_ECC_CURVE  ecc_curve,
char *  private_k,
char  public_k1[],
char  public_k2[] 
)

Given a private key and curve to generate the public key pair.

Parameters
[in]crptReference to Crypto module.
[in]private_kThe input private key.
[in]ecc_curveThe pre-defined ECC curve.
[out]public_k1The output public key 1.
[out]public_k2The output public key 2.
Returns
0 Success.
-1 H/W error or time-out
-2 "ecc_curve" value is invalid.

Definition at line 1212 of file crypto.c.

◆ ECC_GenerateSecretZ()

int32_t ECC_GenerateSecretZ ( CRPT_T crpt,
E_ECC_CURVE  ecc_curve,
char *  private_k,
char  public_k1[],
char  public_k2[],
char  secret_z[] 
)

Given a curve parameter, the other party's public key, and one's own private key to generate the secret Z.

Parameters
[in]crptReference to Crypto module.
[in]ecc_curveThe pre-defined ECC curve.
[in]private_kOne's own private key.
[in]public_k1The other party's publick key 1.
[in]public_k2The other party's publick key 2.
[out]secret_zThe ECC CDH secret Z.
Returns
0 Success.
-1 H/W error or time-out
-2 "ecc_curve" value is invalid.

Definition at line 1327 of file crypto.c.

◆ ECC_GenerateSignature()

int32_t ECC_GenerateSignature ( CRPT_T crpt,
E_ECC_CURVE  ecc_curve,
char *  message,
char *  d,
char *  k,
char *  R,
char *  S 
)

ECDSA digital signature generation.

HIDDEN_SYMBOLS

Parameters
[in]crptReference to Crypto module.
[in]ecc_curveThe pre-defined ECC curve.
[in]messageThe hash value of source context.
[in]dThe private key.
[in]kThe selected random integer.
[out]RR of the (R,S) pair digital signature
[out]SS of the (R,S) pair digital signature
Returns
0 Success.
-1 H/W error or time-out
-2 "ecc_curve" value is invalid.

Definition at line 1445 of file crypto.c.

◆ ECC_IsPrivateKeyValid()

int ECC_IsPrivateKeyValid ( CRPT_T crpt,
E_ECC_CURVE  ecc_curve,
char  private_k[] 
)

Check if the private key is located in valid range of curve.

Parameters
[in]crptReference to Crypto module.
[in]ecc_curveThe pre-defined ECC curve.
[in]private_kThe input private key.
Returns
1 Is valid.
0 Is not valid.
-2 Invalid curve.

Definition at line 1164 of file crypto.c.

◆ ECC_Mutiply()

int32_t ECC_Mutiply ( CRPT_T crpt,
E_ECC_CURVE  ecc_curve,
char  x1[],
char  y1[],
char *  k,
char  x2[],
char  y2[] 
)

Given a private key and curve to generate the public key pair.

Parameters
[in]crptReference to Crypto module.
[out]x1The x-coordinate of input point.
[out]y1The y-coordinate of input point.
[in]kThe private key
[in]ecc_curveThe pre-defined ECC curve.
[out]x2The x-coordinate of output point.
[out]y2The y-coordinate of output point.
Returns
0 Success.
-1 H/W error or time-out
-2 "ecc_curve" value is invalid.

Definition at line 1268 of file crypto.c.

◆ ECC_VerifySignature()

int32_t ECC_VerifySignature ( CRPT_T crpt,
E_ECC_CURVE  ecc_curve,
char *  message,
char *  public_k1,
char *  public_k2,
char *  R,
char *  S 
)

ECDSA dogotal signature verification.

Parameters
[in]crptReference to Crypto module.
[in]ecc_curveThe pre-defined ECC curve.
[in]messageThe hash value of source context.
[in]public_k1The public key 1.
[in]public_k2The public key 2.
[in]RR of the (R,S) pair digital signature
[in]SS of the (R,S) pair digital signature
Returns
0 Success.
-1 H/W error or time-out
-2 "ecc_curve" value is invalid.
-4 Verification failed.

Definition at line 1681 of file crypto.c.

◆ PRNG_Open()

void PRNG_Open ( CRPT_T crpt,
uint32_t  u32KeySize,
uint32_t  u32SeedReload,
uint32_t  u32Seed 
)

Open PRNG function.

HIDDEN_SYMBOLS

Parameters
[in]crptReference to Crypto module.
[in]u32KeySizeis PRNG key size, including:
[in]u32SeedReloadis PRNG seed reload or not, including:
[in]u32SeedThe new seed. Only valid when u32SeedReload is PRNG_SEED_RELOAD.
Returns
None

Definition at line 73 of file crypto.c.

◆ PRNG_Read()

void PRNG_Read ( CRPT_T crpt,
uint32_t  u32RandKey[] 
)

Read the PRNG key.

Parameters
[in]crptReference to Crypto module.
[out]u32RandKeyThe key buffer to store newly generated PRNG key.
Returns
None

Definition at line 100 of file crypto.c.

◆ PRNG_Start()

void PRNG_Start ( CRPT_T crpt)

Start to generate one PRNG key.

Parameters
[in]crptReference to Crypto module.
Returns
None

Definition at line 89 of file crypto.c.

◆ SHA_Open()

void SHA_Open ( CRPT_T crpt,
uint32_t  u32OpMode,
uint32_t  u32SwapType,
uint32_t  hmac_key_len 
)

Open SHA encrypt function.

Parameters
[in]crptReference to Crypto module.
[in]u32OpModeSHA operation mode, including:
[in]u32SwapTypeis SHA input/output data swap control, including:
[in]hmac_key_lenHMAC key byte count
Returns
None

Definition at line 374 of file crypto.c.

◆ SHA_Read()

void SHA_Read ( CRPT_T crpt,
uint32_t  u32Digest[] 
)

Read the SHA digest.

Parameters
[in]crptReference to Crypto module.
[out]u32DigestThe SHA encrypt output digest.
Returns
None

Definition at line 424 of file crypto.c.

◆ SHA_SetDMATransfer()

void SHA_SetDMATransfer ( CRPT_T crpt,
uint32_t  u32SrcAddr,
uint32_t  u32TransCnt 
)

Set SHA DMA transfer.

Parameters
[in]crptReference to Crypto module.
[in]u32SrcAddrSHA DMA source address
[in]u32TransCntSHA DMA transfer byte count
Returns
None

Definition at line 412 of file crypto.c.

◆ SHA_Start()

void SHA_Start ( CRPT_T crpt,
uint32_t  u32DMAMode 
)

Start SHA encrypt.

Parameters
[in]crptReference to Crypto module.
[in]u32DMAModeTDES DMA control, including:
Returns
None

Definition at line 399 of file crypto.c.

◆ TDES_Open()

void TDES_Open ( CRPT_T crpt,
uint32_t  u32Channel,
uint32_t  u32EncDec,
int32_t  Is3DES,
int32_t  Is3Key,
uint32_t  u32OpMode,
uint32_t  u32SwapType 
)

Open TDES encrypt/decrypt function.

Parameters
[in]crptReference to Crypto module.
[in]u32ChannelTDES channel. Must be 0~3.
[in]u32EncDec1: TDES encode; 0: TDES decode
[in]Is3DES1: TDES; 0: DES
[in]Is3Key1: TDES 3 key mode; 0: TDES 2 key mode
[in]u32OpModeTDES operation mode, including:
[in]u32SwapTypeis TDES input/output data swap control and word swap control, including:
Returns
None

Definition at line 260 of file crypto.c.

◆ TDES_SetDMATransfer()

void TDES_SetDMATransfer ( CRPT_T crpt,
uint32_t  u32Channel,
uint32_t  u32SrcAddr,
uint32_t  u32DstAddr,
uint32_t  u32TransCnt 
)

Set TDES DMA transfer configuration.

Parameters
[in]crptReference to Crypto module.
[in]u32ChannelTDES channel. Must be 0~3.
[in]u32SrcAddrTDES DMA source address
[in]u32DstAddrTDES DMA destination address
[in]u32TransCntTDES DMA transfer byte count
Returns
None

Definition at line 342 of file crypto.c.

◆ TDES_SetInitVect()

void TDES_SetInitVect ( CRPT_T crpt,
uint32_t  u32Channel,
uint32_t  u32IVH,
uint32_t  u32IVL 
)

Set TDES initial vectors.

Parameters
[in]crptReference to Crypto module.
[in]u32ChannelTDES channel. Must be 0~3.
[in]u32IVHTDES initial vector high word.
[in]u32IVLTDES initial vector low word.
Returns
None

Definition at line 322 of file crypto.c.

◆ TDES_SetKey()

void TDES_SetKey ( CRPT_T crpt,
uint32_t  u32Channel,
uint32_t  au32Keys[3][2] 
)

Set TDES keys.

Parameters
[in]crptReference to Crypto module.
[in]u32ChannelTDES channel. Must be 0~3.
[in]au32KeysThe TDES keys. au32Keys[0][0] is Key0 high word and au32Keys[0][1] is key0 low word.
Returns
None

Definition at line 299 of file crypto.c.

◆ TDES_Start()

void TDES_Start ( CRPT_T crpt,
int32_t  u32Channel,
uint32_t  u32DMAMode 
)

Start TDES encrypt/decrypt.

Parameters
[in]crptReference to Crypto module.
[in]u32ChannelTDES channel. Must be 0~3.
[in]u32DMAModeTDES DMA control, including:
Returns
None

Definition at line 286 of file crypto.c.