34 #if defined(CRYPTO_COUNT) && (CRYPTO_COUNT > 0)
55 #define CRYPTO_INSTRUCTIONS_PER_REG (4)
56 #define CRYPTO_INSTRUCTIONS_MAX (12)
57 #define CRYPTO_INSTRUCTION_REGS (CRYPTO_INSTRUCTIONS_MAX/CRYPTO_INSTRUCTIONS_PER_REG)
59 #define CRYPTO_SHA1_BLOCK_SIZE_IN_BITS (512)
60 #define CRYPTO_SHA1_BLOCK_SIZE_IN_BYTES (CRYPTO_SHA1_BLOCK_SIZE_IN_BITS/8)
61 #define CRYPTO_SHA1_BLOCK_SIZE_IN_32BIT_WORDS (CRYPTO_SHA1_BLOCK_SIZE_IN_BYTES/sizeof(uint32_t))
62 #define CRYPTO_SHA1_DIGEST_SIZE_IN_32BIT_WORDS (CRYPTO_SHA1_DIGEST_SIZE_IN_BYTES/sizeof(uint32_t))
64 #define CRYPTO_SHA256_BLOCK_SIZE_IN_BITS (512)
65 #define CRYPTO_SHA256_BLOCK_SIZE_IN_BYTES (CRYPTO_SHA256_BLOCK_SIZE_IN_BITS/8)
66 #define CRYPTO_SHA256_BLOCK_SIZE_IN_32BIT_WORDS (CRYPTO_SHA256_BLOCK_SIZE_IN_BYTES/sizeof(uint32_t))
68 #define CRYPTO_SHA256_DIGEST_SIZE_IN_32BIT_WORDS (CRYPTO_SHA256_DIGEST_SIZE_IN_BYTES/sizeof(uint32_t))
70 #define PARTIAL_OPERAND_WIDTH_LOG2 (7)
71 #define PARTIAL_OPERAND_WIDTH (1<<PARTIAL_OPERAND_WIDTH_LOG2)
72 #define PARTIAL_OPERAND_WIDTH_MASK (PARTIAL_OPERAND_WIDTH-1)
73 #define PARTIAL_OPERAND_WIDTH_IN_BYTES (PARTIAL_OPERAND_WIDTH/8)
74 #define PARTIAL_OPERAND_WIDTH_IN_32BIT_WORDS (PARTIAL_OPERAND_WIDTH_IN_BYTES/sizeof(uint32_t))
76 #define SWAP32(x) (__REV(x))
78 #define CRYPTO_AES_BLOCKSIZE (16)
134 #ifdef USE_VARIABLE_SIZED_DATA_LOADS
153 volatile uint32_t * reg = (
volatile uint32_t *) dataReg;
158 for (i = 0; i < valSize; i++)
202 #ifdef _CRYPTO_WAC_MODULUS_ECCBIN233N
214 #ifdef _CRYPTO_WAC_MODULUS_ECCPRIME256P
285 uint32_t shaBlock[CRYPTO_SHA1_BLOCK_SIZE_IN_32BIT_WORDS]=
288 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0
290 uint8_t * p8ShaBlock = (uint8_t *) shaBlock;
304 CRYPTO_EXECUTE_2(crypto,
310 while (len >= CRYPTO_SHA1_BLOCK_SIZE_IN_BYTES)
316 CRYPTO_EXECUTE_3(crypto,
321 len -= CRYPTO_SHA1_BLOCK_SIZE_IN_BYTES;
322 msg += CRYPTO_SHA1_BLOCK_SIZE_IN_BYTES;
329 p8ShaBlock[blockLen++] = *msg++;
332 p8ShaBlock[blockLen++] = 0x80;
340 while (blockLen < 64)
341 p8ShaBlock[blockLen++] = 0;
347 CRYPTO_EXECUTE_3(crypto,
355 while (blockLen < 56)
356 p8ShaBlock[blockLen++] = 0;
360 uint64_t msgLenInBits = msgLen << 3;
361 temp = msgLenInBits >> 32;
362 *(uint32_t*)&p8ShaBlock[56] = SWAP32(temp);
363 temp = msgLenInBits & 0xFFFFFFFF;
364 *(uint32_t*)&p8ShaBlock[60] = SWAP32(temp);
371 CRYPTO_EXECUTE_3(crypto,
377 ((uint32_t*)msgDigest)[0] = crypto->
DDATA0BIG;
378 ((uint32_t*)msgDigest)[1] = crypto->
DDATA0BIG;
379 ((uint32_t*)msgDigest)[2] = crypto->
DDATA0BIG;
380 ((uint32_t*)msgDigest)[3] = crypto->
DDATA0BIG;
381 ((uint32_t*)msgDigest)[4] = crypto->
DDATA0BIG;
415 uint32_t shaBlock[CRYPTO_SHA256_BLOCK_SIZE_IN_32BIT_WORDS]=
418 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
419 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
421 uint8_t * p8ShaBlock = (uint8_t *) shaBlock;
435 CRYPTO_EXECUTE_2(crypto,
440 while (len >= CRYPTO_SHA256_BLOCK_SIZE_IN_BYTES)
446 CRYPTO_EXECUTE_3(crypto,
451 len -= CRYPTO_SHA256_BLOCK_SIZE_IN_BYTES;
452 msg += CRYPTO_SHA256_BLOCK_SIZE_IN_BYTES;
459 p8ShaBlock[blockLen++] = *msg++;
462 p8ShaBlock[blockLen++] = 0x80;
470 while (blockLen < 64)
471 p8ShaBlock[blockLen++] = 0;
477 CRYPTO_EXECUTE_3(crypto,
485 while (blockLen < 56)
486 p8ShaBlock[blockLen++] = 0;
490 uint64_t msgLenInBits = msgLen << 3;
491 temp = msgLenInBits >> 32;
492 *(uint32_t *)&p8ShaBlock[56] = SWAP32(temp);
493 temp = msgLenInBits & 0xFFFFFFFF;
494 *(uint32_t *)&p8ShaBlock[60] = SWAP32(temp);
501 CRYPTO_EXECUTE_3(crypto,
520 while (num32bitWords--)
535 for (i=0; i<num32bitWords; i++)
536 if (++words32bits[i] != 0)
559 uint32_t * A,
int aSize,
560 uint32_t * B,
int bSize,
561 uint32_t * R,
int rSize)
567 #ifdef USE_VARIABLE_SIZED_DATA_LOADS
568 int numWordsLastOperandA = (aSize&PARTIAL_OPERAND_WIDTH_MASK)>>5;
569 int numPartialOperandsA = numWordsLastOperandA ?
570 (aSize >> PARTIAL_OPERAND_WIDTH_LOG2) + 1 :
571 aSize >> PARTIAL_OPERAND_WIDTH_LOG2;
572 int numWordsLastOperandB = (bSize&PARTIAL_OPERAND_WIDTH_MASK)>>5;
573 int numPartialOperandsB = numWordsLastOperandB ?
574 (bSize >> PARTIAL_OPERAND_WIDTH_LOG2) + 1 :
575 bSize >> PARTIAL_OPERAND_WIDTH_LOG2;
576 int numWordsLastOperandR = (rSize&PARTIAL_OPERAND_WIDTH_MASK)>>5;
577 int numPartialOperandsR = numWordsLastOperandR ?
578 (rSize >> PARTIAL_OPERAND_WIDTH_LOG2) + 1 :
579 rSize >> PARTIAL_OPERAND_WIDTH_LOG2;
580 EFM_ASSERT(numPartialOperandsA + numPartialOperandsB <= numPartialOperandsR);
582 int numPartialOperandsA = aSize >> PARTIAL_OPERAND_WIDTH_LOG2;
583 int numPartialOperandsB = bSize >> PARTIAL_OPERAND_WIDTH_LOG2;
584 EFM_ASSERT((aSize & PARTIAL_OPERAND_WIDTH_MASK) == 0);
585 EFM_ASSERT((bSize & PARTIAL_OPERAND_WIDTH_MASK) == 0);
587 EFM_ASSERT(aSize + bSize <= rSize);
603 CRYPTO_EXECUTE_4(crypto,
617 CRYPTO_SEQ_LOAD_10(crypto,
648 for(i=0; i<numPartialOperandsA; i++)
651 #ifdef USE_VARIABLE_SIZED_DATA_LOADS
652 if ( (numWordsLastOperandA != 0) && ( i == numPartialOperandsA-1 ) )
653 CRYPTO_DataWriteVariableSize(&crypto->
DATA2,
654 &A[i*PARTIAL_OPERAND_WIDTH_IN_32BIT_WORDS],
655 numWordsLastOperandA);
663 #ifdef USE_VARIABLE_SIZED_DATA_LOADS
664 if ( (numWordsLastOperandR != 0) && ( i == numPartialOperandsR-1 ) )
665 CRYPTO_DataWriteVariableSize(&crypto->
DATA1,
666 &R[i*PARTIAL_OPERAND_WIDTH_IN_32BIT_WORDS],
667 numWordsLastOperandR);
679 | (PARTIAL_OPERAND_WIDTH_IN_BYTES * numPartialOperandsB);
684 for (j=0; j<numPartialOperandsB; j++)
688 #ifdef USE_VARIABLE_SIZED_DATA_LOADS
689 if ( (numWordsLastOperandB != 0) && ( j == numPartialOperandsB-1 ) )
690 CRYPTO_DataWriteVariableSize(&crypto->
DATA0,
691 &B[j*PARTIAL_OPERAND_WIDTH_IN_32BIT_WORDS],
692 numWordsLastOperandB);
695 &B[j*PARTIAL_OPERAND_WIDTH_IN_32BIT_WORDS]);
698 &B[j*PARTIAL_OPERAND_WIDTH_IN_32BIT_WORDS]);
703 #ifdef USE_VARIABLE_SIZED_DATA_LOADS
704 if ( (numWordsLastOperandR != 0) && ( (i+j+1) == numPartialOperandsR-1 ) )
705 CRYPTO_DataWriteVariableSize(&crypto->
DATA1,
706 &R[(i+j+1)*PARTIAL_OPERAND_WIDTH_IN_32BIT_WORDS],
707 numWordsLastOperandR);
710 &R[(i+j+1)*PARTIAL_OPERAND_WIDTH_IN_32BIT_WORDS]);
713 &R[(i+j+1)*PARTIAL_OPERAND_WIDTH_IN_32BIT_WORDS]);
717 &R[(i+j)*PARTIAL_OPERAND_WIDTH_IN_32BIT_WORDS]);
724 *PARTIAL_OPERAND_WIDTH_IN_32BIT_WORDS],
725 (numPartialOperandsA-i-1)
726 *PARTIAL_OPERAND_WIDTH_IN_32BIT_WORDS);
729 &R[(i+numPartialOperandsB)
730 * PARTIAL_OPERAND_WIDTH_IN_32BIT_WORDS]);
1042 const uint8_t * key,
1088 const uint8_t * key,
1112 uint32_t * _ctr = (uint32_t *) ctr;
1114 _ctr[3] = __REV(__REV(_ctr[3]) + 1);
1139 uint32_t * _out = (uint32_t *) out;
1140 const uint32_t * _in = (
const uint32_t *) in;
1177 uint32_t * _out = (uint32_t *) out;
1178 const uint32_t * _in = (
const uint32_t *) in;
1254 const uint8_t * key,
1296 const uint8_t * key,
1367 const uint8_t * key,
1406 const uint8_t * key,
1457 const uint8_t * key,
1462 EFM_ASSERT(!(len % CRYPTO_AES_BLOCKSIZE));
1478 &crypto->
DATA1, (uint32_t *) in,
1479 &crypto->
DATA0, (uint32_t *) out);
1498 &crypto->
DATA1, (uint32_t *) in,
1499 &crypto->
DATA0, (uint32_t *) out);
1541 const uint8_t * key,
1546 EFM_ASSERT(!(len % CRYPTO_AES_BLOCKSIZE));
1565 &crypto->
DATA1, (uint32_t *)in,
1566 &crypto->
DATA0, (uint32_t *)out
1582 &crypto->
DATA1, (uint32_t *)in,
1583 &crypto->
DATA0, (uint32_t *)out
1629 const uint8_t * key,
1636 EFM_ASSERT(!(len % CRYPTO_AES_BLOCKSIZE));
1654 &crypto->
DATA2, (uint32_t *) in,
1655 &crypto->
DATA0, (uint32_t *) out);
1697 const uint8_t * key,
1701 EFM_ASSERT(!(len % CRYPTO_AES_BLOCKSIZE));
1721 &crypto->
DATA0, (uint32_t *) in,
1722 &crypto->
DATA1, (uint32_t *) out);
1760 const uint8_t * key,
1764 EFM_ASSERT(!(len % CRYPTO_AES_BLOCKSIZE));
1782 &crypto->
DATA0, (uint32_t *) in,
1783 &crypto->
DATA1, (uint32_t *) out);
1821 len /= CRYPTO_AES_BLOCKSIZE;
void CRYPTO_AES_OFB128(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, const uint8_t *iv)
AES Output feedback (OFB) cipher mode encryption/decryption, 128 bit key.
#define CRYPTO_CMD_INSTR_AESDEC
#define CRYPTO_CMD_INSTR_DDATA0TODDATA2
__STATIC_INLINE void CRYPTO_InstructionSequenceExecute(CRYPTO_TypeDef *crypto)
Execute the current programmed instruction sequence.
#define CRYPTO_CMD_INSTR_CCLR
#define CRYPTO_CMD_INSTR_DDATA2TODDATA1
#define CRYPTO_CMD_INSTR_DATATODMA0
#define CRYPTO_CMD_INSTR_SELDDATA1DDATA3
#define CRYPTO_CMD_INSTR_DATA2TODATA0
Emlib peripheral API "assert" implementation.
#define CRYPTO_CMD_INSTR_DATA0TODATA3
void CRYPTO_ModulusSet(CRYPTO_TypeDef *crypto, CRYPTO_ModulusId_TypeDef modType)
Set the modulus type used for wide arithmetic operations.
#define _CRYPTO_SEQ1_INSTR4_SHIFT
#define CRYPTO_CMD_INSTR_AESENC
__STATIC_INLINE void CRYPTO_DataRead(CRYPTO_DataReg_TypeDef dataReg, CRYPTO_Data_TypeDef val)
Read 128 bits of data from a DATAX register in the CRYPTO module.
void CRYPTO_AES_CTRUpdate32Bit(uint8_t *ctr)
Update last 32 bits of 128 bit counter, by incrementing with 1.
#define CRYPTO_CMD_INSTR_DDATA1TODDATA0
static void CRYPTO_AES_ECBx(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, bool encrypt, CRYPTO_KeyWidth_TypeDef keyWidth)
Electronic Codebook (ECB) cipher mode encryption/decryption, 128/256 bit key.
__STATIC_INLINE void cryptoBigintIncrement(uint32_t *words32bits, int num32bitWords)
Increment value of 32bit word array by one.
void CRYPTO_AES_OFB256(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, const uint8_t *iv)
AES Output feedback (OFB) cipher mode encryption/decryption, 256 bit key.
__STATIC_INLINE bool CRYPTO_CarryIsSet(CRYPTO_TypeDef *crypto)
Quick read access of the Carry bit from arithmetic operations.
#define _CRYPTO_WAC_MODOP_MASK
void CRYPTO_AES_CTR256(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, uint8_t *ctr, CRYPTO_AES_CtrFuncPtr_TypeDef ctrFunc)
AES Counter (CTR) cipher mode encryption/decryption, 256 bit key.
uint32_t CRYPTO_Data_TypeDef[CRYPTO_DATA_SIZE_IN_32BIT_WORDS]
CMSIS Cortex-M Peripheral Access Layer for Silicon Laboratories microcontroller devices.
void CRYPTO_AES_CBC128(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, const uint8_t *iv, bool encrypt)
AES Cipher-block chaining (CBC) cipher mode encryption/decryption, 128 bit key.
void CRYPTO_AES_CTR128(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, uint8_t *ctr, CRYPTO_AES_CtrFuncPtr_TypeDef ctrFunc)
AES Counter (CTR) cipher mode encryption/decryption, 128 bit key.
#define CRYPTO_CTRL_DMA0MODE_FULL
volatile uint32_t * CRYPTO_DataReg_TypeDef
__STATIC_INLINE void CRYPTO_ResultWidthSet(CRYPTO_TypeDef *crypto, CRYPTO_ResultWidth_TypeDef resultWidth)
Set the width of the results of the non-modulus instructions.
__STATIC_INLINE void CRYPTO_QDataWrite(CRYPTO_QDataReg_TypeDef qdataReg, CRYPTO_QData_TypeDef val)
Write 512 bits of data to a QDATAX register in the CRYPTO module.
#define CRYPTO_WAC_RESULTWIDTH_256BIT
#define _CRYPTO_SEQ0_INSTR1_SHIFT
#define CRYPTO_CMD_INSTR_DATA2TODATA0XOR
static void CRYPTO_AES_CBCx(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, const uint8_t *iv, bool encrypt, CRYPTO_KeyWidth_TypeDef keyWidth)
Cipher-block chaining (CBC) cipher mode encryption/decryption, 128/256 bit key.
void CRYPTO_AES_DecryptKey128(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in)
Generate 128 bit AES decryption key from 128 bit encryption key. The decryption key is used for some ...
#define CRYPTO_WAC_MODOP_BINARY
void CRYPTO_SHA_256(CRYPTO_TypeDef *crypto, const uint8_t *msg, uint64_t msgLen, CRYPTO_SHA256_Digest_TypeDef digest)
Perform a SHA-256 hash operation on a message.
#define CRYPTO_CMD_INSTR_ADDIC
void CRYPTO_AES_ECB256(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, bool encrypt)
AES Electronic Codebook (ECB) cipher mode encryption/decryption, 256 bit key.
#define CRYPTO_CMD_INSTR_DMA0TODATA
#define _CRYPTO_WAC_MODULUS_MASK
#define _CRYPTO_SEQ0_INSTR0_SHIFT
__STATIC_INLINE void CRYPTO_KeyBufWrite(CRYPTO_TypeDef *crypto, CRYPTO_KeyBuf_TypeDef val, CRYPTO_KeyWidth_TypeDef keyWidth)
Set the key value to be used by the CRYPTO module.
#define CRYPTO_CMD_INSTR_MADD32
__STATIC_INLINE void CRYPTO_BurstFromCrypto(volatile uint32_t *reg, uint32_t *val)
Read a 128 bit value from a crypto register.
__STATIC_INLINE void CRYPTO_DDataRead(CRYPTO_DDataReg_TypeDef ddataReg, CRYPTO_DData_TypeDef val)
Read 256 bits of data from a DDATAX register in the CRYPTO module.
#define CRYPTO_CMD_INSTR_DATA1TODATA0XOR
#define _CRYPTO_SEQ0_INSTR2_SHIFT
#define CRYPTO_CMD_INSTR_SELDDATA0DDATA2
#define CRYPTO_CTRL_AES_AES256
#define CRYPTO_CMD_SEQSTART
void CRYPTO_AES_ECB128(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, bool encrypt)
AES Electronic Codebook (ECB) cipher mode encryption/decryption, 128 bit key.
__STATIC_INLINE void CRYPTO_DataWrite(CRYPTO_DataReg_TypeDef dataReg, const CRYPTO_Data_TypeDef val)
Write 128 bits of data to a DATAX register in the CRYPTO module.
#define CRYPTO_CTRL_AES_AES128
#define CRYPTO_CMD_INSTR_DATA1INC
void CRYPTO_KeyRead(CRYPTO_TypeDef *crypto, CRYPTO_KeyBuf_TypeDef val, CRYPTO_KeyWidth_TypeDef keyWidth)
Read the key value currently used by the CRYPTO module.
uint8_t CRYPTO_SHA1_Digest_TypeDef[CRYPTO_SHA1_DIGEST_SIZE_IN_BYTES]
void CRYPTO_Mul(CRYPTO_TypeDef *crypto, uint32_t *A, int aSize, uint32_t *B, int bSize, uint32_t *R, int rSize)
Multiply two big integers.
#define CRYPTO_CMD_INSTR_SELDDATA2DDATA3
#define CRYPTO_CTRL_DMA1MODE_FULL
void CRYPTO_AES_CFB128(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, const uint8_t *iv, bool encrypt)
AES Cipher feedback (CFB) cipher mode encryption/decryption, 128 bit key.
#define CRYPTO_SEQCTRL_BLOCKSIZE_16BYTES
static void CRYPTO_AES_CTRx(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, uint8_t *ctr, CRYPTO_AES_CtrFuncPtr_TypeDef ctrFunc, CRYPTO_KeyWidth_TypeDef keyWidth)
Counter (CTR) cipher mode encryption/decryption, 128/256 bit key.
#define CRYPTO_CTRL_DMA1RSEL_DATA1
#define CRYPTO_CTRL_SHA_SHA1
Cryptography accelerator peripheral API.
void(* CRYPTO_AES_CtrFuncPtr_TypeDef)(uint8_t *ctr)
AES counter modification function pointer.
__STATIC_INLINE void CRYPTO_BurstToCrypto(volatile uint32_t *reg, const uint32_t *val)
Write a 128 bit value into a crypto register.
#define CRYPTO_CMD_INSTR_SHA
uint32_t CRYPTO_KeyBuf_TypeDef[CRYPTO_KEYBUF_SIZE_IN_32BIT_WORDS]
#define CRYPTO_CMD_INSTR_DMA1TODATA
#define CRYPTO_WAC_MULWIDTH_MUL128
#define CRYPTO_CMD_INSTR_SELDDATA0DDATA1
__STATIC_INLINE void CRYPTO_DDataWrite(CRYPTO_DDataReg_TypeDef ddataReg, const CRYPTO_DData_TypeDef val)
Write 256 bits of data to a DDATAX register in the CRYPTO module.
#define CRYPTO_CMD_INSTR_DATA1TODATA0
#define CRYPTO_CMD_INSTR_DATA1TODATA2
void CRYPTO_AES_CFB256(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, const uint8_t *iv, bool encrypt)
AES Cipher feedback (CFB) cipher mode encryption/decryption, 256 bit key.
#define CRYPTO_CMD_INSTR_MULO
#define _CRYPTO_SEQCTRL_LENGTHA_SHIFT
#define _CRYPTO_SEQ0_INSTR3_SHIFT
void CRYPTO_AES_DecryptKey256(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in)
Generate 256 bit AES decryption key from 256 bit encryption key. The decryption key is used for some ...
#define CRYPTO_CMD_INSTR_DDATA0TODDATA1
static void CRYPTO_AES_CFBx(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, const uint8_t *iv, bool encrypt, CRYPTO_KeyWidth_TypeDef keyWidth)
Cipher feedback (CFB) cipher mode encryption/decryption, 128/256 bit key.
uint8_t CRYPTO_SHA256_Digest_TypeDef[CRYPTO_SHA256_DIGEST_SIZE_IN_BYTES]
void CRYPTO_AES_CBC256(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, const uint8_t *iv, bool encrypt)
AES Cipher-block chaining (CBC) cipher mode encryption/decryption, 256 bit key.
__STATIC_INLINE void cryptoBigintZeroize(uint32_t *words32bits, int num32bitWords)
Set 32bit word array to zero.
#define _CRYPTO_SEQ1_INSTR5_SHIFT
void CRYPTO_SHA_1(CRYPTO_TypeDef *crypto, const uint8_t *msg, uint64_t msgLen, CRYPTO_SHA1_Digest_TypeDef digest)
Perform a SHA-1 hash operation on a message.
#define CRYPTO_CTRL_SHA_SHA2
#define CRYPTO_CTRL_DMA0RSEL_DATA0
static void CRYPTO_AES_ProcessLoop(CRYPTO_TypeDef *crypto, uint32_t len, CRYPTO_DataReg_TypeDef inReg, uint32_t *in, CRYPTO_DataReg_TypeDef outReg, uint32_t *out)
Function performs generic AES loop.
#define CRYPTO_CTRL_INCWIDTH_INCWIDTH4
#define CRYPTO_CMD_INSTR_DATA0TODATA2
#define CRYPTO_CMD_INSTR_CLR
#define CRYPTO_CMD_INSTR_DATA0TODATA1
static void CRYPTO_AES_OFBx(CRYPTO_TypeDef *crypto, uint8_t *out, const uint8_t *in, unsigned int len, const uint8_t *key, const uint8_t *iv, CRYPTO_KeyWidth_TypeDef keyWidth)
Output feedback (OFB) cipher mode encryption/decryption, 128/256 bit key.
#define CRYPTO_WAC_MODOP_REGULAR