| NUC472_NUC442_BSP V3.04.000 The Board Support Package for NUC472/NUC442

Macros | Functions
CRYPTO Exported Functions
NUC472/NUC442 Device Driver » CRYPTO Driver » CRYPTO Exported Constants
Collaboration diagram for CRYPTO Exported Functions:

## Macros
#define | PRNG_ENABLE_INT()
| This macro enables PRNG interrupt. More...
#define | PRNG_DISABLE_INT()
| This macro disables PRNG interrupt. More...
#define | PRNG_GET_INT_FLAG()
| This macro gets PRNG interrupt flag. More...
#define | PRNG_CLR_INT_FLAG()
| This macro clears PRNG interrupt flag. More...
#define | AES_ENABLE_INT()
| This macro enables AES interrupt. More...
#define | AES_DISABLE_INT()
| This macro disables AES interrupt. More...
#define | AES_GET_INT_FLAG()
| This macro gets AES interrupt flag. More...
#define | AES_CLR_INT_FLAG()
| This macro clears AES interrupt flag. More...
#define | AES_ENABLE_KEY_PROTECT()
| This macro enables AES key protection. More...
#define | AES_DISABLE_KEY_PROTECT()
| This macro disables AES key protection. More...
#define | TDES_ENABLE_INT()
| This macro enables TDES interrupt. More...
#define | TDES_DISABLE_INT()
| This macro disables TDES interrupt. More...
#define | TDES_GET_INT_FLAG()
| This macro gets TDES interrupt flag. More...
#define | TDES_CLR_INT_FLAG()
| This macro clears TDES interrupt flag. More...
#define | TDES_ENABLE_KEY_PROTECT()
| This macro enables TDES key protection. More...
#define | TDES_DISABLE_KEY_PROTECT()
| This macro disables TDES key protection. More...
#define | SHA_ENABLE_INT()
| This macro enables SHA interrupt. More...
#define | SHA_DISABLE_INT()
| This macro disables SHA interrupt. More...
#define | SHA_GET_INT_FLAG()
| This macro gets SHA interrupt flag. More...
#define | SHA_CLR_INT_FLAG()
| This macro clears SHA interrupt flag. More...

