Commit 66d5d076 authored by Paul Bakker's avatar Paul Bakker

Fix formatting in various code to match spacing from coding style

parent db20c104
......@@ -420,10 +420,10 @@ static void aes_gen_tables( void )
{
x = pow[255 - log[i]];
y = x; y = ( (y << 1) | (y >> 7) ) & 0xFF;
x ^= y; y = ( (y << 1) | (y >> 7) ) & 0xFF;
x ^= y; y = ( (y << 1) | (y >> 7) ) & 0xFF;
x ^= y; y = ( (y << 1) | (y >> 7) ) & 0xFF;
y = x; y = ( ( y << 1 ) | ( y >> 7 ) ) & 0xFF;
x ^= y; y = ( ( y << 1 ) | ( y >> 7 ) ) & 0xFF;
x ^= y; y = ( ( y << 1 ) | ( y >> 7 ) ) & 0xFF;
x ^= y; y = ( ( y << 1 ) | ( y >> 7 ) ) & 0xFF;
x ^= y ^ 0x63;
FSb[i] = (unsigned char) x;
......@@ -504,7 +504,7 @@ int aes_setkey_enc( aes_context *ctx, const unsigned char *key,
return( aesni_setkey_enc( (unsigned char *) ctx->rk, key, keysize ) );
#endif
for( i = 0; i < (keysize >> 5); i++ )
for( i = 0; i < ( keysize >> 5 ); i++ )
{
GET_UINT32_LE( RK[i], key, i << 2 );
}
......@@ -726,7 +726,7 @@ int aes_crypt_ecb( aes_context *ctx,
if( mode == AES_DECRYPT )
{
for( i = (ctx->nr >> 1) - 1; i > 0; i-- )
for( i = ( ctx->nr >> 1 ) - 1; i > 0; i-- )
{
AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 );
......@@ -760,7 +760,7 @@ int aes_crypt_ecb( aes_context *ctx,
}
else /* AES_ENCRYPT */
{
for( i = (ctx->nr >> 1) - 1; i > 0; i-- )
for( i = ( ctx->nr >> 1 ) - 1; i > 0; i-- )
{
AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 );
......@@ -893,7 +893,7 @@ int aes_crypt_cfb128( aes_context *ctx,
*output++ = (unsigned char)( c ^ iv[n] );
iv[n] = (unsigned char) c;
n = (n + 1) & 0x0F;
n = ( n + 1 ) & 0x0F;
}
}
else
......@@ -905,7 +905,7 @@ int aes_crypt_cfb128( aes_context *ctx,
iv[n] = *output++ = (unsigned char)( iv[n] ^ *input++ );
n = (n + 1) & 0x0F;
n = ( n + 1 ) & 0x0F;
}
}
......@@ -930,7 +930,7 @@ int aes_crypt_cfb8( aes_context *ctx,
while( length-- )
{
memcpy(ov, iv, 16);
memcpy( ov, iv, 16 );
aes_crypt_ecb( ctx, AES_ENCRYPT, iv, iv );
if( mode == AES_DECRYPT )
......@@ -941,7 +941,7 @@ int aes_crypt_cfb8( aes_context *ctx,
if( mode == AES_ENCRYPT )
ov[16] = c;
memcpy(iv, ov + 1, 16);
memcpy( iv, ov + 1, 16 );
}
return( 0 );
......@@ -975,7 +975,7 @@ int aes_crypt_ctr( aes_context *ctx,
c = *input++;
*output++ = (unsigned char)( c ^ stream_block[n] );
n = (n + 1) & 0x0F;
n = ( n + 1 ) & 0x0F;
}
*nc_off = n;
......
/*
* AES-NI support functions
*
* Copyright (C) 2013, Brainspark B.V.
* Copyright (C) 2006-2014, Brainspark B.V.
*
* This file is part of PolarSSL (http://www.polarssl.org)
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
......
......@@ -194,7 +194,7 @@ int asn1_get_bitstring( unsigned char **p, const unsigned char *end,
return( ret );
/* Check length, subtract one for actual bit string length */
if ( bs->len < 1 )
if( bs->len < 1 )
return( POLARSSL_ERR_ASN1_OUT_OF_DATA );
bs->len -= 1;
......@@ -265,7 +265,7 @@ int asn1_get_sequence_of( unsigned char **p,
*p += buf->len;
/* Allocate and assign next pointer */
if (*p < end)
if( *p < end )
{
cur->next = (asn1_sequence *) polarssl_malloc(
sizeof( asn1_sequence ) );
......
......@@ -118,7 +118,7 @@ int asn1_write_mpi( unsigned char **p, unsigned char *start, mpi *X )
// DER format assumes 2s complement for numbers, so the leftmost bit
// should be 0 for positive numbers and 1 for negative numbers.
//
if ( X->s ==1 && **p & 0x80 )
if( X->s ==1 && **p & 0x80 )
{
if( *p - start < 1 )
return( POLARSSL_ERR_ASN1_BUF_TOO_SMALL );
......@@ -217,7 +217,7 @@ int asn1_write_int( unsigned char **p, unsigned char *start, int val )
len += 1;
*--(*p) = val;
if ( val > 0 && **p & 0x80 )
if( val > 0 && **p & 0x80 )
{
if( *p - start < 1 )
return( POLARSSL_ERR_ASN1_BUF_TOO_SMALL );
......
......@@ -87,9 +87,9 @@ int base64_encode( unsigned char *dst, size_t *dlen,
if( slen == 0 )
return( 0 );
n = (slen << 3) / 6;
n = ( slen << 3 ) / 6;
switch( (slen << 3) - (n * 6) )
switch( ( slen << 3 ) - ( n * 6 ) )
{
case 2: n += 3; break;
case 4: n += 2; break;
......@@ -102,7 +102,7 @@ int base64_encode( unsigned char *dst, size_t *dlen,
return( POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL );
}
n = (slen / 3) * 3;
n = ( slen / 3 ) * 3;
for( i = 0, p = dst; i < n; i += 3 )
{
......@@ -119,12 +119,12 @@ int base64_encode( unsigned char *dst, size_t *dlen,
if( i < slen )
{
C1 = *src++;
C2 = ((i + 1) < slen) ? *src++ : 0;
C2 = ( ( i + 1 ) < slen ) ? *src++ : 0;
*p++ = base64_enc_map[(C1 >> 2) & 0x3F];
*p++ = base64_enc_map[(((C1 & 3) << 4) + (C2 >> 4)) & 0x3F];
if( (i + 1) < slen )
if( ( i + 1 ) < slen )
*p++ = base64_enc_map[((C2 & 15) << 2) & 0x3F];
else *p++ = '=';
......@@ -171,7 +171,7 @@ int base64_decode( unsigned char *dst, size_t *dlen,
if( n == 0 )
return( 0 );
n = ((n * 6) + 7) >> 3;
n = ( ( n * 6 ) + 7 ) >> 3;
if( dst == NULL || *dlen < n )
{
......@@ -185,7 +185,7 @@ int base64_decode( unsigned char *dst, size_t *dlen,
continue;
j -= ( base64_dec_map[*src] == 64 );
x = (x << 6) | ( base64_dec_map[*src] & 0x3F );
x = ( x << 6 ) | ( base64_dec_map[*src] & 0x3F );
if( ++n == 4 )
{
......
......@@ -229,13 +229,13 @@ int mpi_safe_cond_assign( mpi *X, const mpi *Y, unsigned char assign )
MPI_CHK( mpi_grow( X, Y->n ) );
X->s = X->s * (1 - assign) + Y->s * assign;
X->s = X->s * ( 1 - assign ) + Y->s * assign;
for( i = 0; i < Y->n; i++ )
X->p[i] = X->p[i] * (1 - assign) + Y->p[i] * assign;
X->p[i] = X->p[i] * ( 1 - assign ) + Y->p[i] * assign;
for( ; i < X->n; i++ )
X->p[i] *= (1 - assign);
X->p[i] *= ( 1 - assign );
cleanup:
return( ret );
......@@ -263,15 +263,15 @@ int mpi_safe_cond_swap( mpi *X, mpi *Y, unsigned char swap )
MPI_CHK( mpi_grow( Y, X->n ) );
s = X->s;
X->s = X->s * (1 - swap) + Y->s * swap;
Y->s = Y->s * (1 - swap) + s * swap;
X->s = X->s * ( 1 - swap ) + Y->s * swap;
Y->s = Y->s * ( 1 - swap ) + s * swap;
for( i = 0; i < X->n; i++ )
{
tmp = X->p[i];
X->p[i] = X->p[i] * (1 - swap) + Y->p[i] * swap;
Y->p[i] = Y->p[i] * (1 - swap) + tmp * swap;
X->p[i] = X->p[i] * ( 1 - swap ) + Y->p[i] * swap;
Y->p[i] = Y->p[i] * ( 1 - swap ) + tmp * swap;
}
cleanup:
......@@ -426,7 +426,7 @@ int mpi_read_string( mpi *X, int radix, const char *s )
}
MPI_CHK( mpi_get_digit( &d, radix, s[i - 1] ) );
X->p[j / (2 * ciL)] |= d << ( (j % (2 * ciL)) << 2 );
X->p[j / ( 2 * ciL )] |= d << ( ( j % ( 2 * ciL ) ) << 2 );
}
}
else
......@@ -1226,14 +1226,14 @@ int mpi_div_mpi( mpi *Q, mpi *R, const mpi *A, const mpi *B )
n = X.n - 1;
t = Y.n - 1;
MPI_CHK( mpi_shift_l( &Y, biL * (n - t) ) );
MPI_CHK( mpi_shift_l( &Y, biL * ( n - t ) ) );
while( mpi_cmp_mpi( &X, &Y ) >= 0 )
{
Z.p[n - t]++;
MPI_CHK( mpi_sub_mpi( &X, &X, &Y ) );
}
MPI_CHK( mpi_shift_r( &Y, biL * (n - t) ) );
MPI_CHK( mpi_shift_r( &Y, biL * ( n - t ) ) );
for( i = n; i > t ; i-- )
{
......@@ -1257,8 +1257,8 @@ int mpi_div_mpi( mpi *Q, mpi *R, const mpi *A, const mpi *B )
r = (t_udbl) X.p[i] << biL;
r |= (t_udbl) X.p[i - 1];
r /= Y.p[t];
if( r > ((t_udbl) 1 << biL) - 1)
r = ((t_udbl) 1 << biL) - 1;
if( r > ( (t_udbl) 1 << biL ) - 1 )
r = ( (t_udbl) 1 << biL ) - 1;
Z.p[i - t - 1] = (t_uint) r;
#else
......@@ -1310,25 +1310,25 @@ int mpi_div_mpi( mpi *Q, mpi *R, const mpi *A, const mpi *B )
Z.p[i - t - 1]--;
MPI_CHK( mpi_lset( &T1, 0 ) );
T1.p[0] = (t < 1) ? 0 : Y.p[t - 1];
T1.p[0] = ( t < 1 ) ? 0 : Y.p[t - 1];
T1.p[1] = Y.p[t];
MPI_CHK( mpi_mul_int( &T1, &T1, Z.p[i - t - 1] ) );
MPI_CHK( mpi_lset( &T2, 0 ) );
T2.p[0] = (i < 2) ? 0 : X.p[i - 2];
T2.p[1] = (i < 1) ? 0 : X.p[i - 1];
T2.p[0] = ( i < 2 ) ? 0 : X.p[i - 2];
T2.p[1] = ( i < 1 ) ? 0 : X.p[i - 1];
T2.p[2] = X.p[i];
}
while( mpi_cmp_mpi( &T1, &T2 ) > 0 );
MPI_CHK( mpi_mul_int( &T1, &Y, Z.p[i - t - 1] ) );
MPI_CHK( mpi_shift_l( &T1, biL * (i - t - 1) ) );
MPI_CHK( mpi_shift_l( &T1, biL * ( i - t - 1 ) ) );
MPI_CHK( mpi_sub_mpi( &X, &X, &T1 ) );
if( mpi_cmp_int( &X, 0 ) < 0 )
{
MPI_CHK( mpi_copy( &T1, &Y ) );
MPI_CHK( mpi_shift_l( &T1, biL * (i - t - 1) ) );
MPI_CHK( mpi_shift_l( &T1, biL * ( i - t - 1 ) ) );
MPI_CHK( mpi_add_mpi( &X, &X, &T1 ) );
Z.p[i - t - 1]--;
}
......@@ -1500,7 +1500,7 @@ static void mpi_montmul( mpi *A, const mpi *B, const mpi *N, t_uint mm,
*d++ = u0; d[n + 1] = 0;
}
memcpy( A->p, d, (n + 1) * ciL );
memcpy( A->p, d, ( n + 1 ) * ciL );
if( mpi_cmp_abs( A, N ) >= 0 )
mpi_sub_hlp( n, N->p, A->p );
......@@ -1610,7 +1610,7 @@ int mpi_exp_mod( mpi *X, const mpi *A, const mpi *E, const mpi *N, mpi *_RR )
/*
* W[1 << (wsize - 1)] = W[1] ^ (wsize - 1)
*/
j = one << (wsize - 1);
j = one << ( wsize - 1 );
MPI_CHK( mpi_grow( &W[j], N->n + 1 ) );
MPI_CHK( mpi_copy( &W[j], &W[1] ) );
......@@ -1621,7 +1621,7 @@ int mpi_exp_mod( mpi *X, const mpi *A, const mpi *E, const mpi *N, mpi *_RR )
/*
* W[i] = W[i - 1] * W[1]
*/
for( i = j + 1; i < (one << wsize); i++ )
for( i = j + 1; i < ( one << wsize ); i++ )
{
MPI_CHK( mpi_grow( &W[i], N->n + 1 ) );
MPI_CHK( mpi_copy( &W[i], &W[i - 1] ) );
......@@ -1673,7 +1673,7 @@ int mpi_exp_mod( mpi *X, const mpi *A, const mpi *E, const mpi *N, mpi *_RR )
state = 2;
nbits++;
wbits |= (ei << (wsize - nbits));
wbits |= ( ei << ( wsize - nbits ) );
if( nbits == wsize )
{
......@@ -1703,7 +1703,7 @@ int mpi_exp_mod( mpi *X, const mpi *A, const mpi *E, const mpi *N, mpi *_RR )
wbits <<= 1;
if( (wbits & (one << wsize)) != 0 )
if( ( wbits & ( one << wsize ) ) != 0 )
mpi_montmul( X, &W[1], N, mm, &T );
}
......@@ -1720,7 +1720,7 @@ int mpi_exp_mod( mpi *X, const mpi *A, const mpi *E, const mpi *N, mpi *_RR )
cleanup:
for( i = (one << (wsize - 1)); i < (one << wsize); i++ )
for( i = ( one << ( wsize - 1 ) ); i < ( one << wsize ); i++ )
mpi_free( &W[i] );
mpi_free( &W[1] ); mpi_free( &T ); mpi_free( &Apos );
......@@ -1748,7 +1748,7 @@ int mpi_gcd( mpi *G, const mpi *A, const mpi *B )
lz = mpi_lsb( &TA );
lzt = mpi_lsb( &TB );
if ( lzt < lz )
if( lzt < lz )
lz = lzt;
MPI_CHK( mpi_shift_r( &TA, lz ) );
......@@ -2305,7 +2305,7 @@ int mpi_self_test( int verbose )
if( verbose != 0 )
polarssl_printf( " MPI test #5 (simple gcd): " );
for ( i = 0; i < GCD_PAIR_COUNT; i++)
for( i = 0; i < GCD_PAIR_COUNT; i++ )
{
MPI_CHK( mpi_lset( &X, gcd_pairs[i][0] ) );
MPI_CHK( mpi_lset( &Y, gcd_pairs[i][1] ) );
......
......@@ -75,7 +75,7 @@ static const uint32_t P[BLOWFISH_ROUNDS + 2] = {
/* declarations of data at the end of this file */
static const uint32_t S[4][256];
static uint32_t F(blowfish_context *ctx, uint32_t x)
static uint32_t F( blowfish_context *ctx, uint32_t x )
{
unsigned short a, b, c, d;
uint32_t y;
......@@ -94,7 +94,7 @@ static uint32_t F(blowfish_context *ctx, uint32_t x)
return( y );
}
static void blowfish_enc(blowfish_context *ctx, uint32_t *xl, uint32_t *xr)
static void blowfish_enc( blowfish_context *ctx, uint32_t *xl, uint32_t *xr )
{
uint32_t Xl, Xr, temp;
short i;
......@@ -102,10 +102,10 @@ static void blowfish_enc(blowfish_context *ctx, uint32_t *xl, uint32_t *xr)
Xl = *xl;
Xr = *xr;
for (i = 0; i < BLOWFISH_ROUNDS; ++i)
for( i = 0; i < BLOWFISH_ROUNDS; ++i )
{
Xl = Xl ^ ctx->P[i];
Xr = F(ctx, Xl) ^ Xr;
Xr = F( ctx, Xl ) ^ Xr;
temp = Xl;
Xl = Xr;
......@@ -123,7 +123,7 @@ static void blowfish_enc(blowfish_context *ctx, uint32_t *xl, uint32_t *xr)
*xr = Xr;
}
static void blowfish_dec(blowfish_context *ctx, uint32_t *xl, uint32_t *xr)
static void blowfish_dec( blowfish_context *ctx, uint32_t *xl, uint32_t *xr )
{
uint32_t Xl, Xr, temp;
short i;
......@@ -131,10 +131,10 @@ static void blowfish_dec(blowfish_context *ctx, uint32_t *xl, uint32_t *xr)
Xl = *xl;
Xr = *xr;
for (i = BLOWFISH_ROUNDS + 1; i > 1; --i)
for( i = BLOWFISH_ROUNDS + 1; i > 1; --i )
{
Xl = Xl ^ ctx->P[i];
Xr = F(ctx, Xl) ^ Xr;
Xr = F( ctx, Xl ) ^ Xr;
temp = Xl;
Xl = Xr;
......@@ -225,11 +225,11 @@ int blowfish_crypt_ecb( blowfish_context *ctx,
if( mode == BLOWFISH_DECRYPT )
{
blowfish_dec(ctx, &X0, &X1);
blowfish_dec( ctx, &X0, &X1 );
}
else /* BLOWFISH_ENCRYPT */
{
blowfish_enc(ctx, &X0, &X1);
blowfish_enc( ctx, &X0, &X1 );
}
PUT_UINT32_BE( X0, output, 0 );
......@@ -318,7 +318,7 @@ int blowfish_crypt_cfb64( blowfish_context *ctx,
*output++ = (unsigned char)( c ^ iv[n] );
iv[n] = (unsigned char) c;
n = (n + 1) % BLOWFISH_BLOCKSIZE;
n = ( n + 1 ) % BLOWFISH_BLOCKSIZE;
}
}
else
......@@ -330,7 +330,7 @@ int blowfish_crypt_cfb64( blowfish_context *ctx,
iv[n] = *output++ = (unsigned char)( iv[n] ^ *input++ );
n = (n + 1) % BLOWFISH_BLOCKSIZE;
n = ( n + 1 ) % BLOWFISH_BLOCKSIZE;
}
}
......@@ -368,7 +368,7 @@ int blowfish_crypt_ctr( blowfish_context *ctx,
c = *input++;
*output++ = (unsigned char)( c ^ stream_block[n] );
n = (n + 1) % BLOWFISH_BLOCKSIZE;
n = ( n + 1 ) % BLOWFISH_BLOCKSIZE;
}
*nc_off = n;
......
......@@ -287,14 +287,14 @@ static const signed char transposes[2][20] =
TK[2] = KC[(OFFSET) * 4 + 2]; \
TK[3] = KC[(OFFSET) * 4 + 3]; \
\
for ( i = 1; i <= 4; i++ ) \
if (shifts[(INDEX)][(OFFSET)][i -1]) \
ROTL(TK + i * 4, TK, (15 * i) % 32); \
for( i = 1; i <= 4; i++ ) \
if( shifts[(INDEX)][(OFFSET)][i -1] ) \
ROTL(TK + i * 4, TK, ( 15 * i ) % 32); \
\
for ( i = 0; i < 20; i++ ) \
if (indexes[(INDEX)][(OFFSET)][i] != -1) { \
RK[indexes[(INDEX)][(OFFSET)][i]] = TK[ i ]; \
} \
for( i = 0; i < 20; i++ ) \
if( indexes[(INDEX)][(OFFSET)][i] != -1 ) { \
RK[indexes[(INDEX)][(OFFSET)][i]] = TK[ i ]; \
} \
}
static void camellia_feistel( const uint32_t x[2], const uint32_t k[2],
......@@ -338,8 +338,8 @@ int camellia_setkey_enc( camellia_context *ctx, const unsigned char *key,
RK = ctx->rk;
memset(t, 0, 64);
memset(RK, 0, sizeof(ctx->rk));
memset( t, 0, 64 );
memset( RK, 0, sizeof(ctx->rk) );
switch( keysize )
{
......@@ -349,52 +349,52 @@ int camellia_setkey_enc( camellia_context *ctx, const unsigned char *key,
default : return( POLARSSL_ERR_CAMELLIA_INVALID_KEY_LENGTH );
}
for( i = 0; i < keysize / 8; ++i)
for( i = 0; i < keysize / 8; ++i )
t[i] = key[i];
if (keysize == 192) {
for (i = 0; i < 8; i++)
if( keysize == 192 ) {
for( i = 0; i < 8; i++ )
t[24 + i] = ~t[16 + i];
}
/*
* Prepare SIGMA values
*/
for (i = 0; i < 6; i++) {
GET_UINT32_BE(SIGMA[i][0], SIGMA_CHARS[i], 0);
GET_UINT32_BE(SIGMA[i][1], SIGMA_CHARS[i], 4);
for( i = 0; i < 6; i++ ) {
GET_UINT32_BE( SIGMA[i][0], SIGMA_CHARS[i], 0 );
GET_UINT32_BE( SIGMA[i][1], SIGMA_CHARS[i], 4 );
}
/*
* Key storage in KC
* Order: KL, KR, KA, KB
*/
memset(KC, 0, sizeof(KC));
memset( KC, 0, sizeof(KC) );
/* Store KL, KR */
for (i = 0; i < 8; i++)
GET_UINT32_BE(KC[i], t, i * 4);
for( i = 0; i < 8; i++ )
GET_UINT32_BE( KC[i], t, i * 4 );
/* Generate KA */
for( i = 0; i < 4; ++i)
for( i = 0; i < 4; ++i )
KC[8 + i] = KC[i] ^ KC[4 + i];
camellia_feistel(KC + 8, SIGMA[0], KC + 10);
camellia_feistel(KC + 10, SIGMA[1], KC + 8);
camellia_feistel( KC + 8, SIGMA[0], KC + 10 );
camellia_feistel( KC + 10, SIGMA[1], KC + 8 );
for( i = 0; i < 4; ++i)
for( i = 0; i < 4; ++i )
KC[8 + i] ^= KC[i];
camellia_feistel(KC + 8, SIGMA[2], KC + 10);
camellia_feistel(KC + 10, SIGMA[3], KC + 8);
camellia_feistel( KC + 8, SIGMA[2], KC + 10 );
camellia_feistel( KC + 10, SIGMA[3], KC + 8 );
if (keysize > 128) {
if( keysize > 128 ) {
/* Generate KB */
for( i = 0; i < 4; ++i)
for( i = 0; i < 4; ++i )
KC[12 + i] = KC[4 + i] ^ KC[8 + i];
camellia_feistel(KC + 12, SIGMA[4], KC + 14);
camellia_feistel(KC + 14, SIGMA[5], KC + 12);
camellia_feistel( KC + 12, SIGMA[4], KC + 14 );
camellia_feistel( KC + 14, SIGMA[5], KC + 12 );
}
/*
......@@ -402,24 +402,24 @@ int camellia_setkey_enc( camellia_context *ctx, const unsigned char *key,
*/
/* Manipulating KL */
SHIFT_AND_PLACE(idx, 0);
SHIFT_AND_PLACE( idx, 0 );
/* Manipulating KR */
if (keysize > 128) {
SHIFT_AND_PLACE(idx, 1);
if( keysize > 128 ) {
SHIFT_AND_PLACE( idx, 1 );
}
/* Manipulating KA */
SHIFT_AND_PLACE(idx, 2);
SHIFT_AND_PLACE( idx, 2 );
/* Manipulating KB */
if (keysize > 128) {
SHIFT_AND_PLACE(idx, 3);
if( keysize > 128 ) {
SHIFT_AND_PLACE( idx, 3 );
}
/* Do transpositions */
for ( i = 0; i < 20; i++ ) {
if (transposes[idx][i] != -1) {
for( i = 0; i < 20; i++ ) {
if( transposes[idx][i] != -1 ) {
RK[32 + 12 * idx + i] = RK[transposes[idx][i]];
}
}
......@@ -441,7 +441,7 @@ int camellia_setkey_dec( camellia_context *ctx, const unsigned char *key,
int ret;
/* Also checks keysize */
if( ( ret = camellia_setkey_enc(&cty, key, keysize) ) )
if( ( ret = camellia_setkey_enc( &cty, key, keysize ) ) )
return( ret );
ctx->nr = cty.nr;
......@@ -455,7 +455,7 @@ int camellia_setkey_dec( camellia_context *ctx, const unsigned char *key,
*RK++ = *SK++;