diff options
Diffstat (limited to 'plugins/MirOTR/libgcrypt-1.4.6/cipher')
20 files changed, 122 insertions, 122 deletions
diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/arcfour.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/arcfour.c index 6bb0555c60..eab52a4714 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/arcfour.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/arcfour.c @@ -84,13 +84,13 @@ do_arcfour_setkey (void *context, const byte *key, unsigned int keylen) { initialized = 1; selftest_failed = selftest(); - if( selftest_failed ) + if ( selftest_failed ) log_error ("ARCFOUR selftest failed (%s)\n", selftest_failed ); } - if( selftest_failed ) + if ( selftest_failed ) return GPG_ERR_SELFTEST_FAILED; - if( keylen < 40/8 ) /* we want at least 40 bits */ + if ( keylen < 40/8 ) /* we want at least 40 bits */ return GPG_ERR_INV_KEYLEN; ctx->idx_i = ctx->idx_j = 0; diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/blowfish.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/blowfish.c index 6ef68e371d..de89b59271 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/blowfish.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/blowfish.c @@ -475,18 +475,18 @@ selftest(void) bf_setkey( (void *) &c, (const unsigned char*)"abcdefghijklmnopqrstuvwxyz", 26 ); encrypt_block( (void *) &c, buffer, plain ); - if( memcmp( buffer, "\x32\x4E\xD0\xFE\xF4\x13\xA2\x03", 8 ) ) + if ( memcmp( buffer, "\x32\x4E\xD0\xFE\xF4\x13\xA2\x03", 8 ) ) return "Blowfish selftest failed (1)."; decrypt_block( (void *) &c, buffer, buffer ); - if( memcmp( buffer, plain, 8 ) ) + if ( memcmp( buffer, plain, 8 ) ) return "Blowfish selftest failed (2)."; bf_setkey( (void *) &c, key3, 8 ); encrypt_block( (void *) &c, buffer, plain3 ); - if( memcmp( buffer, cipher3, 8 ) ) + if ( memcmp( buffer, cipher3, 8 ) ) return "Blowfish selftest failed (3)."; decrypt_block( (void *) &c, buffer, buffer ); - if( memcmp( buffer, plain3, 8 ) ) + if ( memcmp( buffer, plain3, 8 ) ) return "Blowfish selftest failed (4)."; return NULL; } @@ -501,14 +501,14 @@ do_bf_setkey (BLOWFISH_context *c, const byte *key, unsigned keylen) static int initialized; static const char *selftest_failed; - if( !initialized ) + if ( !initialized ) { initialized = 1; selftest_failed = selftest(); - if( selftest_failed ) + if ( selftest_failed ) log_error ("%s\n", selftest_failed ); } - if( selftest_failed ) + if ( selftest_failed ) return GPG_ERR_SELFTEST_FAILED; for(i=0; i < BLOWFISH_ROUNDS+2; i++ ) @@ -575,9 +575,9 @@ do_bf_setkey (BLOWFISH_context *c, const byte *key, unsigned keylen) the P-array (here c) occurs more than once per table. */ for(i=0; i < 255; i++ ) { - for( j=i+1; j < 256; j++) + for ( j=i+1; j < 256; j++) { - if( (c->s0[i] == c->s0[j]) || (c->s1[i] == c->s1[j]) || + if ( (c->s0[i] == c->s0[j]) || (c->s1[i] == c->s1[j]) || (c->s2[i] == c->s2[j]) || (c->s3[i] == c->s3[j]) ) return GPG_ERR_WEAK_KEY; } diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/camellia-glue.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/camellia-glue.c index 067af85bca..99174c55f1 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/camellia-glue.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/camellia-glue.c @@ -81,7 +81,7 @@ camellia_setkey(void *c, const byte *key, unsigned keylen) if(keylen!=16 && keylen!=24 && keylen!=32) return GPG_ERR_INV_KEYLEN; - if(!initialized) + if (!initialized) { initialized=1; selftest_failed=selftest(); diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/cast5.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/cast5.c index 333d55e91f..a532acfd4d 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/cast5.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/cast5.c @@ -476,10 +476,10 @@ selftest(void) cast_setkey( &c, key, 16 ); encrypt_block( &c, buffer, plain ); - if( memcmp( buffer, cipher, 8 ) ) + if ( memcmp( buffer, cipher, 8 ) ) return "1"; decrypt_block( &c, buffer, buffer ); - if( memcmp( buffer, plain, 8 ) ) + if ( memcmp( buffer, plain, 8 ) ) return "2"; #if 0 /* full maintenance test */ @@ -502,7 +502,7 @@ selftest(void) encrypt_block( &c, b0, b0 ); encrypt_block( &c, b0+8, b0+8 ); } - if( memcmp( a0, a1, 16 ) || memcmp( b0, b1, 16 ) ) + if ( memcmp( a0, a1, 16 ) || memcmp( b0, b1, 16 ) ) return "3"; } @@ -569,17 +569,17 @@ do_cast_setkey( CAST5_context *c, const byte *key, unsigned keylen ) u32 z[4]; u32 k[16]; - if( !initialized ) + if ( !initialized ) { initialized = 1; selftest_failed = selftest(); - if( selftest_failed ) + if ( selftest_failed ) log_error ("CAST5 selftest failed (%s).\n", selftest_failed ); } - if( selftest_failed ) + if ( selftest_failed ) return GPG_ERR_SELFTEST_FAILED; - if( keylen != 16 ) + if ( keylen != 16 ) return GPG_ERR_INV_KEYLEN; x[0] = key[0] << 24 | key[1] << 16 | key[2] << 8 | key[3]; diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/cipher.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/cipher.c index 8cfe54fce1..7594ee593a 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/cipher.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/cipher.c @@ -1294,7 +1294,7 @@ do_ofb_encrypt( gcry_cipher_hd_t c, return; } - if( c->unused ) + if ( c->unused ) { nbytes -= c->unused; for(ivp=c->u_iv.iv+blocksize - c->unused; c->unused; c->unused-- ) @@ -1331,7 +1331,7 @@ do_ofb_decrypt( gcry_cipher_hd_t c, byte *ivp; size_t blocksize = c->cipher->blocksize; - if( nbytes <= c->unused ) + if ( nbytes <= c->unused ) { /* Short enough to be encoded by the remaining XOR mask. */ for (ivp=c->u_iv.iv+blocksize - c->unused; nbytes; nbytes--,c->unused--) @@ -1874,7 +1874,7 @@ gcry_cipher_ctl( gcry_cipher_hd_t h, int cmd, void *buffer, size_t buflen) case GCRYCTL_DISABLE_ALGO: /* This command expects NULL for H and BUFFER to point to an integer with the algo number. */ - if( h || !buffer || buflen != sizeof(int) ) + if ( h || !buffer || buflen != sizeof(int) ) return gcry_error (GPG_ERR_CIPHER_ALGO); disable_cipher_algo( *(int*)buffer ); break; diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/des.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/des.c index f91df77713..3dfd27812e 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/des.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/des.c @@ -129,8 +129,8 @@ static int working_memcmp( const char *a, const char *b, size_t n ) { - for( ; n; n--, a++, b++ ) - if( *a != *b ) + for ( ; n; n--, a++, b++ ) + if ( *a != *b ) return (int)(*(byte*)a) - (int)(*(byte*)b); return 0; } @@ -1012,7 +1012,7 @@ do_tripledes_setkey ( void *context, const byte *key, unsigned keylen ) { struct _tripledes_ctx *ctx = (struct _tripledes_ctx *) context; - if( keylen != 24 ) + if ( keylen != 24 ) return GPG_ERR_INV_KEYLEN; tripledes_set3keys ( ctx, key, key+8, key+16); diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/dsa.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/dsa.c index ceb94965c5..24e07b59ab 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/dsa.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/dsa.c @@ -145,7 +145,7 @@ gen_k( gcry_mpi_t q ) log_debug("choosing a random k "); for (;;) { - if( DBG_CIPHER ) + if ( DBG_CIPHER ) progress('.'); if ( !rndbuf || nbits < 32 ) @@ -171,22 +171,22 @@ gen_k( gcry_mpi_t q ) mpi_clear_bit( k, nbits-1 ); } - if( !(mpi_cmp( k, q ) < 0) ) /* check: k < q */ + if ( !(mpi_cmp( k, q ) < 0) ) /* check: k < q */ { - if( DBG_CIPHER ) + if ( DBG_CIPHER ) progress('+'); continue; /* no */ } - if( !(mpi_cmp_ui( k, 0 ) > 0) ) /* check: k > 0 */ + if ( !(mpi_cmp_ui( k, 0 ) > 0) ) /* check: k > 0 */ { - if( DBG_CIPHER ) + if ( DBG_CIPHER ) progress('-'); continue; /* no */ } break; /* okay */ } gcry_free(rndbuf); - if( DBG_CIPHER ) + if ( DBG_CIPHER ) progress('\n'); return k; @@ -332,9 +332,9 @@ generate (DSA_secret_key *sk, unsigned int nbits, unsigned int qbits, rndbuf = NULL; do { - if( DBG_CIPHER ) + if ( DBG_CIPHER ) progress('.'); - if( !rndbuf ) + if ( !rndbuf ) rndbuf = gcry_random_bytes_secure ((qbits+7)/8, random_level); else { /* Change only some of the higher bits (= 2 bytes)*/ @@ -355,7 +355,7 @@ generate (DSA_secret_key *sk, unsigned int nbits, unsigned int qbits, y = mpi_alloc( mpi_get_nlimbs(p) ); gcry_mpi_powm( y, g, x, p ); - if( DBG_CIPHER ) + if ( DBG_CIPHER ) { progress('\n'); log_mpidump("dsa p", p ); @@ -508,7 +508,7 @@ generate_fips186 (DSA_secret_key *sk, unsigned int nbits, unsigned int qbits, value_x = gcry_mpi_snew (qbits); do { - if( DBG_CIPHER ) + if ( DBG_CIPHER ) progress('.'); gcry_mpi_randomize (value_x, qbits, GCRY_VERY_STRONG_RANDOM); mpi_clear_highbit (value_x, qbits+1); @@ -634,9 +634,9 @@ verify (gcry_mpi_t r, gcry_mpi_t s, gcry_mpi_t hash, DSA_public_key *pkey ) gcry_mpi_t base[3]; gcry_mpi_t ex[3]; - if( !(mpi_cmp_ui( r, 0 ) > 0 && mpi_cmp( r, pkey->q ) < 0) ) + if ( !(mpi_cmp_ui( r, 0 ) > 0 && mpi_cmp( r, pkey->q ) < 0) ) return 0; /* assertion 0 < r < q failed */ - if( !(mpi_cmp_ui( s, 0 ) > 0 && mpi_cmp( s, pkey->q ) < 0) ) + if ( !(mpi_cmp_ui( s, 0 ) > 0 && mpi_cmp( s, pkey->q ) < 0) ) return 0; /* assertion 0 < s < q failed */ w = mpi_alloc( mpi_get_nlimbs(pkey->q) ); diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/ecc.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/ecc.c index fcbd8e3a9d..fec7e86ee6 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/ecc.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/ecc.c @@ -760,9 +760,9 @@ verify (gcry_mpi_t input, ECC_public_key *pkey, gcry_mpi_t r, gcry_mpi_t s) mpi_point_t Q, Q1, Q2; mpi_ec_t ctx; - if( !(mpi_cmp_ui (r, 0) > 0 && mpi_cmp (r, pkey->E.n) < 0) ) + if ( !(mpi_cmp_ui (r, 0) > 0 && mpi_cmp (r, pkey->E.n) < 0) ) return GPG_ERR_BAD_SIGNATURE; /* Assertion 0 < r < n failed. */ - if( !(mpi_cmp_ui (s, 0) > 0 && mpi_cmp (s, pkey->E.n) < 0) ) + if ( !(mpi_cmp_ui (s, 0) > 0 && mpi_cmp (s, pkey->E.n) < 0) ) return GPG_ERR_BAD_SIGNATURE; /* Assertion 0 < s < n failed. */ h = mpi_alloc (0); diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/elgamal.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/elgamal.c index 0b0c07cb4b..776d7a52c2 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/elgamal.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/elgamal.c @@ -117,7 +117,7 @@ wiener_map( unsigned int n ) for(i=0; t[i].p_n; i++ ) { - if( n <= t[i].p_n ) + if ( n <= t[i].p_n ) return t[i].q_n; } /* Not in table - use an arbitrary high number. */ @@ -188,7 +188,7 @@ gen_k( gcry_mpi_t p, int small_k ) * it greatly improves the encryption performance. We use * Wiener's table and add a large safety margin. */ nbits = wiener_map( orig_nbits ) * 3 / 2; - if( nbits >= orig_nbits ) + if ( nbits >= orig_nbits ) BUG(); } else @@ -196,12 +196,12 @@ gen_k( gcry_mpi_t p, int small_k ) nbytes = (nbits+7)/8; - if( DBG_CIPHER ) + if ( DBG_CIPHER ) log_debug("choosing a random k "); mpi_sub_ui( p_1, p, 1); - for(;;) + for (;;) { - if( !rndbuf || nbits < 32 ) + if ( !rndbuf || nbits < 32 ) { gcry_free(rndbuf); rndbuf = gcry_random_bytes_secure( nbytes, GCRY_STRONG_RANDOM ); @@ -219,30 +219,30 @@ gen_k( gcry_mpi_t p, int small_k ) } _gcry_mpi_set_buffer( k, rndbuf, nbytes, 0 ); - for(;;) + for (;;) { - if( !(mpi_cmp( k, p_1 ) < 0) ) /* check: k < (p-1) */ + if ( !(mpi_cmp( k, p_1 ) < 0) ) /* check: k < (p-1) */ { - if( DBG_CIPHER ) + if ( DBG_CIPHER ) progress('+'); break; /* no */ } - if( !(mpi_cmp_ui( k, 0 ) > 0) ) /* check: k > 0 */ + if ( !(mpi_cmp_ui( k, 0 ) > 0) ) /* check: k > 0 */ { - if( DBG_CIPHER ) + if ( DBG_CIPHER ) progress('-'); break; /* no */ } if (gcry_mpi_gcd( temp, k, p_1 )) goto found; /* okay, k is relative prime to (p-1) */ mpi_add_ui( k, k, 1 ); - if( DBG_CIPHER ) + if ( DBG_CIPHER ) progress('.'); } } found: gcry_free(rndbuf); - if( DBG_CIPHER ) + if ( DBG_CIPHER ) progress('\n'); mpi_free(p_1); mpi_free(temp); @@ -269,7 +269,7 @@ generate ( ELG_secret_key *sk, unsigned int nbits, gcry_mpi_t **ret_factors ) p_min1 = gcry_mpi_new ( nbits ); qbits = wiener_map( nbits ); - if( qbits & 1 ) /* better have a even one */ + if ( qbits & 1 ) /* better have a even one */ qbits++; g = mpi_alloc(1); p = _gcry_generate_elg_prime( 0, nbits, qbits, g, ret_factors ); @@ -288,19 +288,19 @@ generate ( ELG_secret_key *sk, unsigned int nbits, gcry_mpi_t **ret_factors ) * will be much faster with such an x. */ xbits = qbits * 3 / 2; - if( xbits >= nbits ) + if ( xbits >= nbits ) BUG(); x = gcry_mpi_snew ( xbits ); - if( DBG_CIPHER ) + if ( DBG_CIPHER ) log_debug("choosing a random x of size %u", xbits ); rndbuf = NULL; do { - if( DBG_CIPHER ) + if ( DBG_CIPHER ) progress('.'); - if( rndbuf ) + if ( rndbuf ) { /* Change only some of the higher bits */ - if( xbits < 16 ) /* should never happen ... */ + if ( xbits < 16 ) /* should never happen ... */ { gcry_free(rndbuf); rndbuf = gcry_random_bytes_secure( (xbits+7)/8, @@ -328,7 +328,7 @@ generate ( ELG_secret_key *sk, unsigned int nbits, gcry_mpi_t **ret_factors ) y = gcry_mpi_new (nbits); gcry_mpi_powm( y, g, x, p ); - if( DBG_CIPHER ) + if ( DBG_CIPHER ) { progress('\n'); log_mpidump("elg p= ", p ); @@ -467,7 +467,7 @@ do_encrypt(gcry_mpi_t a, gcry_mpi_t b, gcry_mpi_t input, ELG_public_key *pkey ) gcry_mpi_powm( b, pkey->y, k, pkey->p ); gcry_mpi_mulm( b, b, input, pkey->p ); #if 0 - if( DBG_CIPHER ) + if ( DBG_CIPHER ) { log_mpidump("elg encrypted y= ", pkey->y); log_mpidump("elg encrypted p= ", pkey->p); @@ -493,7 +493,7 @@ decrypt(gcry_mpi_t output, gcry_mpi_t a, gcry_mpi_t b, ELG_secret_key *skey ) mpi_invm( t1, t1, skey->p ); mpi_mulm( output, b, t1, skey->p ); #if 0 - if( DBG_CIPHER ) + if ( DBG_CIPHER ) { log_mpidump("elg decrypted x= ", skey->x); log_mpidump("elg decrypted p= ", skey->p); @@ -533,7 +533,7 @@ sign(gcry_mpi_t a, gcry_mpi_t b, gcry_mpi_t input, ELG_secret_key *skey ) mpi_mulm(b, t, inv, p_1 ); #if 0 - if( DBG_CIPHER ) + if ( DBG_CIPHER ) { log_mpidump("elg sign p= ", skey->p); log_mpidump("elg sign g= ", skey->g); @@ -564,7 +564,7 @@ verify(gcry_mpi_t a, gcry_mpi_t b, gcry_mpi_t input, ELG_public_key *pkey ) gcry_mpi_t base[4]; gcry_mpi_t ex[4]; - if( !(mpi_cmp_ui( a, 0 ) > 0 && mpi_cmp( a, pkey->p ) < 0) ) + if ( !(mpi_cmp_ui( a, 0 ) > 0 && mpi_cmp( a, pkey->p ) < 0) ) return 0; /* assertion 0 < a < p failed */ t1 = mpi_alloc( mpi_get_nlimbs(a) ); diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/md4.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/md4.c index 680cf87f5d..ce277fa4f5 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/md4.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/md4.c @@ -197,22 +197,22 @@ md4_write ( void *context, const void *inbuf_arg, size_t inlen) const unsigned char *inbuf = inbuf_arg; MD4_CONTEXT *hd = context; - if( hd->count == 64 ) /* flush the buffer */ + if ( hd->count == 64 ) /* flush the buffer */ { transform( hd, hd->buf ); _gcry_burn_stack (80+6*sizeof(void*)); hd->count = 0; hd->nblocks++; } - if( !inbuf ) + if ( !inbuf ) return; - if( hd->count ) + if ( hd->count ) { - for( ; inlen && hd->count < 64; inlen-- ) + for ( ; inlen && hd->count < 64; inlen-- ) hd->buf[hd->count++] = *inbuf++; md4_write( hd, NULL, 0 ); - if( !inlen ) + if ( !inlen ) return; } _gcry_burn_stack (80+6*sizeof(void*)); @@ -225,7 +225,7 @@ md4_write ( void *context, const void *inbuf_arg, size_t inlen) inlen -= 64; inbuf += 64; } - for( ; inlen && hd->count < 64; inlen-- ) + for ( ; inlen && hd->count < 64; inlen-- ) hd->buf[hd->count++] = *inbuf++; } @@ -252,7 +252,7 @@ md4_final( void *context ) msb = t >> 26; /* add the count */ t = lsb; - if( (lsb += hd->count) < t ) + if ( (lsb += hd->count) < t ) msb++; /* multiply by 8 to make a bit count */ t = lsb; @@ -260,7 +260,7 @@ md4_final( void *context ) msb <<= 3; msb |= t >> 29; - if( hd->count < 56 ) /* enough room */ + if ( hd->count < 56 ) /* enough room */ { hd->buf[hd->count++] = 0x80; /* pad */ while( hd->count < 56 ) diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/md5.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/md5.c index 899dce89ad..d57a6b7838 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/md5.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/md5.c @@ -222,22 +222,22 @@ md5_write( void *context, const void *inbuf_arg , size_t inlen) const unsigned char *inbuf = inbuf_arg; MD5_CONTEXT *hd = context; - if( hd->count == 64 ) /* flush the buffer */ + if ( hd->count == 64 ) /* flush the buffer */ { transform( hd, hd->buf ); _gcry_burn_stack (80+6*sizeof(void*)); hd->count = 0; hd->nblocks++; } - if( !inbuf ) + if ( !inbuf ) return; - if( hd->count ) + if ( hd->count ) { - for( ; inlen && hd->count < 64; inlen-- ) + for ( ; inlen && hd->count < 64; inlen-- ) hd->buf[hd->count++] = *inbuf++; md5_write( hd, NULL, 0 ); - if( !inlen ) + if ( !inlen ) return; } _gcry_burn_stack (80+6*sizeof(void*)); @@ -250,7 +250,7 @@ md5_write( void *context, const void *inbuf_arg , size_t inlen) inlen -= 64; inbuf += 64; } - for( ; inlen && hd->count < 64; inlen-- ) + for ( ; inlen && hd->count < 64; inlen-- ) hd->buf[hd->count++] = *inbuf++; } @@ -278,7 +278,7 @@ md5_final( void *context) msb = t >> 26; /* add the count */ t = lsb; - if( (lsb += hd->count) < t ) + if ( (lsb += hd->count) < t ) msb++; /* multiply by 8 to make a bit count */ t = lsb; @@ -286,7 +286,7 @@ md5_final( void *context) msb <<= 3; msb |= t >> 29; - if( hd->count < 56 ) /* enough room */ + if ( hd->count < 56 ) /* enough room */ { hd->buf[hd->count++] = 0x80; /* pad */ while( hd->count < 56 ) diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/primegen.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/primegen.c index b869bee839..c9b5414501 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/primegen.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/primegen.c @@ -936,7 +936,7 @@ is_prime (gcry_mpi_t n, int steps, unsigned int *count) for (i=0 ; i < steps; i++ ) { ++*count; - if( !i ) + if ( !i ) { mpi_set_ui( x, 2 ); } @@ -963,7 +963,7 @@ is_prime (gcry_mpi_t n, int steps, unsigned int *count) for ( j=1; j < k && mpi_cmp( y, nminus1 ); j++ ) { gcry_mpi_powm(y, y, a2, n); - if( !mpi_cmp_ui( y, 1 ) ) + if ( !mpi_cmp_ui( y, 1 ) ) goto leave; /* Not a prime. */ } if (mpi_cmp( y, nminus1 ) ) @@ -1005,18 +1005,18 @@ m_out_of_n ( char *array, int m, int n ) { int i=0, i1=0, j=0, jp=0, j1=0, k1=0, k2=0; - if( !m || m >= n ) + if ( !m || m >= n ) return; /* Need to handle this simple case separately. */ - if( m == 1 ) + if ( m == 1 ) { for (i=0; i < n; i++ ) { if ( array[i] ) { array[i++] = 0; - if( i >= n ) + if ( i >= n ) i = 0; array[i] = 1; return; @@ -1037,25 +1037,25 @@ m_out_of_n ( char *array, int m, int n ) if ( (m & 1) ) { /* M is odd. */ - if( array[n-1] ) + if ( array[n-1] ) { - if( j1 & 1 ) + if ( j1 & 1 ) { k1 = n - j1; k2 = k1+2; - if( k2 > n ) + if ( k2 > n ) k2 = n; goto leave; } goto scan; } k2 = n - j1 - 1; - if( k2 == 0 ) + if ( k2 == 0 ) { k1 = i; k2 = n - j1; } - else if( array[k2] && array[k2-1] ) + else if ( array[k2] && array[k2-1] ) k1 = n; else k1 = k2 + 1; @@ -1063,18 +1063,18 @@ m_out_of_n ( char *array, int m, int n ) else { /* M is even. */ - if( !array[n-1] ) + if ( !array[n-1] ) { k1 = n - j1; k2 = k1 + 1; goto leave; } - if( !(j1 & 1) ) + if ( !(j1 & 1) ) { k1 = n - j1; k2 = k1+2; - if( k2 > n ) + if ( k2 > n ) k2 = n; goto leave; } @@ -1083,9 +1083,9 @@ m_out_of_n ( char *array, int m, int n ) for (i=1; i <= jp; i++ ) { i1 = jp + 2 - i; - if( array[i1-1] ) + if ( array[i1-1] ) { - if( array[i1-2] ) + if ( array[i1-2] ) { k1 = i1 - 1; k2 = n - j1; diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/pubkey.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/pubkey.c index 08abcbfdec..b888d4b936 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/pubkey.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/pubkey.c @@ -1518,7 +1518,7 @@ sexp_data_to_mpi (gcry_sexp_t input, unsigned int nbits, gcry_mpi_t *ret_mpi, the given algorithm. */ rc = GPG_ERR_CONFLICT; } - else if( !dlen || dlen + asnlen + 4 > nframe) + else if ( !dlen || dlen + asnlen + 4 > nframe) { /* Can't encode an DLEN byte digest MD into a NFRAME byte frame. */ diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/rijndael.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/rijndael.c index d43b349b41..0c092f78aa 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/rijndael.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/rijndael.c @@ -134,7 +134,7 @@ do_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen) ctx->use_padlock = 0; #endif - if( keylen == 128/8 ) + if ( keylen == 128/8 ) { ROUNDS = 10; KC = 4; diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/rmd160.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/rmd160.c index 7805bf53b0..6e3dc68ee6 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/rmd160.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/rmd160.c @@ -406,21 +406,21 @@ rmd160_write ( void *context, const void *inbuf_arg, size_t inlen) const unsigned char *inbuf = inbuf_arg; RMD160_CONTEXT *hd = context; - if( hd->count == 64 ) /* flush the buffer */ + if ( hd->count == 64 ) /* flush the buffer */ { transform( hd, hd->buf ); _gcry_burn_stack (108+5*sizeof(void*)); hd->count = 0; hd->nblocks++; } - if( !inbuf ) + if ( !inbuf ) return; - if( hd->count ) + if ( hd->count ) { - for( ; inlen && hd->count < 64; inlen-- ) + for ( ; inlen && hd->count < 64; inlen-- ) hd->buf[hd->count++] = *inbuf++; rmd160_write( hd, NULL, 0 ); - if( !inlen ) + if ( !inlen ) return; } @@ -433,7 +433,7 @@ rmd160_write ( void *context, const void *inbuf_arg, size_t inlen) inbuf += 64; } _gcry_burn_stack (108+5*sizeof(void*)); - for( ; inlen && hd->count < 64; inlen-- ) + for ( ; inlen && hd->count < 64; inlen-- ) hd->buf[hd->count++] = *inbuf++; } @@ -477,7 +477,7 @@ rmd160_final( void *context ) msb = t >> 26; /* add the count */ t = lsb; - if( (lsb += hd->count) < t ) + if ( (lsb += hd->count) < t ) msb++; /* multiply by 8 to make a bit count */ t = lsb; @@ -485,7 +485,7 @@ rmd160_final( void *context ) msb <<= 3; msb |= t >> 29; - if( hd->count < 56 ) /* enough room */ + if ( hd->count < 56 ) /* enough room */ { hd->buf[hd->count++] = 0x80; /* pad */ while( hd->count < 56 ) diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/rsa.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/rsa.c index cf278c2532..a6b225e0f0 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/rsa.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/rsa.c @@ -285,7 +285,7 @@ generate_std (RSA_secret_key *sk, unsigned int nbits, unsigned long use_e, u = gcry_mpi_snew ( nbits ); mpi_invm(u, p, q ); - if( DBG_CIPHER ) + if ( DBG_CIPHER ) { log_mpidump(" p= ", p ); log_mpidump(" q= ", q ); @@ -534,7 +534,7 @@ generate_x931 (RSA_secret_key *sk, unsigned int nbits, unsigned long e_value, u = f; f = NULL; mpi_invm (u, p, q ); - if( DBG_CIPHER ) + if ( DBG_CIPHER ) { if (*swapped) log_debug ("p and q are swapped\n"); @@ -599,7 +599,7 @@ check_secret_key( RSA_secret_key *sk ) static void public(gcry_mpi_t output, gcry_mpi_t input, RSA_public_key *pkey ) { - if( output == input ) /* powm doesn't like output and input the same */ + if ( output == input ) /* powm doesn't like output and input the same */ { gcry_mpi_t x = mpi_alloc( mpi_get_nlimbs(input)*2 ); mpi_powm( x, input, pkey->e, pkey->n ); @@ -625,7 +625,7 @@ stronger_key_check ( RSA_secret_key *skey ) log_info ( "RSA Oops: n != p * q\n" ); /* check that p is less than q */ - if( mpi_cmp( skey->p, skey->q ) > 0 ) + if ( mpi_cmp( skey->p, skey->q ) > 0 ) { log_info ("RSA Oops: p >= q - fixed\n"); _gcry_mpi_swap ( skey->p, skey->q); diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/seed.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/seed.c index b0980d61ec..f1e921148f 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/seed.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/seed.c @@ -273,7 +273,7 @@ do_setkey (SEED_context *ctx, const byte *key, const unsigned keylen) { initialized = 1; selftest_failed = selftest (); - if( selftest_failed ) + if ( selftest_failed ) log_error ("%s\n", selftest_failed ); } if (selftest_failed) diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/sha1.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/sha1.c index 8862c64b0a..c7f697c7bb 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/sha1.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/sha1.c @@ -300,7 +300,7 @@ sha1_final(void *context) msb = t >> 26; /* add the count */ t = lsb; - if( (lsb += hd->count) < t ) + if ( (lsb += hd->count) < t ) msb++; /* multiply by 8 to make a bit count */ t = lsb; @@ -308,7 +308,7 @@ sha1_final(void *context) msb <<= 3; msb |= t >> 29; - if( hd->count < 56 ) /* enough room */ + if ( hd->count < 56 ) /* enough room */ { hd->buf[hd->count++] = 0x80; /* pad */ while( hd->count < 56 ) diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/tiger.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/tiger.c index a6feb316c2..afc756d50e 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/tiger.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/tiger.c @@ -743,21 +743,21 @@ tiger_write ( void *context, const void *inbuf_arg, size_t inlen) const unsigned char *inbuf = inbuf_arg; TIGER_CONTEXT *hd = context; - if( hd->count == 64 ) /* flush the buffer */ + if ( hd->count == 64 ) /* flush the buffer */ { transform( hd, hd->buf ); _gcry_burn_stack (21*8+11*sizeof(void*)); hd->count = 0; hd->nblocks++; } - if( !inbuf ) + if ( !inbuf ) return; - if( hd->count ) + if ( hd->count ) { - for( ; inlen && hd->count < 64; inlen-- ) + for ( ; inlen && hd->count < 64; inlen-- ) hd->buf[hd->count++] = *inbuf++; tiger_write( hd, NULL, 0 ); - if( !inlen ) + if ( !inlen ) return; } @@ -770,7 +770,7 @@ tiger_write ( void *context, const void *inbuf_arg, size_t inlen) inbuf += 64; } _gcry_burn_stack (21*8+11*sizeof(void*)); - for( ; inlen && hd->count < 64; inlen-- ) + for ( ; inlen && hd->count < 64; inlen-- ) hd->buf[hd->count++] = *inbuf++; } @@ -794,7 +794,7 @@ tiger_final( void *context ) msb = t >> 26; /* add the count */ t = lsb; - if( (lsb += hd->count) < t ) + if ( (lsb += hd->count) < t ) msb++; /* multiply by 8 to make a bit count */ t = lsb; @@ -802,7 +802,7 @@ tiger_final( void *context ) msb <<= 3; msb |= t >> 29; - if( hd->count < 56 ) /* enough room */ + if ( hd->count < 56 ) /* enough room */ { hd->buf[hd->count++] = pad; while( hd->count < 56 ) diff --git a/plugins/MirOTR/libgcrypt-1.4.6/cipher/twofish.c b/plugins/MirOTR/libgcrypt-1.4.6/cipher/twofish.c index 5274c4001d..2183aa0b7b 100644 --- a/plugins/MirOTR/libgcrypt-1.4.6/cipher/twofish.c +++ b/plugins/MirOTR/libgcrypt-1.4.6/cipher/twofish.c @@ -584,7 +584,7 @@ do_twofish_setkey (TWOFISH_context *ctx, const byte *key, const unsigned keylen) static const char *selftest_failed=0; /* Check key length. */ - if( ( ( keylen - 16 ) | 16 ) != 16 ) + if ( ( ( keylen - 16 ) | 16 ) != 16 ) return GPG_ERR_INV_KEYLEN; /* Do self-test if necessary. */ @@ -592,10 +592,10 @@ do_twofish_setkey (TWOFISH_context *ctx, const byte *key, const unsigned keylen) { initialized = 1; selftest_failed = selftest (); - if( selftest_failed ) + if ( selftest_failed ) log_error("%s\n", selftest_failed ); } - if( selftest_failed ) + if ( selftest_failed ) return GPG_ERR_SELFTEST_FAILED; /* Compute the first two words of the S vector. The magic numbers are |