Fix some whitespace and other style issues
In addition to whitespace:
- wrapped a few long lines
- added parenthesis to return statements
diff --git a/library/aria.c b/library/aria.c
index 1d1daa1..41ed759 100644
--- a/library/aria.c
+++ b/library/aria.c
@@ -56,9 +56,8 @@
/*
* 32-bit integer manipulation macros (little endian)
*/
-
#ifndef GET_UINT32_LE
-#define GET_UINT32_LE(n,b,i) \
+#define GET_UINT32_LE( n, b, i ) \
{ \
(n) = ( (uint32_t) (b)[(i) ] ) \
| ( (uint32_t) (b)[(i) + 1] << 8 ) \
@@ -68,7 +67,7 @@
#endif
#ifndef PUT_UINT32_LE
-#define PUT_UINT32_LE(n,b,i) \
+#define PUT_UINT32_LE( n, b, i ) \
{ \
(b)[(i) ] = (unsigned char) ( ( (n) ) & 0xFF ); \
(b)[(i) + 1] = (unsigned char) ( ( (n) >> 8 ) & 0xFF ); \
@@ -431,8 +430,8 @@
/*
* Set encryption key
*/
-int mbedtls_aria_setkey_enc(mbedtls_aria_context *ctx,
- const unsigned char *key, unsigned int keybits)
+int mbedtls_aria_setkey_enc( mbedtls_aria_context *ctx,
+ const unsigned char *key, unsigned int keybits )
{
/* round constant masks */
const uint32_t rc[3][4] =
@@ -446,7 +445,7 @@
uint32_t w[4][4], *w2;
if (keybits != 128 && keybits != 192 && keybits != 256)
- return MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH;
+ return( MBEDTLS_ERR_ARIA_INVALID_KEY_LENGTH );
/* Copy key to W0 (and potential remainder to W1) */
GET_UINT32_LE( w[0][0], key, 0 );
@@ -485,20 +484,20 @@
}
aria_rot128( ctx->rk[16], w[0], w[1], 19 );
- return 0;
+ return( 0 );
}
/*
* Set decryption key
*/
-int mbedtls_aria_setkey_dec(mbedtls_aria_context *ctx,
- const unsigned char *key, unsigned int keybits)
+int mbedtls_aria_setkey_dec( mbedtls_aria_context *ctx,
+ const unsigned char *key, unsigned int keybits )
{
int i, j, k, ret;
ret = mbedtls_aria_setkey_enc( ctx, key, keybits );
if( ret != 0 )
- return ret;
+ return( ret );
/* flip the order of round keys */
for( i = 0, j = ctx->nr; i < j; i++, j-- )
@@ -513,9 +512,12 @@
/* apply affine transform to middle keys */
for (i = 1; i < ctx->nr; i++ )
- aria_a( &ctx->rk[i][0], &ctx->rk[i][1], &ctx->rk[i][2], &ctx->rk[i][3] );
+ {
+ aria_a( &ctx->rk[i][0], &ctx->rk[i][1],
+ &ctx->rk[i][2], &ctx->rk[i][3] );
+ }
- return 0;
+ return( 0 );
}
/*
@@ -572,7 +574,7 @@
PUT_UINT32_LE( c, output, 8 );
PUT_UINT32_LE( d, output, 12 );
- return 0;
+ return( 0 );
}
/* Initialize context */
@@ -595,11 +597,11 @@
* ARIA-CBC buffer encryption/decryption
*/
int mbedtls_aria_crypt_cbc( mbedtls_aria_context *ctx,
- int mode,
- size_t length,
- unsigned char iv[16],
- const unsigned char *input,
- unsigned char *output )
+ int mode,
+ size_t length,
+ unsigned char iv[16],
+ const unsigned char *input,
+ unsigned char *output )
{
int i;
unsigned char temp[16];
@@ -649,12 +651,12 @@
* ARIA-CFB128 buffer encryption/decryption
*/
int mbedtls_aria_crypt_cfb128( mbedtls_aria_context *ctx,
- int mode,
- size_t length,
- size_t *iv_off,
- unsigned char iv[16],
- const unsigned char *input,
- unsigned char *output )
+ int mode,
+ size_t length,
+ size_t *iv_off,
+ unsigned char iv[16],
+ const unsigned char *input,
+ unsigned char *output )
{
int c;
size_t n = *iv_off;
@@ -697,12 +699,12 @@
* ARIA-CTR buffer encryption/decryption
*/
int mbedtls_aria_crypt_ctr( mbedtls_aria_context *ctx,
- size_t length,
- size_t *nc_off,
- unsigned char nonce_counter[16],
- unsigned char stream_block[16],
- const unsigned char *input,
- unsigned char *output )
+ size_t length,
+ size_t *nc_off,
+ unsigned char nonce_counter[16],
+ unsigned char stream_block[16],
+ const unsigned char *input,
+ unsigned char *output )
{
int c, i;
size_t n = *nc_off;