Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
external
mbedtls
Commits
d8bb8266
Commit
d8bb8266
authored
Jun 17, 2014
by
Paul Bakker
Browse files
Fix code styling for return statements
parent
3c38f29a
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
180 additions
and
180 deletions
+180
-180
library/asn1parse.c
library/asn1parse.c
+1
-1
library/bignum.c
library/bignum.c
+5
-5
library/blowfish.c
library/blowfish.c
+2
-2
library/camellia.c
library/camellia.c
+1
-1
library/cipher.c
library/cipher.c
+66
-66
library/cipher_wrap.c
library/cipher_wrap.c
+14
-14
library/ecdh.c
library/ecdh.c
+2
-2
library/ecp.c
library/ecp.c
+4
-4
library/entropy.c
library/entropy.c
+1
-1
library/entropy_poll.c
library/entropy_poll.c
+5
-5
library/md.c
library/md.c
+40
-40
library/md_wrap.c
library/md_wrap.c
+9
-9
library/memory_buffer_alloc.c
library/memory_buffer_alloc.c
+2
-2
library/oid.c
library/oid.c
+13
-13
library/pk.c
library/pk.c
+5
-5
library/pk_wrap.c
library/pk_wrap.c
+2
-2
library/pkcs11.c
library/pkcs11.c
+4
-4
library/pkparse.c
library/pkparse.c
+2
-2
library/rsa.c
library/rsa.c
+1
-1
library/ssl_ciphersuites.c
library/ssl_ciphersuites.c
+1
-1
No files found.
library/asn1parse.c
View file @
d8bb8266
...
...
@@ -211,7 +211,7 @@ int asn1_get_bitstring( unsigned char **p, const unsigned char *end,
if
(
*
p
!=
end
)
return
(
POLARSSL_ERR_ASN1_LENGTH_MISMATCH
);
return
0
;
return
(
0
)
;
}
/*
...
...
library/bignum.c
View file @
d8bb8266
...
...
@@ -304,7 +304,7 @@ int mpi_get_bit( const mpi *X, size_t pos )
if
(
X
->
n
*
biL
<=
pos
)
return
(
0
);
return
(
X
->
p
[
pos
/
biL
]
>>
(
pos
%
biL
)
)
&
0x01
;
return
(
(
X
->
p
[
pos
/
biL
]
>>
(
pos
%
biL
)
)
&
0x01
)
;
}
/*
...
...
@@ -317,12 +317,12 @@ int mpi_set_bit( mpi *X, size_t pos, unsigned char val )
size_t
idx
=
pos
%
biL
;
if
(
val
!=
0
&&
val
!=
1
)
return
POLARSSL_ERR_MPI_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_MPI_BAD_INPUT_DATA
)
;
if
(
X
->
n
*
biL
<=
pos
)
{
if
(
val
==
0
)
return
(
0
);
return
(
0
);
MPI_CHK
(
mpi_grow
(
X
,
off
+
1
)
);
}
...
...
@@ -1382,7 +1382,7 @@ int mpi_mod_mpi( mpi *R, const mpi *A, const mpi *B )
int
ret
;
if
(
mpi_cmp_int
(
B
,
0
)
<
0
)
return
POLARSSL_ERR_MPI_NEGATIVE_VALUE
;
return
(
POLARSSL_ERR_MPI_NEGATIVE_VALUE
)
;
MPI_CHK
(
mpi_div_mpi
(
NULL
,
R
,
A
,
B
)
);
...
...
@@ -1409,7 +1409,7 @@ int mpi_mod_int( t_uint *r, const mpi *A, t_sint b )
return
(
POLARSSL_ERR_MPI_DIVISION_BY_ZERO
);
if
(
b
<
0
)
return
POLARSSL_ERR_MPI_NEGATIVE_VALUE
;
return
(
POLARSSL_ERR_MPI_NEGATIVE_VALUE
)
;
/*
* handle trivial cases
...
...
library/blowfish.c
View file @
d8bb8266
...
...
@@ -91,7 +91,7 @@ static uint32_t F(blowfish_context *ctx, uint32_t x)
y
=
y
^
ctx
->
S
[
2
][
c
];
y
=
y
+
ctx
->
S
[
3
][
d
];
return
y
;
return
(
y
)
;
}
static
void
blowfish_enc
(
blowfish_context
*
ctx
,
uint32_t
*
xl
,
uint32_t
*
xr
)
...
...
@@ -164,7 +164,7 @@ int blowfish_setkey( blowfish_context *ctx, const unsigned char *key,
if
(
keysize
<
BLOWFISH_MIN_KEY
||
keysize
>
BLOWFISH_MAX_KEY
||
(
keysize
%
8
)
)
{
return
POLARSSL_ERR_BLOWFISH_INVALID_KEY_LENGTH
;
return
(
POLARSSL_ERR_BLOWFISH_INVALID_KEY_LENGTH
)
;
}
keysize
>>=
3
;
...
...
library/camellia.c
View file @
d8bb8266
...
...
@@ -1050,7 +1050,7 @@ int camellia_self_test( int verbose )
polarssl_printf
(
"
\n
"
);
#endif
/* POLARSSL_CIPHER_MODE_CTR */
return
(
0
);
return
(
0
);
}
#endif
/* POLARSSL_SELF_TEST */
...
...
library/cipher.c
View file @
d8bb8266
...
...
@@ -82,7 +82,7 @@ const int *cipher_list( void )
supported_init
=
1
;
}
return
supported_ciphers
;
return
(
supported_ciphers
)
;
}
const
cipher_info_t
*
cipher_info_from_type
(
const
cipher_type_t
cipher_type
)
...
...
@@ -93,7 +93,7 @@ const cipher_info_t *cipher_info_from_type( const cipher_type_t cipher_type )
if
(
def
->
type
==
cipher_type
)
return
(
def
->
info
);
return
NULL
;
return
(
NULL
)
;
}
const
cipher_info_t
*
cipher_info_from_string
(
const
char
*
cipher_name
)
...
...
@@ -101,13 +101,13 @@ const cipher_info_t *cipher_info_from_string( const char *cipher_name )
const
cipher_definition_t
*
def
;
if
(
NULL
==
cipher_name
)
return
NULL
;
return
(
NULL
)
;
for
(
def
=
cipher_definitions
;
def
->
info
!=
NULL
;
def
++
)
if
(
!
strcasecmp
(
def
->
info
->
name
,
cipher_name
)
)
return
(
def
->
info
);
return
NULL
;
return
(
NULL
)
;
}
const
cipher_info_t
*
cipher_info_from_values
(
const
cipher_id_t
cipher_id
,
...
...
@@ -122,18 +122,18 @@ const cipher_info_t *cipher_info_from_values( const cipher_id_t cipher_id,
def
->
info
->
mode
==
mode
)
return
(
def
->
info
);
return
NULL
;
return
(
NULL
)
;
}
int
cipher_init_ctx
(
cipher_context_t
*
ctx
,
const
cipher_info_t
*
cipher_info
)
{
if
(
NULL
==
cipher_info
||
NULL
==
ctx
)
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
memset
(
ctx
,
0
,
sizeof
(
cipher_context_t
)
);
if
(
NULL
==
(
ctx
->
cipher_ctx
=
cipher_info
->
base
->
ctx_alloc_func
()
)
)
return
POLARSSL_ERR_CIPHER_ALLOC_FAILED
;
return
(
POLARSSL_ERR_CIPHER_ALLOC_FAILED
)
;
ctx
->
cipher_info
=
cipher_info
;
...
...
@@ -148,28 +148,28 @@ int cipher_init_ctx( cipher_context_t *ctx, const cipher_info_t *cipher_info )
#endif
#endif
/* POLARSSL_CIPHER_MODE_WITH_PADDING */
return
0
;
return
(
0
)
;
}
int
cipher_free_ctx
(
cipher_context_t
*
ctx
)
{
if
(
ctx
==
NULL
||
ctx
->
cipher_info
==
NULL
)
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
ctx
->
cipher_info
->
base
->
ctx_free_func
(
ctx
->
cipher_ctx
);
polarssl_zeroize
(
ctx
,
sizeof
(
cipher_context_t
)
);
return
0
;
return
(
0
)
;
}
int
cipher_setkey
(
cipher_context_t
*
ctx
,
const
unsigned
char
*
key
,
int
key_length
,
const
operation_t
operation
)
{
if
(
NULL
==
ctx
||
NULL
==
ctx
->
cipher_info
)
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
if
(
(
int
)
ctx
->
cipher_info
->
key_length
!=
key_length
)
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
ctx
->
key_length
=
key_length
;
ctx
->
operation
=
operation
;
...
...
@@ -189,7 +189,7 @@ int cipher_setkey( cipher_context_t *ctx, const unsigned char *key,
return
ctx
->
cipher_info
->
base
->
setkey_dec_func
(
ctx
->
cipher_ctx
,
key
,
ctx
->
key_length
);
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
}
int
cipher_set_iv
(
cipher_context_t
*
ctx
,
...
...
@@ -198,11 +198,11 @@ int cipher_set_iv( cipher_context_t *ctx,
size_t
actual_iv_size
;
if
(
NULL
==
ctx
||
NULL
==
ctx
->
cipher_info
||
NULL
==
iv
)
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
/* avoid buffer overflow in ctx->iv */
if
(
iv_len
>
POLARSSL_MAX_IV_LENGTH
)
return
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
;
return
(
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
)
;
if
(
ctx
->
cipher_info
->
accepts_variable_iv_size
)
actual_iv_size
=
iv_len
;
...
...
@@ -212,23 +212,23 @@ int cipher_set_iv( cipher_context_t *ctx,
/* avoid reading past the end of input buffer */
if
(
actual_iv_size
>
iv_len
)
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
}
memcpy
(
ctx
->
iv
,
iv
,
actual_iv_size
);
ctx
->
iv_size
=
actual_iv_size
;
return
0
;
return
(
0
)
;
}
int
cipher_reset
(
cipher_context_t
*
ctx
)
{
if
(
NULL
==
ctx
||
NULL
==
ctx
->
cipher_info
)
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
ctx
->
unprocessed_len
=
0
;
return
0
;
return
(
0
)
;
}
#if defined(POLARSSL_CIPHER_MODE_AEAD)
...
...
@@ -236,7 +236,7 @@ int cipher_update_ad( cipher_context_t *ctx,
const
unsigned
char
*
ad
,
size_t
ad_len
)
{
if
(
NULL
==
ctx
||
NULL
==
ctx
->
cipher_info
)
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
#if defined(POLARSSL_GCM_C)
if
(
POLARSSL_MODE_GCM
==
ctx
->
cipher_info
->
mode
)
...
...
@@ -246,7 +246,7 @@ int cipher_update_ad( cipher_context_t *ctx,
}
#endif
return
0
;
return
(
0
)
;
}
#endif
/* POLARSSL_CIPHER_MODE_AEAD */
...
...
@@ -257,7 +257,7 @@ int cipher_update( cipher_context_t *ctx, const unsigned char *input,
if
(
NULL
==
ctx
||
NULL
==
ctx
->
cipher_info
||
NULL
==
olen
)
{
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
}
*
olen
=
0
;
...
...
@@ -265,17 +265,17 @@ int cipher_update( cipher_context_t *ctx, const unsigned char *input,
if
(
ctx
->
cipher_info
->
mode
==
POLARSSL_MODE_ECB
)
{
if
(
ilen
!=
cipher_get_block_size
(
ctx
)
)
return
POLARSSL_ERR_CIPHER_FULL_BLOCK_EXPECTED
;
return
(
POLARSSL_ERR_CIPHER_FULL_BLOCK_EXPECTED
)
;
*
olen
=
ilen
;
if
(
0
!=
(
ret
=
ctx
->
cipher_info
->
base
->
ecb_func
(
ctx
->
cipher_ctx
,
ctx
->
operation
,
input
,
output
)
)
)
{
return
ret
;
return
(
ret
)
;
}
return
0
;
return
(
0
)
;
}
#if defined(POLARSSL_GCM_C)
...
...
@@ -290,7 +290,7 @@ int cipher_update( cipher_context_t *ctx, const unsigned char *input,
if
(
input
==
output
&&
(
ctx
->
unprocessed_len
!=
0
||
ilen
%
cipher_get_block_size
(
ctx
)
)
)
{
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
}
#if defined(POLARSSL_CIPHER_MODE_CBC)
...
...
@@ -310,7 +310,7 @@ int cipher_update( cipher_context_t *ctx, const unsigned char *input,
ilen
);
ctx
->
unprocessed_len
+=
ilen
;
return
0
;
return
(
0
)
;
}
/*
...
...
@@ -327,7 +327,7 @@ int cipher_update( cipher_context_t *ctx, const unsigned char *input,
ctx
->
operation
,
cipher_get_block_size
(
ctx
),
ctx
->
iv
,
ctx
->
unprocessed_data
,
output
)
)
)
{
return
ret
;
return
(
ret
)
;
}
*
olen
+=
cipher_get_block_size
(
ctx
);
...
...
@@ -362,13 +362,13 @@ int cipher_update( cipher_context_t *ctx, const unsigned char *input,
if
(
0
!=
(
ret
=
ctx
->
cipher_info
->
base
->
cbc_func
(
ctx
->
cipher_ctx
,
ctx
->
operation
,
ilen
,
ctx
->
iv
,
input
,
output
)
)
)
{
return
ret
;
return
(
ret
)
;
}
*
olen
+=
ilen
;
}
return
0
;
return
(
0
)
;
}
#endif
/* POLARSSL_CIPHER_MODE_CBC */
...
...
@@ -379,12 +379,12 @@ int cipher_update( cipher_context_t *ctx, const unsigned char *input,
ctx
->
operation
,
ilen
,
&
ctx
->
unprocessed_len
,
ctx
->
iv
,
input
,
output
)
)
)
{
return
ret
;
return
(
ret
)
;
}
*
olen
=
ilen
;
return
0
;
return
(
0
)
;
}
#endif
/* POLARSSL_CIPHER_MODE_CFB */
...
...
@@ -395,12 +395,12 @@ int cipher_update( cipher_context_t *ctx, const unsigned char *input,
ilen
,
&
ctx
->
unprocessed_len
,
ctx
->
iv
,
ctx
->
unprocessed_data
,
input
,
output
)
)
)
{
return
ret
;
return
(
ret
)
;
}
*
olen
=
ilen
;
return
0
;
return
(
0
)
;
}
#endif
/* POLARSSL_CIPHER_MODE_CTR */
...
...
@@ -410,16 +410,16 @@ int cipher_update( cipher_context_t *ctx, const unsigned char *input,
if
(
0
!=
(
ret
=
ctx
->
cipher_info
->
base
->
stream_func
(
ctx
->
cipher_ctx
,
ilen
,
input
,
output
)
)
)
{
return
ret
;
return
(
ret
)
;
}
*
olen
=
ilen
;
return
0
;
return
(
0
)
;
}
#endif
/* POLARSSL_CIPHER_MODE_STREAM */
return
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
;
return
(
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
)
;
}
#if defined(POLARSSL_CIPHER_MODE_WITH_PADDING)
...
...
@@ -444,7 +444,7 @@ static int get_pkcs_padding( unsigned char *input, size_t input_len,
unsigned
char
padding_len
,
bad
=
0
;
if
(
NULL
==
input
||
NULL
==
data_len
)
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
padding_len
=
input
[
input_len
-
1
];
*
data_len
=
input_len
-
padding_len
;
...
...
@@ -459,7 +459,7 @@ static int get_pkcs_padding( unsigned char *input, size_t input_len,
for
(
i
=
0
;
i
<
input_len
;
i
++
)
bad
|=
(
input
[
i
]
^
padding_len
)
*
(
i
>=
pad_idx
);
return
POLARSSL_ERR_CIPHER_INVALID_PADDING
*
(
bad
!=
0
);
return
(
POLARSSL_ERR_CIPHER_INVALID_PADDING
*
(
bad
!=
0
)
)
;
}
#endif
/* POLARSSL_CIPHER_PADDING_PKCS7 */
...
...
@@ -485,7 +485,7 @@ static int get_one_and_zeros_padding( unsigned char *input, size_t input_len,
unsigned
char
done
=
0
,
prev_done
,
bad
;
if
(
NULL
==
input
||
NULL
==
data_len
)
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
bad
=
0xFF
;
*
data_len
=
0
;
...
...
@@ -497,7 +497,7 @@ static int get_one_and_zeros_padding( unsigned char *input, size_t input_len,
bad
&=
(
input
[
i
-
1
]
^
0x80
)
|
(
done
==
prev_done
);
}
return
POLARSSL_ERR_CIPHER_INVALID_PADDING
*
(
bad
!=
0
);
return
(
POLARSSL_ERR_CIPHER_INVALID_PADDING
*
(
bad
!=
0
)
)
;
}
#endif
/* POLARSSL_CIPHER_PADDING_ONE_AND_ZEROS */
...
...
@@ -524,7 +524,7 @@ static int get_zeros_and_len_padding( unsigned char *input, size_t input_len,
unsigned
char
padding_len
,
bad
=
0
;
if
(
NULL
==
input
||
NULL
==
data_len
)
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
padding_len
=
input
[
input_len
-
1
];
*
data_len
=
input_len
-
padding_len
;
...
...
@@ -538,7 +538,7 @@ static int get_zeros_and_len_padding( unsigned char *input, size_t input_len,
for
(
i
=
0
;
i
<
input_len
-
1
;
i
++
)
bad
|=
input
[
i
]
*
(
i
>=
pad_idx
);
return
POLARSSL_ERR_CIPHER_INVALID_PADDING
*
(
bad
!=
0
);
return
(
POLARSSL_ERR_CIPHER_INVALID_PADDING
*
(
bad
!=
0
)
)
;
}
#endif
/* POLARSSL_CIPHER_PADDING_ZEROS_AND_LEN */
...
...
@@ -562,7 +562,7 @@ static int get_zeros_padding( unsigned char *input, size_t input_len,
unsigned
char
done
=
0
,
prev_done
;
if
(
NULL
==
input
||
NULL
==
data_len
)
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
*
data_len
=
0
;
for
(
i
=
input_len
;
i
>
0
;
i
--
)
...
...
@@ -572,7 +572,7 @@ static int get_zeros_padding( unsigned char *input, size_t input_len,
*
data_len
|=
i
*
(
done
!=
prev_done
);
}
return
0
;
return
(
0
)
;
}
#endif
/* POLARSSL_CIPHER_PADDING_ZEROS */
...
...
@@ -586,11 +586,11 @@ static int get_no_padding( unsigned char *input, size_t input_len,
size_t
*
data_len
)
{
if
(
NULL
==
input
||
NULL
==
data_len
)
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
*
data_len
=
input_len
;
return
0
;
return
(
0
)
;
}
#endif
/* POLARSSL_CIPHER_MODE_WITH_PADDING */
...
...
@@ -598,7 +598,7 @@ int cipher_finish( cipher_context_t *ctx,
unsigned
char
*
output
,
size_t
*
olen
)
{
if
(
NULL
==
ctx
||
NULL
==
ctx
->
cipher_info
||
NULL
==
olen
)
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
*
olen
=
0
;
...
...
@@ -607,15 +607,15 @@ int cipher_finish( cipher_context_t *ctx,
POLARSSL_MODE_GCM
==
ctx
->
cipher_info
->
mode
||
POLARSSL_MODE_STREAM
==
ctx
->
cipher_info
->
mode
)
{
return
0
;
return
(
0
)
;
}
if
(
POLARSSL_MODE_ECB
==
ctx
->
cipher_info
->
mode
)
{
if
(
ctx
->
unprocessed_len
!=
0
)
return
POLARSSL_ERR_CIPHER_FULL_BLOCK_EXPECTED
;
return
(
POLARSSL_ERR_CIPHER_FULL_BLOCK_EXPECTED
)
;
return
0
;
return
(
0
)
;
}
#if defined(POLARSSL_CIPHER_MODE_CBC)
...
...
@@ -629,9 +629,9 @@ int cipher_finish( cipher_context_t *ctx,
if
(
NULL
==
ctx
->
add_padding
)
{
if
(
0
!=
ctx
->
unprocessed_len
)
return
POLARSSL_ERR_CIPHER_FULL_BLOCK_EXPECTED
;
return
(
POLARSSL_ERR_CIPHER_FULL_BLOCK_EXPECTED
)
;
return
0
;
return
(
0
)
;
}
ctx
->
add_padding
(
ctx
->
unprocessed_data
,
cipher_get_iv_size
(
ctx
),
...
...
@@ -644,9 +644,9 @@ int cipher_finish( cipher_context_t *ctx,
* or an empty block if no padding
*/
if
(
NULL
==
ctx
->
add_padding
&&
0
==
ctx
->
unprocessed_len
)
return
0
;
return
(
0
)
;
return
POLARSSL_ERR_CIPHER_FULL_BLOCK_EXPECTED
;
return
(
POLARSSL_ERR_CIPHER_FULL_BLOCK_EXPECTED
)
;
}
/* cipher block */
...
...
@@ -654,7 +654,7 @@ int cipher_finish( cipher_context_t *ctx,
ctx
->
operation
,
cipher_get_block_size
(
ctx
),
ctx
->
iv
,
ctx
->
unprocessed_data
,
output
)
)
)
{
return
ret
;
return
(
ret
)
;
}
/* Set output size for decryption */
...
...
@@ -664,13 +664,13 @@ int cipher_finish( cipher_context_t *ctx,
/* Set output size for encryption */
*
olen
=
cipher_get_block_size
(
ctx
);
return
0
;
return
(
0
)
;
}
#else
((
void
)
output
);
#endif
/* POLARSSL_CIPHER_MODE_CBC */
return
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
;
return
(
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
)
;
}
#if defined(POLARSSL_CIPHER_MODE_WITH_PADDING)
...
...
@@ -679,7 +679,7 @@ int cipher_set_padding_mode( cipher_context_t *ctx, cipher_padding_t mode )
if
(
NULL
==
ctx
||
POLARSSL_MODE_CBC
!=
ctx
->
cipher_info
->
mode
)
{
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
}
switch
(
mode
)
...
...
@@ -714,10 +714,10 @@ int cipher_set_padding_mode( cipher_context_t *ctx, cipher_padding_t mode )
break
;
default:
return
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
;
return
(
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
)
;
}
return
0
;
return
(
0
)
;
}
#endif
/* POLARSSL_CIPHER_MODE_WITH_PADDING */
...
...
@@ -726,17 +726,17 @@ int cipher_write_tag( cipher_context_t *ctx,
unsigned
char
*
tag
,
size_t
tag_len
)
{
if
(
NULL
==
ctx
||
NULL
==
ctx
->
cipher_info
||
NULL
==
tag
)
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
if
(
POLARSSL_ENCRYPT
!=
ctx
->
operation
)
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
#if defined(POLARSSL_GCM_C)
if
(
POLARSSL_MODE_GCM
==
ctx
->
cipher_info
->
mode
)
return
gcm_finish
(
(
gcm_context
*
)
ctx
->
cipher_ctx
,
tag
,
tag_len
);
#endif
return
0
;
return
(
0
)
;
}
int
cipher_check_tag
(
cipher_context_t
*
ctx
,
...
...
@@ -747,7 +747,7 @@ int cipher_check_tag( cipher_context_t *ctx,
if
(
NULL
==
ctx
||
NULL
==
ctx
->
cipher_info
||
POLARSSL_DECRYPT
!=
ctx
->
operation
)
{
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
}
#if defined(POLARSSL_GCM_C)
...
...
@@ -758,7 +758,7 @@ int cipher_check_tag( cipher_context_t *ctx,
int
diff
;
if
(
tag_len
>
sizeof
(
check_tag
)
)
return
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
;
return
(
POLARSSL_ERR_CIPHER_BAD_INPUT_DATA
)
;
if
(
0
!=
(
ret
=
gcm_finish
(
(
gcm_context
*
)
ctx
->
cipher_ctx
,
check_tag
,
tag_len
)
)
)
...
...
library/cipher_wrap.c
View file @
d8bb8266
...
...
@@ -129,7 +129,7 @@ static int aes_crypt_cbc_wrap( void *ctx, operation_t operation, size_t length,
((
void
)
input
);
((
void
)
output
);
return
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
;
return
(
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
)
;
#endif
/* POLARSSL_CIPHER_MODE_CBC */
}
...
...
@@ -149,7 +149,7 @@ static int aes_crypt_cfb128_wrap( void *ctx, operation_t operation,
((
void
)
input
);
((
void
)
output
);
return
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
;
return
(
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
)
;
#endif
/* POLARSSL_CIPHER_MODE_CFB */
}
...
...
@@ -169,7 +169,7 @@ static int aes_crypt_ctr_wrap( void *ctx, size_t length, size_t *nc_off,
((
void
)
input
);
((
void
)
output
);
return
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
;
return
(
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
)
;
#endif
/* POLARSSL_CIPHER_MODE_CTR */
}
...
...
@@ -483,7 +483,7 @@ static int camellia_crypt_cbc_wrap( void *ctx, operation_t operation,
((
void
)
input
);
((
void
)
output
);
return
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
;
return
(
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
)
;
#endif
/* POLARSSL_CIPHER_MODE_CBC */
}
...
...
@@ -503,7 +503,7 @@ static int camellia_crypt_cfb128_wrap( void *ctx, operation_t operation,
((
void
)
input
);
((
void
)
output
);
return
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
;
return
(
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
)
;
#endif
/* POLARSSL_CIPHER_MODE_CFB */
}
...
...
@@ -523,7 +523,7 @@ static int camellia_crypt_ctr_wrap( void *ctx, size_t length, size_t *nc_off,
((
void
)
input
);
((
void
)
output
);
return
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
;
return
(
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
)
;
#endif
/* POLARSSL_CIPHER_MODE_CTR */
}
...
...
@@ -843,7 +843,7 @@ static int des_crypt_cbc_wrap( void *ctx, operation_t operation, size_t length,
((
void
)
input
);
((
void
)
output
);
return
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
;
return
(
POLARSSL_ERR_CIPHER_FEATURE_UNAVAILABLE
)
;
#endif
/* POLARSSL_CIPHER_MODE_CBC */
}
...
...
@@ -861,7 +861,7 @@ static int des3_crypt_cbc_wrap( void *ctx, operation_t operation, size_t length,
((
void
)
input
);