summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorFdaSilvaYY <fdasilvayy@gmail.com>2016-06-29 00:18:50 +0200
committerRich Salz <rsalz@openssl.org>2016-07-20 07:21:53 -0400
commite8aa8b6c8f6d4e2b2bbd5e5721d977b0a6aa3cee (patch)
tree9112c06d1c60edbbe94b3407f33538a0f9bf1c97 /crypto
parentc106eaa8ed7c24900e4367fc85cae1a77bc4e5ae (diff)
Fix a few if(, for(, while( inside code.
Fix some indentation at the same time Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1292)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/aes/aes_core.c8
-rw-r--r--crypto/async/arch/async_win.c2
-rw-r--r--crypto/async/async.c4
-rw-r--r--crypto/bio/bss_mem.c8
-rw-r--r--crypto/bn/bn_lcl.h30
-rw-r--r--crypto/include/internal/evp_int.h37
-rw-r--r--crypto/o_fopen.c2
-rw-r--r--crypto/x509/x_x509a.c2
8 files changed, 49 insertions, 44 deletions
diff --git a/crypto/aes/aes_core.c b/crypto/aes/aes_core.c
index 69be3d85c7..bd5c7793be 100644
--- a/crypto/aes/aes_core.c
+++ b/crypto/aes/aes_core.c
@@ -644,9 +644,9 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
rk = key->rd_key;
- if (bits==128)
+ if (bits == 128)
key->rounds = 10;
- else if (bits==192)
+ else if (bits == 192)
key->rounds = 12;
else
key->rounds = 14;
@@ -1222,9 +1222,9 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
rk = key->rd_key;
- if (bits==128)
+ if (bits == 128)
key->rounds = 10;
- else if (bits==192)
+ else if (bits == 192)
key->rounds = 12;
else
key->rounds = 14;
diff --git a/crypto/async/arch/async_win.c b/crypto/async/arch/async_win.c
index 37a3111052..077d56ced0 100644
--- a/crypto/async/arch/async_win.c
+++ b/crypto/async/arch/async_win.c
@@ -25,7 +25,7 @@ void async_local_cleanup(void)
async_ctx *ctx = async_get_ctx();
if (ctx != NULL) {
async_fibre *fibre = &ctx->dispatcher;
- if(fibre != NULL && fibre->fibre != NULL && fibre->converted) {
+ if (fibre != NULL && fibre->fibre != NULL && fibre->converted) {
ConvertFiberToThread();
fibre->fibre = NULL;
}
diff --git a/crypto/async/async.c b/crypto/async/async.c
index 965a1954f9..8c699af78e 100644
--- a/crypto/async/async.c
+++ b/crypto/async/async.c
@@ -396,7 +396,7 @@ ASYNC_JOB *ASYNC_get_current_job(void)
async_ctx *ctx;
ctx = async_get_ctx();
- if(ctx == NULL)
+ if (ctx == NULL)
return NULL;
return ctx->currjob;
@@ -428,6 +428,6 @@ void ASYNC_unblock_pause(void)
*/
return;
}
- if(ctx->blocked > 0)
+ if (ctx->blocked > 0)
ctx->blocked--;
}
diff --git a/crypto/bio/bss_mem.c b/crypto/bio/bss_mem.c
index 80da3a1e09..a61ab7cc64 100644
--- a/crypto/bio/bss_mem.c
+++ b/crypto/bio/bss_mem.c
@@ -144,12 +144,12 @@ static int mem_buf_free(BIO *a, int free_all)
BUF_MEM *b;
BIO_BUF_MEM *bb = (BIO_BUF_MEM *)a->ptr;
- if(bb != NULL) {
+ if (bb != NULL) {
b = bb->buf;
if (a->flags & BIO_FLAGS_MEM_RDONLY)
b->data = NULL;
BUF_MEM_free(b);
- if(free_all) {
+ if (free_all) {
OPENSSL_free(bb->readp);
OPENSSL_free(bb);
}
@@ -165,10 +165,10 @@ static int mem_buf_free(BIO *a, int free_all)
*/
static int mem_buf_sync(BIO *b)
{
- if((b != NULL) && (b->init) && (b->ptr != NULL)) {
+ if (b != NULL && b->init != 0 && b->ptr != NULL) {
BIO_BUF_MEM *bbm = (BIO_BUF_MEM *)b->ptr;
- if(bbm->readp->data != bbm->buf->data) {
+ if (bbm->readp->data != bbm->buf->data) {
memmove(bbm->buf->data, bbm->readp->data, bbm->readp->length);
bbm->buf->length = bbm->readp->length;
bbm->readp->data = bbm->buf->data;
diff --git a/crypto/bn/bn_lcl.h b/crypto/bn/bn_lcl.h
index ebf17b068d..157dadc872 100644
--- a/crypto/bn/bn_lcl.h
+++ b/crypto/bn/bn_lcl.h
@@ -157,18 +157,18 @@ int RAND_pseudo_bytes(unsigned char *buf, int num);
# endif
# define bn_pollute(a) \
do { \
- const BIGNUM *_bnum1 = (a); \
- if(_bnum1->top < _bnum1->dmax) { \
- unsigned char _tmp_char; \
- /* We cast away const without the compiler knowing, any \
- * *genuinely* constant variables that aren't mutable \
- * wouldn't be constructed with top!=dmax. */ \
- BN_ULONG *_not_const; \
- memcpy(&_not_const, &_bnum1->d, sizeof(_not_const)); \
- RAND_bytes(&_tmp_char, 1); /* Debug only - safe to ignore error return */\
- memset(_not_const + _bnum1->top, _tmp_char, \
- sizeof(*_not_const) * (_bnum1->dmax - _bnum1->top)); \
- } \
+ const BIGNUM *_bnum1 = (a); \
+ if (_bnum1->top < _bnum1->dmax) { \
+ unsigned char _tmp_char; \
+ /* We cast away const without the compiler knowing, any \
+ * *genuinely* constant variables that aren't mutable \
+ * wouldn't be constructed with top!=dmax. */ \
+ BN_ULONG *_not_const; \
+ memcpy(&_not_const, &_bnum1->d, sizeof(_not_const)); \
+ RAND_bytes(&_tmp_char, 1); /* Debug only - safe to ignore error return */\
+ memset(_not_const + _bnum1->top, _tmp_char, \
+ sizeof(*_not_const) * (_bnum1->dmax - _bnum1->top)); \
+ } \
} while(0)
# ifdef BN_DEBUG_TRIX
# undef RAND_pseudo_bytes
@@ -257,9 +257,9 @@ struct bn_gencb_st {
unsigned int ver; /* To handle binary (in)compatibility */
void *arg; /* callback-specific data */
union {
- /* if(ver==1) - handles old style callbacks */
+ /* if (ver==1) - handles old style callbacks */
void (*cb_1) (int, int, void *);
- /* if(ver==2) - new callback style */
+ /* if (ver==2) - new callback style */
int (*cb_2) (int, int, BN_GENCB *);
} cb;
};
@@ -678,7 +678,7 @@ static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
if (bits > (INT_MAX - BN_BITS2 + 1))
return NULL;
- if(((bits+BN_BITS2-1)/BN_BITS2) <= (a)->dmax)
+ if (((bits+BN_BITS2-1)/BN_BITS2) <= (a)->dmax)
return a;
return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2);
diff --git a/crypto/include/internal/evp_int.h b/crypto/include/internal/evp_int.h
index 1c35319921..2e4ca02eab 100644
--- a/crypto/include/internal/evp_int.h
+++ b/crypto/include/internal/evp_int.h
@@ -138,9 +138,9 @@ struct evp_cipher_st {
#define BLOCK_CIPHER_ecb_loop() \
size_t i, bl; \
bl = EVP_CIPHER_CTX_cipher(ctx)->block_size; \
- if(inl < bl) return 1;\
+ if (inl < bl) return 1;\
inl -= bl; \
- for(i=0; i <= inl; i+=bl)
+ for (i=0; i <= inl; i+=bl)
#define BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
static int cname##_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
@@ -189,20 +189,25 @@ static int cname##_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const uns
#define BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \
static int cname##_cfb##cbits##_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) \
{\
- size_t chunk=EVP_MAXCHUNK;\
- if (cbits==1) chunk>>=3;\
- if (inl<chunk) chunk=inl;\
- while(inl && inl>=chunk)\
- {\
- int num = EVP_CIPHER_CTX_num(ctx);\
- cprefix##_cfb##cbits##_encrypt(in, out, (long)((cbits==1) && !EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS) ?inl*8:inl), &EVP_C_DATA(kstruct,ctx)->ksched, EVP_CIPHER_CTX_iv_noconst(ctx), &num, EVP_CIPHER_CTX_encrypting(ctx)); \
- EVP_CIPHER_CTX_set_num(ctx, num);\
- inl-=chunk;\
- in +=chunk;\
- out+=chunk;\
- if(inl<chunk) chunk=inl;\
- }\
- return 1;\
+ size_t chunk = EVP_MAXCHUNK;\
+ if (cbits == 1) chunk >>= 3;\
+ if (inl < chunk) chunk = inl;\
+ while (inl && inl >= chunk)\
+ {\
+ int num = EVP_CIPHER_CTX_num(ctx);\
+ cprefix##_cfb##cbits##_encrypt(in, out, (long) \
+ ((cbits == 1) \
+ && !EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS) \
+ ? inl*8 : inl), \
+ &EVP_C_DATA(kstruct, ctx)->ksched, EVP_CIPHER_CTX_iv_noconst(ctx),\
+ &num, EVP_CIPHER_CTX_encrypting(ctx));\
+ EVP_CIPHER_CTX_set_num(ctx, num);\
+ inl -= chunk;\
+ in += chunk;\
+ out += chunk;\
+ if (inl < chunk) chunk = inl;\
+ }\
+ return 1;\
}
#define BLOCK_CIPHER_all_funcs(cname, cprefix, cbits, kstruct, ksched) \
diff --git a/crypto/o_fopen.c b/crypto/o_fopen.c
index 0bdb53fe53..a3a006574d 100644
--- a/crypto/o_fopen.c
+++ b/crypto/o_fopen.c
@@ -69,7 +69,7 @@ FILE *openssl_fopen(const char *filename, const char *mode)
if (newname == NULL)
return NULL;
- for(iterator = newname, lastchar = '\0';
+ for (iterator = newname, lastchar = '\0';
*filename; filename++, iterator++) {
if (lastchar == '/' && filename[0] == '.'
&& filename[1] != '.' && filename[1] != '/') {
diff --git a/crypto/x509/x_x509a.c b/crypto/x509/x_x509a.c
index 2efa214cb2..67b01a72a8 100644
--- a/crypto/x509/x_x509a.c
+++ b/crypto/x509/x_x509a.c
@@ -76,7 +76,7 @@ int X509_keyid_set1(X509 *x, unsigned char *id, int len)
}
if ((aux = aux_get(x)) == NULL)
return 0;
- if (aux->keyid ==NULL
+ if (aux->keyid == NULL
&& (aux->keyid = ASN1_OCTET_STRING_new()) == NULL)
return 0;
return ASN1_STRING_set(aux->keyid, id, len);