libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
API for the CRYP controller. More...
Enumerations | |
enum | crypto_mode { ENCRYPT_TDES_ECB = CRYP_CR_ALGOMODE_TDES_ECB , ENCRYPT_TDES_CBC = CRYP_CR_ALGOMODE_TDES_CBC , ENCRYPT_DES_ECB = CRYP_CR_ALGOMODE_DES_ECB , ENCRYPT_DES_CBC = CRYP_CR_ALGOMODE_DES_CBC , ENCRYPT_AES_ECB = CRYP_CR_ALGOMODE_AES_ECB , ENCRYPT_AES_CBC = CRYP_CR_ALGOMODE_AES_CBC , ENCRYPT_AES_CTR = CRYP_CR_ALGOMODE_AES_CTR , DECRYPT_TDES_ECB = CRYP_CR_ALGOMODE_TDES_ECB | CRYP_CR_ALGODIR , DECRYPT_TDES_CBC = CRYP_CR_ALGOMODE_TDES_CBC | CRYP_CR_ALGODIR , DECRYPT_DES_ECB = CRYP_CR_ALGOMODE_DES_ECB | CRYP_CR_ALGODIR , DECRYPT_DES_CBC = CRYP_CR_ALGOMODE_DES_CBC | CRYP_CR_ALGODIR , DECRYPT_AES_ECB = CRYP_CR_ALGOMODE_AES_ECB | CRYP_CR_ALGODIR , DECRYPT_AES_CBC = CRYP_CR_ALGOMODE_AES_CBC | CRYP_CR_ALGODIR , DECRYPT_AES_CTR = CRYP_CR_ALGOMODE_AES_CTR } |
enum | crypto_keysize { CRYPTO_KEY_128BIT = 0 , CRYPTO_KEY_192BIT , CRYPTO_KEY_256BIT } |
enum | crypto_datatype { CRYPTO_DATA_32BIT = 0 , CRYPTO_DATA_16BIT , CRYPTO_DATA_8BIT , CRYPTO_DATA_BIT } |
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... | |
API for the CRYP controller.
enum crypto_datatype |
Enumerator | |
---|---|
CRYPTO_DATA_32BIT | |
CRYPTO_DATA_16BIT | |
CRYPTO_DATA_8BIT | |
CRYPTO_DATA_BIT |
Definition at line 264 of file crypto_common_f24.h.
enum crypto_keysize |
Enumerator | |
---|---|
CRYPTO_KEY_128BIT | |
CRYPTO_KEY_192BIT | |
CRYPTO_KEY_256BIT |
Definition at line 259 of file crypto_common_f24.h.
enum crypto_mode |
Definition at line 243 of file crypto_common_f24.h.
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.
[in] | inp | uint32_t* Input array to crypt/decrypt. |
[in] | outp | uint32_t* Output array with crypted/encrypted data. |
[in] | length | uint32_t Length of the arrays |
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().
void crypto_set_algorithm | ( | enum crypto_mode | mode | ) |
Set the algorithm for Encryption/decryption.
[in] | mode | enum 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_FFLUSH, crypto_start(), crypto_wait_busy(), DECRYPT_AES_CBC, and DECRYPT_AES_ECB.
Referenced by crypto_set_mac_algorithm().
void crypto_set_datatype | ( | enum crypto_datatype | datatype | ) |
Set the order of the data to be crypted.
[in] | datatype | enum crypto_datatype Specified datatype of the key. |
Definition at line 89 of file crypto_common_f24.c.
References CRYP_CR, and CRYP_CR_DATATYPE_SHIFT.
void crypto_set_iv | ( | uint64_t | iv[] | ) |
Set Initialization Vector.
[in] | iv | uint64_t[] Initialization vector (array of 4 items) |
Definition at line 73 of file crypto_common_f24.c.
References CRYP_IVR, and crypto_wait_busy().
void crypto_set_key | ( | enum crypto_keysize | keysize, |
uint64_t | key[] | ||
) |
Set key value to the controller.
[in] | keysize | enum crypto_keysize Specified size of the key. |
[in] | key | uint64_t[] Key value (array of 4 items) |
Definition at line 52 of file crypto_common_f24.c.
References CRYP_CR, CRYP_CR_KEYSIZE_SHIFT, CRYP_KR, and crypto_wait_busy().
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().
void crypto_stop | ( | void | ) |
Disable the cryptographic controller and stop processing.
Definition at line 133 of file crypto_common_f24.c.
References CRYP_CR.
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().