EFR32 Blue Gecko 13 Software Documentation
efr32bg13-doc-5.1.2
|
Cryptography accelerator peripheral API.
Copyright 2016 Silicon Laboratories, Inc. http://www.silabs.com
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no obligation to support this Software. Silicon Labs is providing the Software "AS IS", with no express or implied warranties of any kind, including, but not limited to, any implied warranties of merchantability or fitness for any particular purpose or warranties against infringement of any proprietary rights of a third party.
Silicon Labs will not be liable for any consequential, incidental, or special damages, or any other relief, or for any claim by any third party, arising from your use of this Software.
Definition in file em_crypto.h.
Go to the source code of this file.
Macros | |
#define | CRYPTO_INSTRUCTIONSEQUENSE_DEFAULT |
#define | CRYPTO_MAX_SEQUENCE_INSTRUCTIONS (20) |
Typedefs | |
typedef void(* | CRYPTO_AES_CtrFuncPtr_TypeDef) (uint8_t *ctr) |
AES counter modification function pointer. More... | |
typedef uint32_t | CRYPTO_Data260_TypeDef[CRYPTO_DATA260_SIZE_IN_32BIT_WORDS] |
typedef uint32_t | CRYPTO_Data_TypeDef[CRYPTO_DATA_SIZE_IN_32BIT_WORDS] |
typedef volatile uint32_t * | CRYPTO_DataReg_TypeDef |
typedef uint32_t | CRYPTO_DData_TypeDef[CRYPTO_DDATA_SIZE_IN_32BIT_WORDS] |
typedef volatile uint32_t * | CRYPTO_DDataReg_TypeDef |
typedef uint8_t | CRYPTO_InstructionSequence_TypeDef[CRYPTO_MAX_SEQUENCE_INSTRUCTIONS] |
typedef uint32_t | CRYPTO_KeyBuf_TypeDef[CRYPTO_KEYBUF_SIZE_IN_32BIT_WORDS] |
typedef uint32_t | CRYPTO_QData_TypeDef[CRYPTO_QDATA_SIZE_IN_32BIT_WORDS] |
typedef volatile uint32_t * | CRYPTO_QDataReg_TypeDef |
typedef uint8_t | CRYPTO_SHA1_Digest_TypeDef[CRYPTO_SHA1_DIGEST_SIZE_IN_BYTES] |
typedef uint8_t | CRYPTO_SHA256_Digest_TypeDef[CRYPTO_SHA256_DIGEST_SIZE_IN_BYTES] |
Enumerations | |
enum | CRYPTO_IncWidth_TypeDef { cryptoInc1byte = CRYPTO_CTRL_INCWIDTH_INCWIDTH1, cryptoInc2byte = CRYPTO_CTRL_INCWIDTH_INCWIDTH2, cryptoInc3byte = CRYPTO_CTRL_INCWIDTH_INCWIDTH3, cryptoInc4byte = CRYPTO_CTRL_INCWIDTH_INCWIDTH4 } |
enum | CRYPTO_KeyWidth_TypeDef { cryptoKey128Bits = 8, cryptoKey256Bits = 16 } |
enum | CRYPTO_ModulusId_TypeDef { cryptoModulusBin256 = CRYPTO_WAC_MODULUS_BIN256, cryptoModulusBin128 = CRYPTO_WAC_MODULUS_BIN128, cryptoModulusGcmBin128 = CRYPTO_WAC_MODULUS_GCMBIN128, cryptoModulusEccB233 = CRYPTO_WAC_MODULUS_ECCBIN233P, cryptoModulusEccB163 = CRYPTO_WAC_MODULUS_ECCBIN163P, cryptoModulusEccP256 = CRYPTO_WAC_MODULUS_ECCPRIME256P, cryptoModulusEccP224 = CRYPTO_WAC_MODULUS_ECCPRIME224P, cryptoModulusEccP192 = CRYPTO_WAC_MODULUS_ECCPRIME192P, cryptoModulusEccB233Order = CRYPTO_WAC_MODULUS_ECCBIN233N, cryptoModulusEccB233KOrder = CRYPTO_WAC_MODULUS_ECCBIN233KN, cryptoModulusEccB163Order = CRYPTO_WAC_MODULUS_ECCBIN163N, cryptoModulusEccB163KOrder = CRYPTO_WAC_MODULUS_ECCBIN163KN, cryptoModulusEccP256Order = CRYPTO_WAC_MODULUS_ECCPRIME256N, cryptoModulusEccP224Order = CRYPTO_WAC_MODULUS_ECCPRIME224N, cryptoModulusEccP192Order = CRYPTO_WAC_MODULUS_ECCPRIME192N } |
enum | CRYPTO_MulOperandWidth_TypeDef { cryptoMulOperand256Bits = CRYPTO_WAC_MULWIDTH_MUL256, cryptoMulOperand128Bits = CRYPTO_WAC_MULWIDTH_MUL128, cryptoMulOperandModulusBits = CRYPTO_WAC_MULWIDTH_MULMOD } |
enum | CRYPTO_ResultWidth_TypeDef { cryptoResult128Bits = CRYPTO_WAC_RESULTWIDTH_128BIT, cryptoResult256Bits = CRYPTO_WAC_RESULTWIDTH_256BIT, cryptoResult260Bits = CRYPTO_WAC_RESULTWIDTH_260BIT } |
Functions | |
__STATIC_INLINE void | AES_CBC128 (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. More... | |
__STATIC_INLINE void | AES_CBC256 (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. More... | |
__STATIC_INLINE void | AES_CFB128 (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. More... | |
__STATIC_INLINE void | AES_CFB256 (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. More... | |
__STATIC_INLINE void | AES_CTR128 (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. More... | |
__STATIC_INLINE void | AES_CTR256 (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. More... | |
__STATIC_INLINE void | AES_CTRUpdate32Bit (uint8_t *ctr) |
Update last 32 bits of 128 bit counter, by incrementing with 1. More... | |
__STATIC_INLINE void | AES_DecryptKey128 (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 cipher modes when decrypting. More... | |
__STATIC_INLINE void | AES_DecryptKey256 (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 cipher modes when decrypting. More... | |
__STATIC_INLINE void | AES_ECB128 (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. More... | |
__STATIC_INLINE void | AES_ECB256 (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. More... | |
__STATIC_INLINE void | AES_OFB128 (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. More... | |
__STATIC_INLINE void | AES_OFB256 (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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
void | CRYPTO_AES_CTRUpdate32Bit (uint8_t *ctr) |
Update last 32 bits of 128 bit counter, by incrementing with 1. More... | |
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 cipher modes when decrypting. More... | |
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 cipher modes when decrypting. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
__STATIC_INLINE void | CRYPTO_BurstFromCrypto (volatile uint32_t *reg, uint32_t *val) |
Read a 128 bit value from a crypto register. More... | |
__STATIC_INLINE void | CRYPTO_BurstToCrypto (volatile uint32_t *reg, const uint32_t *val) |
Write a 128 bit value into a crypto register. More... | |
__STATIC_INLINE bool | CRYPTO_CarryIsSet (CRYPTO_TypeDef *crypto) |
Quick read access of the Carry bit from arithmetic operations. More... | |
__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. More... | |
__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. More... | |
__STATIC_INLINE uint8_t | CRYPTO_DData0_4LSBitsRead (CRYPTO_TypeDef *crypto) |
Quick read access of the 4 LSbits of the DDATA0 register. More... | |
__STATIC_INLINE void | CRYPTO_DData0Read260 (CRYPTO_TypeDef *crypto, CRYPTO_Data260_TypeDef val) |
Read 260 bits from the DDATA0 register. More... | |
__STATIC_INLINE void | CRYPTO_DData0Write260 (CRYPTO_TypeDef *crypto, const CRYPTO_Data260_TypeDef val) |
Write 260 bits to the DDATA0 register. More... | |
__STATIC_INLINE bool | CRYPTO_DData1_MSBitRead (CRYPTO_TypeDef *crypto) |
Quick read the MSbit of the DDATA1 register. More... | |
__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. More... | |
__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. More... | |
__STATIC_INLINE void | CRYPTO_IncWidthSet (CRYPTO_TypeDef *crypto, CRYPTO_IncWidth_TypeDef incWidth) |
Set the width of the DATA1 increment instruction DATA1INC. More... | |
__STATIC_INLINE bool | CRYPTO_InstructionSequenceDone (CRYPTO_TypeDef *crypto) |
Check whether the execution of an instruction sequence has completed. More... | |
__STATIC_INLINE void | CRYPTO_InstructionSequenceExecute (CRYPTO_TypeDef *crypto) |
Execute the current programmed instruction sequence. More... | |
__STATIC_INLINE void | CRYPTO_InstructionSequenceLoad (CRYPTO_TypeDef *crypto, const CRYPTO_InstructionSequence_TypeDef instructionSequence) |
Load a sequence of instructions to be executed on the current values in the data registers. More... | |
__STATIC_INLINE void | CRYPTO_InstructionSequenceWait (CRYPTO_TypeDef *crypto) |
Wait for completion of the current sequence of instructions. More... | |
__STATIC_INLINE void | CRYPTO_InstructionWait (CRYPTO_TypeDef *crypto) |
Wait for completion of the current command. More... | |
__STATIC_INLINE void | CRYPTO_IntClear (CRYPTO_TypeDef *crypto, uint32_t flags) |
Clear one or more pending CRYPTO interrupts. More... | |
__STATIC_INLINE void | CRYPTO_IntDisable (CRYPTO_TypeDef *crypto, uint32_t flags) |
Disable one or more CRYPTO interrupts. More... | |
__STATIC_INLINE void | CRYPTO_IntEnable (CRYPTO_TypeDef *crypto, uint32_t flags) |
Enable one or more CRYPTO interrupts. More... | |
__STATIC_INLINE uint32_t | CRYPTO_IntGet (CRYPTO_TypeDef *crypto) |
Get pending CRYPTO interrupt flags. More... | |
__STATIC_INLINE uint32_t | CRYPTO_IntGetEnabled (CRYPTO_TypeDef *crypto) |
Get enabled and pending CRYPTO interrupt flags. Useful for handling more interrupt sources in the same interrupt handler. More... | |
__STATIC_INLINE void | CRYPTO_IntSet (CRYPTO_TypeDef *crypto, uint32_t flags) |
Set one or more pending CRYPTO interrupts from SW. More... | |
__STATIC_INLINE void | CRYPTO_KeyBuf128Write (CRYPTO_TypeDef *crypto, const uint32_t *val) |
Quick write 128 bit key to the CRYPTO module. More... | |
__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. More... | |
void | CRYPTO_KeyRead (CRYPTO_TypeDef *crypto, CRYPTO_KeyBuf_TypeDef val, CRYPTO_KeyWidth_TypeDef keyWidth) |
Read the key value currently used by the CRYPTO module. More... | |
void | CRYPTO_ModulusSet (CRYPTO_TypeDef *crypto, CRYPTO_ModulusId_TypeDef modType) |
Set the modulus type used for wide arithmetic operations. More... | |
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. More... | |
__STATIC_INLINE void | CRYPTO_MulOperandWidthSet (CRYPTO_TypeDef *crypto, CRYPTO_MulOperandWidth_TypeDef mulOperandWidth) |
Set the number of bits in the operands of the MUL instruction. More... | |
__STATIC_INLINE void | CRYPTO_QDataRead (CRYPTO_QDataReg_TypeDef qdataReg, CRYPTO_QData_TypeDef val) |
Read 512 bits of data from a QDATAX register in the CRYPTO module. More... | |
__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. More... | |
__STATIC_INLINE void | CRYPTO_ResultWidthSet (CRYPTO_TypeDef *crypto, CRYPTO_ResultWidth_TypeDef resultWidth) |
Set the width of the results of the non-modulus instructions. More... | |
void | CRYPTO_SHA_1 (CRYPTO_TypeDef *crypto, const uint8_t *msg, uint64_t msgLen, CRYPTO_SHA1_Digest_TypeDef msgDigest) |
Perform a SHA-1 hash operation on a message. More... | |
void | CRYPTO_SHA_256 (CRYPTO_TypeDef *crypto, const uint8_t *msg, uint64_t msgLen, CRYPTO_SHA256_Digest_TypeDef msgDigest) |
Perform a SHA-256 hash operation on a message. More... | |