EFR32 Blue Gecko 13 Software Documentation  efr32bg13-doc-5.1.2
em_crypto.c File Reference

Detailed Description

Cryptography accelerator peripheral API.

Version
5.1.2

License

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:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

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.c.

#include "em_device.h"
#include "em_crypto.h"
#include "em_assert.h"

Go to the source code of this file.

Functions

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...
 
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. 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...
 
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. 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...
 
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. 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...
 
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. 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 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. More...
 
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. 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...
 
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...
 
__STATIC_INLINE void cryptoBigintIncrement (uint32_t *words32bits, int num32bitWords)
 Increment value of 32bit word array by one. More...
 
__STATIC_INLINE void cryptoBigintZeroize (uint32_t *words32bits, int num32bitWords)
 Set 32bit word array to zero. More...