Some whitespace fixes

Didn't change some of the larger testing scripts that use an inconsistent
indentation style.
This commit is contained in:
Tobias Brunner
2019-08-22 15:18:06 +02:00
parent 68346b6962
commit b9949e98c2
92 changed files with 554 additions and 552 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ struct mgf1_t {
/**
* Hash the seed before using it as a seed for MGF1
*
*
* @param yes TRUE if seed has to be hashed first
*/
void (*set_hash_seed)(mgf1_t *this, bool yes);
+3 -3
View File
@@ -60,7 +60,7 @@ METHOD(ntt_fft_t, get_modulus, uint16_t,
*
* x[i1] ---|+|------- x[i1]
* \/
* /\ w[iw]
* /\ w[iw]
* x[i2] ---|-|--|*|-- x[i2]
*
*/
@@ -147,7 +147,7 @@ METHOD(ntt_fft_t, transform, void,
{
iw = s * (inverse ? (n - i * k) : (i * k));
butterfly(this, b, t + i, t + i + m, iw);
}
}
}
t += 2*m;
}
@@ -169,7 +169,7 @@ METHOD(ntt_fft_t, transform, void,
/**
* Compensate the linear phase needed for negative wrapped convolution
* and normalize the output array with 1/n mod q after the inverse FFT.
* and normalize the output array with 1/n mod q after the inverse FFT.
*/
if (inverse)
{
@@ -563,7 +563,7 @@ static const uint16_t wi_12289_512[] = {
* Bit-reversed indices for n = 512
*/
static const uint16_t rev_512[] = {
0, 256, 128, 384, 64, 320, 192, 448, 32, 288,
0, 256, 128, 384, 64, 320, 192, 448, 32, 288,
160, 416, 96, 352, 224, 480, 16, 272, 144, 400,
80, 336, 208, 464, 48, 304, 176, 432, 112, 368,
240, 496, 8, 264, 136, 392, 72, 328, 200, 456,
@@ -32,7 +32,7 @@
static inline uint32_t ntt_fft_mreduce(uint32_t x, const ntt_fft_params_t *p)
{
uint32_t m, t;
m = (x * p->q_inv) & p->rmask;
t = (x + m * p->q) >> p->rlog;
@@ -39,7 +39,7 @@ START_TEST(test_ntt_fft_impulse)
x[i] = 0;
}
x[0] = 1;
fft = ntt_fft_create(fft_params[_i]);
fft->transform(fft, x, X, FALSE);
@@ -72,7 +72,7 @@ START_TEST(test_ntt_fft_wrap)
}
fft = ntt_fft_create(fft_params[_i]);
ck_assert(fft->get_size(fft) == n);
ck_assert(fft->get_modulus(fft) == q);
ck_assert(fft->get_modulus(fft) == q);
fft->transform(fft, x, X, FALSE);
for (j = 0; j < n; j++)
@@ -92,7 +92,7 @@ START_TEST(test_ntt_fft_wrap)
}
y[j] = 0;
}
fft->destroy(fft);
fft->destroy(fft);
}
END_TEST
@@ -131,7 +131,7 @@ bliss_huffman_coder_t *bliss_huffman_coder_create(bliss_huffman_code_t *code,
},
.packer = packer,
.code = code,
.index_max = (2*code->n_z2 - 1) * code->n_z1,
.index_max = (2*code->n_z2 - 1) * code->n_z1,
);
return &this->public;
@@ -185,7 +185,7 @@ METHOD(bliss_sampler_t, gaussian, bool,
return FALSE;
}
if (x || y || u)
{
{
break;
}
}
@@ -102,7 +102,7 @@ METHOD(bliss_signature_t, get_encoding, chunk_t,
encoding = packer->extract_buf(packer);
DBG2(DBG_LIB, "efficiency of Huffman coder is %6.4f bits/tuple (%u bits)",
coder->get_bits(coder)/(double)(this->set->n),
coder->get_bits(coder)/(double)(this->set->n),
coder->get_bits(coder));
DBG2(DBG_LIB, "generated BLISS signature (%u bits encoded in %u bytes)",
packer->get_bits(packer), encoding.len);
@@ -65,7 +65,7 @@ METHOD(xof_t, get_bytes, bool,
}
/* copy whole stream blocks directly to output buffer */
blocks = (out_len - index) / CHACHA_BLOCK_SIZE;
blocks = (out_len - index) / CHACHA_BLOCK_SIZE;
while (blocks--)
{
if (!this->drv->chacha(this->drv, buffer + index))
@@ -73,8 +73,8 @@ METHOD(xof_t, get_bytes, bool,
return FALSE;
}
index += CHACHA_BLOCK_SIZE;
}
}
/* refill the stream buffer if some more output bytes are needed */
len = out_len - index;
if (len)
@@ -85,8 +85,8 @@ METHOD(xof_t, get_bytes, bool,
}
memcpy(buffer + index, this->stream, len);
this->stream_index = len;
}
}
return TRUE;
}
@@ -140,7 +140,7 @@ newhope_noise_t *newhope_noise_create(chunk_t seed)
{
DBG1(DBG_LIB, "could not instantiate ChaCha20 stream");
return NULL;
}
}
INIT(this,
.public = {
@@ -14,7 +14,7 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
*
*/
#include "newhope_reconciliation.h"
@@ -166,7 +166,7 @@ METHOD(newhope_reconciliation_t, reconcile, chunk_t,
i2 = i1 + this->n4;
i3 = i2 + this->n4;
tmp[0] = this->q16 + 8 * (int32_t)v[i0] -
tmp[0] = this->q16 + 8 * (int32_t)v[i0] -
this->q * (2*r[i0] + r[i3]);
tmp[1] = this->q16 + 8 * (int32_t)v[i1] -
this->q * (2*r[i1] + r[i3]);
@@ -35,7 +35,7 @@ struct newhope_reconciliation_t {
* Generate reconciliation polynomial
*
* @param v polynomial v
* @param rbits pseudo random bit array
* @param rbits pseudo random bit array
* @return return array with reconciliation polynomial
*/
uint8_t* (*help_reconcile)(newhope_reconciliation_t *this,
@@ -151,7 +151,7 @@ static noise_t noises[] = {
0x98, 0x10, 0x39, 0xce, 0x17, 0x66, 0xaa, 0x25, 0x42, 0xb0,
0x5d, 0xb3, 0xbd, 0x80, 0x9a, 0xb1, 0x42, 0x48, 0x9d, 0x5d,
0xbf, 0xe1, 0x27, 0x3e, 0x73, 0x99, 0x63, 0x7b, 0x4b, 0x32,
0x13, 0x76, 0x8a, 0xaa },
0x13, 0x76, 0x8a, 0xaa },
{ 12283, 1, 12288, 4, 0, 12285, 5, 1, 1, 2,
3, 4, 12288, 0, 3, 1, 1, 0, 12286, 6,
1, 0, 1, 0, 4, 2, 12288, 3, 0, 5,
@@ -263,7 +263,7 @@ static noise_t noises[] = {
0xaa, 0x5a, 0x8e, 0xca, 0x00, 0xbb, 0xb4, 0xa7, 0x3b, 0xda,
0xd1, 0x92, 0xb5, 0xc4, 0x2f, 0x73, 0xf2, 0xfd, 0x4e, 0x27,
0x36, 0x44, 0xc8, 0xb3, 0x61, 0x25, 0xa6, 0x4a, 0xdd, 0xeb,
0x00, 0x6c, 0x13, 0xa0 },
0x00, 0x6c, 0x13, 0xa0 },
{ 5, 4, 4, 12288, 12286, 1, 12287, 12288, 2, 12288,
12288, 12287, 2, 2, 12284, 12288, 12288, 3, 2, 3,
12287, 2, 2, 0, 0, 2, 5, 12285, 5, 12287,
@@ -366,7 +366,7 @@ static noise_t noises[] = {
0, 12287, 12288, 2, 12288, 12284, 12288, 12285, 4, 1,
12288, 12284, 12287, 4, 12284, 1, 3, 12284, 12282, 0,
12286, 12287, 2, 12286, 3, 4, 2, 12288, 3, 3,
1, 3, 12287, 12283 }
1, 3, 12287, 12283 }
},
{ 0x01, 0x01, /* polynomial e' */
{ 0x58, 0xd8, 0x6a, 0xcd, 0xe2, 0x79, 0x61, 0x98, 0xfd, 0xea,
@@ -375,7 +375,7 @@ static noise_t noises[] = {
0x41, 0x2b, 0x78, 0x88, 0x58, 0x6d, 0x58, 0x47, 0x3e, 0xb7,
0x46, 0x60, 0xd8, 0x2f, 0xa0, 0x83, 0xe4, 0xbc, 0x81, 0xdd,
0xc6, 0x29, 0x8b, 0xee, 0xf9, 0xec, 0x90, 0x39, 0x9d, 0x46,
0xbf, 0x2d, 0x7c, 0xdf },
0xbf, 0x2d, 0x7c, 0xdf },
{ 12287, 3, 3, 1, 12285, 4, 1, 5, 12287, 12285,
12285, 12285, 1, 12288, 12287, 12288, 2, 3, 12283, 12288,
12285, 0, 0, 12286, 12287, 12288, 12288, 12288, 12288, 1,
@@ -487,7 +487,7 @@ static noise_t noises[] = {
0xd1, 0x25, 0xf2, 0x84, 0xd7, 0xee, 0xd5, 0x53, 0x86, 0x5b,
0xa3, 0x93, 0x4e, 0xee, 0xc7, 0x5b, 0xe5, 0x52, 0x68, 0x19,
0xdf, 0x63, 0xfb, 0x91, 0x3d, 0xe9, 0x5d, 0xd6, 0xeb, 0x81,
0x3d, 0xac, 0xf1, 0xad },
0x3d, 0xac, 0xf1, 0xad },
{ 12286, 12286, 1,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
0, 1, 1, 1, 3, 2, 1, 0, 0, 1, 2, 3, 3, 0, 1, 1, 1, 1, 0, 1,
0, 2, 3, 3, 3, 3, 0, 2, 3, 0, 1, 0, 0, 1, 1, 3, 2, 2, 0, 0,
2, 2, 1, 3
};
@@ -91,7 +91,7 @@ void ntru_indices_2_trits(uint16_t in_len, uint16_t const *in, bool plus1,
uint8_t *out);
/**
* Unpacks an array of N trits and creates a list of array indices
* Unpacks an array of N trits and creates a list of array indices
* corresponding to trits = +1, and list of array indices corresponding to
* trits = -1.
*
+1 -1
View File
@@ -321,7 +321,7 @@ ntru_poly_t *ntru_poly_create_from_seed(ext_out_function_t mgf1_type,
/* generate indices for a single polynomial */
while (num_indices)
{
/* generate a random candidate index with a size of c_bits */
/* generate a random candidate index with a size of c_bits */
do
{
if (!bitspender->get_bits(bitspender, c_bits, &index))
+1 -1
View File
@@ -27,7 +27,7 @@ typedef struct ntru_poly_t ntru_poly_t;
#include <crypto/xofs/xof.h>
/**
* Implements a trinary polynomial storing the indices of non-zero coefficients
* Implements a trinary polynomial storing the indices of non-zero coefficients
*/
struct ntru_poly_t {
@@ -146,7 +146,7 @@ METHOD(ntru_private_key_t, get_encoding, chunk_t,
return this->encoding;
}
/**
/**
* Checks that the number of 0, +1, and -1 trinary ring elements meet or exceed
* a minimum weight.
*
@@ -596,7 +596,7 @@ static bool ring_inv(uint16_t *a, uint16_t N, uint16_t q, uint16_t *t,
f[i] ^= g[i];
}
if (deg_c > deg_b)
{
{
deg_b = deg_c;
}
for (i = 0; i <= deg_c; i++)
@@ -633,7 +633,7 @@ static bool ring_inv(uint16_t *a, uint16_t N, uint16_t q, uint16_t *t,
t[0] = t[0] + 2;
ring_mult_c(t2, t, N, q, a_inv);
}
return TRUE;
}
@@ -692,7 +692,7 @@ ntru_private_key_t *ntru_private_key_create(ntru_drbg_t *drbg,
t = malloc(t_len);
t1 = t + 2 * params->N;
/* extend sparse private key polynomial f to N array elements */
/* extend sparse private key polynomial f to N array elements */
this->privkey->get_array(this->privkey, t1);
/* set mask for large modulus */
@@ -707,7 +707,7 @@ ntru_private_key_t *ntru_private_key_create(ntru_drbg_t *drbg,
/* use the public key array as a temporary buffer */
t2 = this->pubkey;
/* find f^-1 in (Z/qZ)[X]/(X^N - 1) */
if (!ring_inv(t1, params->N, params->q, t, t2))
{
@@ -743,7 +743,7 @@ ntru_private_key_t *ntru_private_key_create(ntru_drbg_t *drbg,
chunk_clear(&seed);
memwipe(t, t_len);
free(t);
/* generate private key encoding */
generate_encoding(this);
@@ -821,7 +821,7 @@ ntru_private_key_t *ntru_private_key_create_from_data(ntru_drbg_t *drbg,
privkey_packed_indices_len <= privkey_packed_trits_len)
{
tag = NTRU_PRIVKEY_INDICES_TAG;
}
}
else
{
tag = NTRU_PRIVKEY_TRITS_TAG;
@@ -858,7 +858,7 @@ ntru_private_key_t *ntru_private_key_create_from_data(ntru_drbg_t *drbg,
indices = malloc(2 * dF * sizeof(uint16_t));
/* unpack the private key */
privkey_packed = data.ptr + header_len + pubkey_packed_len;
privkey_packed = data.ptr + header_len + pubkey_packed_len;
if (tag == NTRU_PRIVKEY_TRITS_TAG)
{
ntru_packed_trits_2_indices(privkey_packed, params->N,
+1 -1
View File
@@ -103,7 +103,7 @@ ntru_trits_t *ntru_trits_create(size_t len, ext_out_function_t alg,
return NULL;
}
if (octet < 243) /* 243 = 3^5 */
{
{
ntru_octet_2_trits(octet, (trits_needed < 5) ? buf : trits);
if (trits_needed < 5)
{
+1 -1
View File
@@ -27,7 +27,7 @@ typedef struct ntru_trits_t ntru_trits_t;
#include <crypto/xofs/xof.h>
/**
* Implements an array of trinary elements (trits)
* Implements an array of trinary elements (trits)
*/
struct ntru_trits_t {
@@ -16,7 +16,7 @@
#include <crypto/crypto_tester.h>
/**
* ChaCha20 Stream Test Vector from RFC 7539, Section 2.3.2
* ChaCha20 Stream Test Vector from RFC 7539, Section 2.3.2
*/
xof_test_vector_t chacha20_xof_1 = {
.alg = XOF_CHACHA20, .len = 44,
@@ -31,7 +31,7 @@ xof_test_vector_t chacha20_xof_1 = {
};
/**
* ChaCha20 Stream Test Vector from RFC 7539, Section 2.4.2
* ChaCha20 Stream Test Vector from RFC 7539, Section 2.4.2
*/
xof_test_vector_t chacha20_xof_2 = {
.alg = XOF_CHACHA20, .len = 44,
@@ -50,7 +50,7 @@ xof_test_vector_t chacha20_xof_2 = {
};
/**
* ChaCha20 Stream Test Vector #2 from RFC 7539, Section A1.
* ChaCha20 Stream Test Vector #2 from RFC 7539, Section A1.
*/
xof_test_vector_t chacha20_xof_3 = {
.alg = XOF_CHACHA20, .len = 44,
@@ -65,7 +65,7 @@ xof_test_vector_t chacha20_xof_3 = {
};
/**
* ChaCha20 Stream Test Vector #3 from RFC 7539, Section A1.
* ChaCha20 Stream Test Vector #3 from RFC 7539, Section A1.
*/
xof_test_vector_t chacha20_xof_4 = {
.alg = XOF_CHACHA20, .len = 44,
@@ -125,7 +125,7 @@ static const asn1Object_t defaultObjects[] = {
{ 1, "explicit int1", ASN1_CONTEXT_C_1, ASN1_DEF }, /* 1 */
{ 2, "int1", ASN1_INTEGER, ASN1_BODY }, /* 2 */
{ 1, "int2", ASN1_INTEGER, ASN1_DEF|ASN1_BODY }, /* 3 */
{ 1, "implicit int3", ASN1_CONTEXT_S_3, ASN1_DEF|ASN1_BODY }, /* 4 */
{ 1, "implicit int3", ASN1_CONTEXT_S_3, ASN1_DEF|ASN1_BODY }, /* 4 */
{ 0, "exit", ASN1_EOC, ASN1_EXIT }
};
@@ -204,7 +204,7 @@ static const asn1Object_t optionObjects[] = {
{ 1, "end opt", ASN1_EOC, ASN1_END }, /* 4 */
{ 1, "int2", ASN1_INTEGER, ASN1_OPT|ASN1_BODY }, /* 5 */
{ 1, "end opt", ASN1_EOC, ASN1_END }, /* 6 */
{ 1, "implicit int3", ASN1_CONTEXT_S_3, ASN1_OPT|ASN1_BODY }, /* 7 */
{ 1, "implicit int3", ASN1_CONTEXT_S_3, ASN1_OPT|ASN1_BODY }, /* 7 */
{ 1, "end opt", ASN1_EOC, ASN1_END }, /* 8 */
{ 0, "exit", ASN1_EOC, ASN1_EXIT }
};
@@ -78,7 +78,7 @@ static crypter_aead_t aead[] = {
{ ENCR_AES_CBC, FALSE },
{ ENCR_CAMELLIA_CBC, FALSE }
};
START_TEST(test_crypter_is_aead)
{
ck_assert(encryption_algorithm_is_aead(aead[_i].alg) == aead[_i].is_aead);