## Functions
void | PRNG_Open (uint32_t u32KeySize, uint32_t u32SeedReload, uint32_t u32Seed)
| Open PRNG function. More...
void | PRNG_Start (void)
| Start to generate one PRNG key. More...
void | PRNG_Read (uint32_t u32RandKey[])
| Read the PRNG key. More...
void | AES_Open (uint32_t u32Channel, uint32_t u32EncDec, uint32_t u32OpMode, uint32_t u32KeySize, uint32_t u32SwapType)
| Open AES encrypt/decrypt function. More...
void | AES_Start (int32_t u32Channel, uint32_t u32DMAMode)
| Start AES encrypt/decrypt. More...
void | AES_SetKey (uint32_t u32Channel, uint32_t au32Keys[], uint32_t u32KeySize)
| Set AES keys. More...
void | AES_SetInitVect (uint32_t u32Channel, uint32_t au32IV[])
| Set AES initial vectors. More...
void | AES_SetDMATransfer (uint32_t u32Channel, uint32_t u32SrcAddr, uint32_t u32DstAddr, uint32_t u32TransCnt)
| Set AES DMA transfer configuration. More...
void | TDES_Open (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 (int32_t u32Channel, uint32_t u32DMAMode)
| Start TDES encrypt/decrypt. More...
void | TDES_SetKey (uint32_t u32Channel, uint32_t au32Keys[3][2])
| Set TDES keys. More...
void | TDES_SetInitVect (uint32_t u32Channel, uint32_t u32IVH, uint32_t u32IVL)
| Set TDES initial vectors. More...
void | TDES_SetDMATransfer (uint32_t u32Channel, uint32_t u32SrcAddr, uint32_t u32DstAddr, uint32_t u32TransCnt)
| Set TDES DMA transfer configuration. More...
void | SHA_Open (uint32_t u32OpMode, uint32_t u32SwapType)
| Open SHA encrypt function. More...
void | SHA_Start (uint32_t u32DMAMode)
| Start SHA encrypt. More...
void | SHA_SetDMATransfer (uint32_t u32SrcAddr, uint32_t u32TransCnt)
| Set SHA DMA transfer. More...
void | SHA_Read (uint32_t u32Digest[])
| Read the SHA digest. More...

## Detailed Description

## Macro Definition Documentation

## ◆ AES_CLR_INT_FLAG

#define AES_CLR_INT_FLAG | ( |  | ) |

This macro clears AES interrupt flag.

Parameters

  None |

Returns
  None

Definition at line 167 of file crypto.h.

## ◆ AES_DISABLE_INT

#define AES_DISABLE_INT | ( |  | ) |

This macro disables AES interrupt.

Parameters

  None |

Returns
  None

Definition at line 151 of file crypto.h.

## ◆ AES_DISABLE_KEY_PROTECT

#define AES_DISABLE_KEY_PROTECT | ( |  | ) |

This macro disables AES key protection.

Parameters

  None |

Returns
  None

Definition at line 183 of file crypto.h.

## ◆ AES_ENABLE_INT

#define AES_ENABLE_INT | ( |  | ) |

This macro enables AES interrupt.

Parameters

  None |

Returns
  None

Definition at line 143 of file crypto.h.

## ◆ AES_ENABLE_KEY_PROTECT

#define AES_ENABLE_KEY_PROTECT | ( |  | ) |

This macro enables AES key protection.

Parameters

  None |

Returns
  None

Definition at line 175 of file crypto.h.

## ◆ AES_GET_INT_FLAG

#define AES_GET_INT_FLAG | ( |  | ) |

This macro gets AES interrupt flag.

Parameters

  None |

Returns
  AES interrupt flag.

Definition at line 159 of file crypto.h.

## ◆ PRNG_CLR_INT_FLAG

#define PRNG_CLR_INT_FLAG | ( |  | ) |

This macro clears PRNG interrupt flag.

Parameters

  None |

Returns
  None

Definition at line 135 of file crypto.h.

## ◆ PRNG_DISABLE_INT

#define PRNG_DISABLE_INT | ( |  | ) |

This macro disables PRNG interrupt.

Parameters

  None |

Returns
  None

Definition at line 119 of file crypto.h.

## ◆ PRNG_ENABLE_INT

#define PRNG_ENABLE_INT | ( |  | ) |

This macro enables PRNG interrupt.

Parameters

  None |

Returns
  None

Definition at line 111 of file crypto.h.

## ◆ PRNG_GET_INT_FLAG

#define PRNG_GET_INT_FLAG | ( |  | ) |

This macro gets PRNG interrupt flag.

Parameters

  None |

Returns
  PRNG interrupt flag.

Definition at line 127 of file crypto.h.

## ◆ SHA_CLR_INT_FLAG

#define SHA_CLR_INT_FLAG | ( |  | ) |

This macro clears SHA interrupt flag.

Parameters

  None |

Returns
  None

Definition at line 263 of file crypto.h.

## ◆ SHA_DISABLE_INT

#define SHA_DISABLE_INT | ( |  | ) |

This macro disables SHA interrupt.

Parameters

  None |

Returns
  None

Definition at line 247 of file crypto.h.

## ◆ SHA_ENABLE_INT

#define SHA_ENABLE_INT | ( |  | ) |

This macro enables SHA interrupt.

Parameters

  None |

Returns
  None

Definition at line 239 of file crypto.h.

## ◆ SHA_GET_INT_FLAG

#define SHA_GET_INT_FLAG | ( |  | ) |

This macro gets SHA interrupt flag.

Parameters

  None |

Returns
  SHA interrupt flag.

Definition at line 255 of file crypto.h.

## ◆ TDES_CLR_INT_FLAG

#define TDES_CLR_INT_FLAG | ( |  | ) |

This macro clears TDES interrupt flag.

Parameters

  None |

Returns
  None

Definition at line 215 of file crypto.h.

## ◆ TDES_DISABLE_INT

#define TDES_DISABLE_INT | ( |  | ) |

This macro disables TDES interrupt.

Parameters

  None |

Returns
  None

Definition at line 199 of file crypto.h.

## ◆ TDES_DISABLE_KEY_PROTECT

#define TDES_DISABLE_KEY_PROTECT | ( |  | ) |

This macro disables TDES key protection.

Parameters

  None |

Returns
  None

Definition at line 231 of file crypto.h.

## ◆ TDES_ENABLE_INT

#define TDES_ENABLE_INT | ( |  | ) |

This macro enables TDES interrupt.

Parameters

  None |

Returns
  None

Definition at line 191 of file crypto.h.

## ◆ TDES_ENABLE_KEY_PROTECT

#define TDES_ENABLE_KEY_PROTECT | ( |  | ) |

This macro enables TDES key protection.

Parameters

  None |

Returns
  None

Definition at line 223 of file crypto.h.

## ◆ TDES_GET_INT_FLAG

#define TDES_GET_INT_FLAG | ( |  | ) |

This macro gets TDES interrupt flag.

Parameters

  None |

Returns
  TDES interrupt flag.

Definition at line 207 of file crypto.h.

## Function Documentation

## ◆ AES_Open()

void AES_Open | ( | uint32_t | u32Channel,
|  | uint32_t | u32EncDec,
|  | uint32_t | u32OpMode,
|  | uint32_t | u32KeySize,
|  | uint32_t | u32SwapType
| ) |  |

Open AES encrypt/decrypt function.

Parameters

  [in] | u32Channel | AES channel. Must be 0~3.
  [in] | u32EncDec | 1: AES encode; 0: AES decode
  [in] | u32OpMode | AES operation mode, including: AES_MODE_ECB AES_MODE_CBC AES_MODE_CFB AES_MODE_OFB AES_MODE_CTR AES_MODE_CBC_CS1 AES_MODE_CBC_CS2 AES_MODE_CBC_CS3
  [in] | u32KeySize | is AES key size, including: AES_KEY_SIZE_128 AES_KEY_SIZE_192 AES_KEY_SIZE_256
  [in] | u32SwapType | is AES input/output data swap control, including: AES_NO_SWAP AES_OUT_SWAP AES_IN_SWAP AES_IN_OUT_SWAP

Returns
  None

Definition at line 107 of file crypto.c.

## ◆ AES_SetDMATransfer()

void AES_SetDMATransfer | ( | uint32_t | u32Channel,
|  | uint32_t | u32SrcAddr,
|  | uint32_t | u32DstAddr,
|  | uint32_t | u32TransCnt
| ) |  |

Set AES DMA transfer configuration.

Parameters

  [in] | u32Channel | AES channel. Must be 0~3.
  [in] | u32SrcAddr | AES DMA source address
  [in] | u32DstAddr | AES DMA destination address
  [in] | u32TransCnt | AES DMA transfer byte count

Returns
  None

Definition at line 184 of file crypto.c.

## ◆ AES_SetInitVect()

void AES_SetInitVect | ( | uint32_t | u32Channel,
|  | uint32_t | au32IV[]
| ) |  |

Set AES initial vectors.

Parameters

  [in] | u32Channel | AES channel. Must be 0~3.
  [in] | au32IV | A four entry word array contains AES initial vectors.

Returns
  None

Definition at line 163 of file crypto.c.

## ◆ AES_SetKey()

void AES_SetKey | ( | uint32_t | u32Channel,
|  | uint32_t | au32Keys[],
|  | uint32_t | u32KeySize
| ) |  |

Set AES keys.

Parameters

  [in] | u32Channel | AES channel. Must be 0~3.
  [in] | au32Keys | An word array contains AES keys.
  [in] | u32KeySize | is AES key size, including: AES_KEY_SIZE_128 AES_KEY_SIZE_192 AES_KEY_SIZE_256

Returns
  None

Definition at line 143 of file crypto.c.

## ◆ AES_Start()

void AES_Start | ( | int32_t | u32Channel,
|  | uint32_t | u32DMAMode
| ) |  |

Start AES encrypt/decrypt.

Parameters

  [in] | u32Channel | AES channel. Must be 0~3.
  [in] | u32DMAMode | AES DMA control, including: CRYPTO_DMA_ONE_SHOT One shop AES encrypt/decrypt. CRYPTO_DMA_CONTINUE Continuous AES encrypt/decrypt. CRYPTO_DMA_LAST Last AES encrypt/decrypt of a series of AES_Start.

Returns
  None

Definition at line 127 of file crypto.c.

## ◆ PRNG_Open()

HIDDEN_SYMBOLS void PRNG_Open | ( | uint32_t | u32KeySize,
|  | uint32_t | u32SeedReload,
|  | uint32_t | u32Seed
| ) |  |

Open PRNG function.

Parameters

  [in] | u32KeySize | is PRNG key size, including: PRNG_KEY_SIZE_64 PRNG_KEY_SIZE_128 PRNG_KEY_SIZE_192 PRNG_KEY_SIZE_256
  [in] | u32SeedReload | is PRNG seed reload or not, including: PRNG_SEED_CONT PRNG_SEED_RELOAD
  [in] | u32Seed | The new seed. Only valid when u32SeedReload is PRNG_SEED_RELOAD.

Returns
  None

Definition at line 49 of file crypto.c.

## ◆ PRNG_Read()

void PRNG_Read | ( | uint32_t | u32RandKey[] | ) |

Read the PRNG key.

Parameters

  [out] | u32RandKey | The key buffer to store newly generated PRNG key.

Returns
  None

Definition at line 73 of file crypto.c.

## ◆ PRNG_Start()

void PRNG_Start | ( | void |  | ) |

Start to generate one PRNG key.

Parameters

  None |

Returns
  None

Definition at line 63 of file crypto.c.

## ◆ SHA_Open()

void SHA_Open | ( | uint32_t | u32OpMode,
|  | uint32_t | u32SwapType
| ) |  |

Open SHA encrypt function.

Parameters

  [in] | u32OpMode | SHA operation mode, including: SHA_MODE_SHA1 SHA_MODE_SHA224 SHA_MODE_SHA256
  [in] | u32SwapType | is SHA input/output data swap control, including: SHA_NO_SWAP SHA_OUT_SWAP SHA_IN_SWAP SHA_IN_OUT_SWAP

Returns
  None

Definition at line 328 of file crypto.c.

## ◆ SHA_Read()

void SHA_Read | ( | uint32_t | u32Digest[] | ) |

Read the SHA digest.

Parameters

  [out] | u32Digest | The SHA encrypt output digest.

Returns
  None

Definition at line 365 of file crypto.c.

## ◆ SHA_SetDMATransfer()

void SHA_SetDMATransfer | ( | uint32_t | u32SrcAddr,
|  | uint32_t | u32TransCnt
| ) |  |

Set SHA DMA transfer.

Parameters

  [in] | u32SrcAddr | SHA DMA source address
  [in] | u32TransCnt | SHA DMA transfer byte count

Returns
  None

Definition at line 354 of file crypto.c.

## ◆ SHA_Start()

void SHA_Start | ( | uint32_t | u32DMAMode | ) |

Start SHA encrypt.

Parameters

  [in] | u32DMAMode | TDES DMA control, including: CRYPTO_DMA_ONE_SHOT One shop SHA encrypt. CRYPTO_DMA_CONTINUE Continuous SHA encrypt. CRYPTO_DMA_LAST Last SHA encrypt of a series of SHA_Start.

Returns
  None

Definition at line 342 of file crypto.c.

## ◆ TDES_Open()

void TDES_Open | ( | 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] | u32Channel | TDES channel. Must be 0~3.
  [in] | u32EncDec | 1: TDES encode; 0: TDES decode
  [in] | Is3DES | 1: TDES; 0: DES
  [in] | Is3Key | 1: TDES 3 key mode; 0: TDES 2 key mode
  [in] | u32OpMode | TDES operation mode, including: TDES_MODE_ECB TDES_MODE_CBC TDES_MODE_CFB TDES_MODE_OFB TDES_MODE_CTR
  [in] | u32SwapType | is TDES input/output data swap control and word swap control, including: TDES_NO_SWAP TDES_WHL_SWAP TDES_OUT_SWAP TDES_OUT_WHL_SWAP TDES_IN_SWAP TDES_IN_WHL_SWAP TDES_IN_OUT_SWAP TDES_IN_OUT_WHL_SWAP

Returns
  None

Definition at line 222 of file crypto.c.

## ◆ TDES_SetDMATransfer()

void TDES_SetDMATransfer | ( | uint32_t | u32Channel,
|  | uint32_t | u32SrcAddr,
|  | uint32_t | u32DstAddr,
|  | uint32_t | u32TransCnt
| ) |  |

Set TDES DMA transfer configuration.

Parameters

  [in] | u32Channel | TDES channel. Must be 0~3.
  [in] | u32SrcAddr | TDES DMA source address
  [in] | u32DstAddr | TDES DMA destination address
  [in] | u32TransCnt | TDES DMA transfer byte count

Returns
  None

Definition at line 300 of file crypto.c.

## ◆ TDES_SetInitVect()

void TDES_SetInitVect | ( | uint32_t | u32Channel,
|  | uint32_t | u32IVH,
|  | uint32_t | u32IVL
| ) |  |

Set TDES initial vectors.

Parameters

  [in] | u32Channel | TDES channel. Must be 0~3.
  [in] | u32IVH | TDES initial vector high word.
  [in] | u32IVL | TDES initial vector low word.

Returns
  None

Definition at line 281 of file crypto.c.

## ◆ TDES_SetKey()

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

Set TDES keys.

Parameters

  [in] | u32Channel | TDES channel. Must be 0~3.
  [in] | au32Keys | The TDES keys. au32Keys[0][0] is Key0 high word and au32Keys[0][1] is key0 low word.

Returns
  None

Definition at line 259 of file crypto.c.

## ◆ TDES_Start()

void TDES_Start | ( | int32_t | u32Channel,
|  | uint32_t | u32DMAMode
| ) |  |

Start TDES encrypt/decrypt.

Parameters

  [in] | u32Channel | TDES channel. Must be 0~3.
  [in] | u32DMAMode | TDES DMA control, including: CRYPTO_DMA_ONE_SHOT One shop TDES encrypt/decrypt. CRYPTO_DMA_CONTINUE Continuous TDES encrypt/decrypt. CRYPTO_DMA_LAST Last TDES encrypt/decrypt of a series of TDES_Start.

Returns
  None

Definition at line 247 of file crypto.c.