[Style] Coding style fixes.

* No trailing white spaces
 * No sapces before tabs
 * "int *var" and not "int * var"
This commit is contained in:
Piotr Esden-Tempski
2013-06-30 22:09:25 -07:00
parent 035c67ced6
commit 647b878031
5 changed files with 78 additions and 77 deletions

View File

@@ -33,7 +33,7 @@
* crypto_set_algorithm(ENCRYPT_AES_ECB); * crypto_set_algorithm(ENCRYPT_AES_ECB);
* crypto_start(); * crypto_start();
* foreach(block in blocks) * foreach(block in blocks)
* crypto_process_block(plaintext,ciphertext,blocksize); * crypto_process_block(plaintext,ciphertext,blocksize);
* crypto_stop(); * crypto_stop();
* @endcode * @endcode
* *
@@ -47,12 +47,12 @@
* //[enable-clocks] * //[enable-clocks]
* crypto_set_key(CRYPTO_KEY_128BIT,key); * crypto_set_key(CRYPTO_KEY_128BIT,key);
* crypto_set_iv(iv); // only in CBC or CTR mode * crypto_set_iv(iv); // only in CBC or CTR mode
* crypto_set_datatype(CRYPTO_DATA_16BIT); * crypto_set_datatype(CRYPTO_DATA_16BIT);
* crypto_set_algorithm(ENCRYPT_AES_ECB); * crypto_set_algorithm(ENCRYPT_AES_ECB);
* crypto_start(); * crypto_start();
* [... API to be described later ...] * [... API to be described later ...]
* crypto_stop(); * crypto_stop();
* @endcode * @endcode
* *
* @section crypto_api_dma DMA handling API * @section crypto_api_dma DMA handling API
* *
@@ -67,7 +67,7 @@
* crypto_set_datatype(CRYPTO_DATA_16BIT); * crypto_set_datatype(CRYPTO_DATA_16BIT);
* crypto_set_algorithm(ENCRYPT_AES_ECB); * crypto_set_algorithm(ENCRYPT_AES_ECB);
* crypto_start(); * crypto_start();
* [... API to be described later ...] * [... API to be described later ...]
* crypto_stop(); * crypto_stop();
* @endcode * @endcode
*/ */
@@ -256,7 +256,7 @@ typedef enum {
DECRYPT_DES_CBC = CRYP_CR_ALGOMODE_DES_CBC | 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_ECB = CRYP_CR_ALGOMODE_AES_ECB | CRYP_CR_ALGODIR,
DECRYPT_AES_CBC = CRYP_CR_ALGOMODE_AES_CBC | CRYP_CR_ALGODIR, DECRYPT_AES_CBC = CRYP_CR_ALGOMODE_AES_CBC | CRYP_CR_ALGODIR,
DECRYPT_AES_CTR = CRYP_CR_ALGOMODE_AES_CTR, /* XOR is same ENC as DEC */ DECRYPT_AES_CTR = CRYP_CR_ALGOMODE_AES_CTR,/* XOR is same ENC as DEC */
} crypto_mode_t; } crypto_mode_t;
typedef enum { typedef enum {
CRYPTO_KEY_128BIT = 0, CRYPTO_KEY_128BIT = 0,
@@ -279,13 +279,14 @@ void crypto_set_datatype(crypto_datatype_t datatype);
void crypto_set_algorithm(crypto_mode_t mode); void crypto_set_algorithm(crypto_mode_t mode);
void crypto_start(void); void crypto_start(void);
void crypto_stop(void); void crypto_stop(void);
uint32_t crypto_process_block(uint32_t * inp, uint32_t * outp, uint32_t length); uint32_t crypto_process_block(uint32_t *inp, uint32_t *outp, uint32_t length);
END_DECLS END_DECLS
/**@}*/ /**@}*/
/**@}*/ /**@}*/
#endif #endif
/** @cond */ /** @cond */
#else #else
#warning "crypto_common_f24.h should not be included explicitly, only via crypto.h" #warning "crypto_common_f24.h should not be included explicitly, "
"only via crypto.h"
#endif #endif
/** @endcond */ /** @endcond */

View File

@@ -46,10 +46,10 @@
/**@{*/ /**@{*/
/* CRYP_CSGCMCCMxR: Crypto context registers CCM mode, i=0-7*/ /* CRYP_CSGCMCCMxR: Crypto context registers CCM mode, i=0-7*/
#define CRYP_CSGCMCCMR(i) MMIO32(CRYP_BASE + 0x50 + (i) * 4) #define CRYP_CSGCMCCMR(i) MMIO32(CRYP_BASE + 0x50 + (i) * 4)
/* CRYP_CSGCMxR: Crypto context registers all modes, i=0-7*/ /* CRYP_CSGCMxR: Crypto context registers all modes, i=0-7*/
#define CRYP_CSGCMR(i) MMIO32(CRYP_BASE + 0x70 + (i) * 4) #define CRYP_CSGCMR(i) MMIO32(CRYP_BASE + 0x70 + (i) * 4)
/* --- CRYP_CR values ------------------------------------------------------ */ /* --- CRYP_CR values ------------------------------------------------------ */
@@ -82,14 +82,14 @@ typedef enum {
ENCRYPT_GCM = CRYP_CR_ALGOMODE_TDES_ECB | CRYP_CR_ALGOMODE3, ENCRYPT_GCM = CRYP_CR_ALGOMODE_TDES_ECB | CRYP_CR_ALGOMODE3,
ENCRYPT_CCM = CRYP_CR_ALGOMODE_TDES_CBC | CRYP_CR_ALGOMODE3, ENCRYPT_CCM = CRYP_CR_ALGOMODE_TDES_CBC | CRYP_CR_ALGOMODE3,
DECRYPT_GCM = CRYP_CR_ALGOMODE_TDES_ECB | CRYP_CR_ALGOMODE3 | DECRYPT_GCM = CRYP_CR_ALGOMODE_TDES_ECB | CRYP_CR_ALGOMODE3 |
CRYP_CR_ALGODIR, CRYP_CR_ALGODIR,
DECRYPT_CCM = CRYP_CR_ALGOMODE_TDES_CBC | CRYP_CR_ALGOMODE3 | DECRYPT_CCM = CRYP_CR_ALGOMODE_TDES_CBC | CRYP_CR_ALGOMODE3 |
CRYP_CR_ALGODIR, CRYP_CR_ALGODIR,
} crypto_mode_mac_t; } crypto_mode_mac_t;
BEGIN_DECLS BEGIN_DECLS
void crypto_context_swap(uint32_t * buf); void crypto_context_swap(uint32_t *buf);
void crypto_set_mac_algorithm(crypto_mode_mac_t mode); void crypto_set_mac_algorithm(crypto_mode_mac_t mode);
END_DECLS END_DECLS

View File

@@ -41,7 +41,7 @@
*/ */
void crypto_wait_busy(void) void crypto_wait_busy(void)
{ {
while (CRYP_SR & CRYP_SR_BUSY) ; while (CRYP_SR & CRYP_SR_BUSY);
} }
/** /**
@@ -56,7 +56,7 @@ void crypto_set_key(crypto_keysize_t keysize, uint64_t key[])
crypto_wait_busy(); crypto_wait_busy();
CRYP_CR = (CRYP_CR & ~CRYP_CR_KEYSIZE) | CRYP_CR = (CRYP_CR & ~CRYP_CR_KEYSIZE) |
(keysize << CRYP_CR_KEYSIZE_SHIFT); (keysize << CRYP_CR_KEYSIZE_SHIFT);
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
CRYP_KR(i) = key[i]; CRYP_KR(i) = key[i];
@@ -89,7 +89,7 @@ void crypto_set_iv(uint64_t iv[])
void crypto_set_datatype(crypto_datatype_t datatype) void crypto_set_datatype(crypto_datatype_t datatype)
{ {
CRYP_CR = (CRYP_CR & ~CRYP_CR_DATATYPE) | CRYP_CR = (CRYP_CR & ~CRYP_CR_DATATYPE) |
(datatype << CRYP_CR_DATATYPE_SHIFT); (datatype << CRYP_CR_DATATYPE_SHIFT);
} }
/** /**
@@ -149,7 +149,7 @@ void crypto_stop(void)
* *
* @returns uint32_t Number of written words * @returns uint32_t Number of written words
*/ */
uint32_t crypto_process_block(uint32_t * inp, uint32_t * outp, uint32_t length) uint32_t crypto_process_block(uint32_t *inp, uint32_t *outp, uint32_t length)
{ {
uint32_t rd = 0, wr = 0; uint32_t rd = 0, wr = 0;

View File

@@ -46,7 +46,7 @@ void crypto_set_mac_algorithm(crypto_mode_mac_t mode)
* *
*@param[in] buf uint32_t Memory space for swap (16 items length) *@param[in] buf uint32_t Memory space for swap (16 items length)
*/ */
void crypto_context_swap(uint32_t * buf) void crypto_context_swap(uint32_t *buf)
{ {
int i; int i;
/* Apply exact order of ? */ /* Apply exact order of ? */