libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
CRYPTO

libopencm3 STM32F4xx CRYPTO More...

Collaboration diagram for CRYPTO:

Macros

#define CRYP_CR_ALGOMODE_MASK   ((1 << 19) | CRYP_CR_ALGOMODE)
 

Functions

void crypto_wait_busy (void)
 Wait, if the Controller is busy. More...
 
void crypto_set_key (enum crypto_keysize keysize, uint64_t key[])
 Set key value to the controller. More...
 
void crypto_set_iv (uint64_t iv[])
 Set Initialization Vector. More...
 
void crypto_set_datatype (enum crypto_datatype datatype)
 Set the order of the data to be crypted. More...
 
void crypto_set_algorithm (enum crypto_mode mode)
 Set the algorithm for Encryption/decryption. More...
 
void crypto_start (void)
 Enable the cryptographic controller and start processing. More...
 
void crypto_stop (void)
 Disable the cryptographic controller and stop processing. More...
 
uint32_t crypto_process_block (uint32_t *inp, uint32_t *outp, uint32_t length)
 Start of encryption or decryption on data buffers. More...
 
void crypto_set_mac_algorithm (enum crypto_mode_mac mode)
 Set the MAC algorithm. More...
 
void crypto_context_swap (uint32_t *buf)
 Swap context. More...
 

Detailed Description

libopencm3 STM32F4xx CRYPTO

libopencm3 STM32 Cryptographic controller

Version
1.0.0
Date
18 Jun 2013
Version
1.0.0
Date
17 Jun 2013

This library supports the cryptographic coprocessor system for the STM32 series of ARM Cortex Microcontrollers

LGPL License Terms libopencm3 License

Macro Definition Documentation

◆ CRYP_CR_ALGOMODE_MASK

#define CRYP_CR_ALGOMODE_MASK   ((1 << 19) | CRYP_CR_ALGOMODE)

Definition at line 37 of file crypto_common_f24.c.

Function Documentation

◆ crypto_context_swap()

void crypto_context_swap ( uint32_t *  buf)

Swap context.

Parameters
[in]bufuint32_t Memory space for swap (16 items length)

Definition at line 49 of file crypto.c.

References CRYP_CSGCMCCMR, and CRYP_CSGCMR.

◆ crypto_process_block()

uint32_t crypto_process_block ( uint32_t *  inp,
uint32_t *  outp,
uint32_t  length 
)

Start of encryption or decryption on data buffers.

This blocking method transfers input buffer of specified length to the cryptographic coprocessor, and instructs him to begin of ciphering or deciphering. It waits for data to be ready, and then fills the processed data to output buffer.

Parameters
[in]inpuint32_t* Input array to crypt/decrypt.
[in]outpuint32_t* Output array with crypted/encrypted data.
[in]lengthuint32_t Length of the arrays
Returns
uint32_t Number of written words

Definition at line 152 of file crypto_common_f24.c.

References CRYP_DIN, CRYP_DOUT, CRYP_SR, CRYP_SR_IFNF, CRYP_SR_OFNE, and crypto_wait_busy().

Here is the call graph for this function:

◆ crypto_set_algorithm()

void crypto_set_algorithm ( enum crypto_mode  mode)

Set the algorithm for Encryption/decryption.

Parameters
[in]modeenum crypto_mode Mode of execution

Definition at line 100 of file crypto_common_f24.c.

References CRYP_CR, CRYP_CR_ALGOMODE_AES_PREP, CRYP_CR_ALGOMODE_MASK, CRYP_CR_FFLUSH, crypto_start(), crypto_wait_busy(), DECRYPT_AES_CBC, and DECRYPT_AES_ECB.

Referenced by crypto_set_mac_algorithm().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ crypto_set_datatype()

void crypto_set_datatype ( enum crypto_datatype  datatype)

Set the order of the data to be crypted.

Parameters
[in]datatypeenum crypto_datatype Specified datatype of the key.

Definition at line 89 of file crypto_common_f24.c.

References CRYP_CR, CRYP_CR_DATATYPE, and CRYP_CR_DATATYPE_SHIFT.

◆ crypto_set_iv()

void crypto_set_iv ( uint64_t  iv[])

Set Initialization Vector.

Parameters
[in]ivuint64_t[] Initialization vector (array of 4 items)
Note
Cryptographic controller must be in disabled state

Definition at line 73 of file crypto_common_f24.c.

References CRYP_IVR, and crypto_wait_busy().

Here is the call graph for this function:

◆ crypto_set_key()

void crypto_set_key ( enum crypto_keysize  keysize,
uint64_t  key[] 
)

Set key value to the controller.

Parameters
[in]keysizeenum crypto_keysize Specified size of the key.
[in]keyuint64_t[] Key value (array of 4 items)

Definition at line 52 of file crypto_common_f24.c.

References CRYP_CR, CRYP_CR_KEYSIZE, CRYP_CR_KEYSIZE_SHIFT, CRYP_KR, and crypto_wait_busy().

Here is the call graph for this function:

◆ crypto_set_mac_algorithm()

void crypto_set_mac_algorithm ( enum crypto_mode_mac  mode)

Set the MAC algorithm.

Definition at line 39 of file crypto.c.

References crypto_set_algorithm().

Here is the call graph for this function:

◆ crypto_start()

void crypto_start ( void  )

Enable the cryptographic controller and start processing.

Definition at line 124 of file crypto_common_f24.c.

References CRYP_CR, and CRYP_CR_CRYPEN.

Referenced by crypto_set_algorithm().

Here is the caller graph for this function:

◆ crypto_stop()

void crypto_stop ( void  )

Disable the cryptographic controller and stop processing.

Definition at line 133 of file crypto_common_f24.c.

References CRYP_CR, and CRYP_CR_CRYPEN.

◆ crypto_wait_busy()

void crypto_wait_busy ( void  )

Wait, if the Controller is busy.

Definition at line 42 of file crypto_common_f24.c.

References CRYP_SR, and CRYP_SR_BUSY.

Referenced by crypto_process_block(), crypto_set_algorithm(), crypto_set_iv(), and crypto_set_key().

Here is the caller graph for this function: