Some whitespace fixes
Didn't change some of the larger testing scripts that use an inconsistent indentation style.
This commit is contained in:
@@ -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, 12287, 1, 12286, 12287, 12287, 12284, 1,
|
||||
12287, 2, 12284, 0, 2, 12288, 0, 1, 0, 12285,
|
||||
12288, 4, 2, 12287, 12282, 12288, 12285, 12288, 2, 12288,
|
||||
|
||||
@@ -242,57 +242,57 @@ static uint8_t rbits[] = {
|
||||
};
|
||||
|
||||
static uint8_t r_ref[] = {
|
||||
0, 3, 3, 1, 1, 1, 0, 1, 0, 3, 2, 0, 1, 1, 3, 0, 2, 1, 0, 3,
|
||||
2, 1, 2, 3, 3, 0, 2, 0, 1, 3, 3, 2, 3, 3, 0, 3, 0, 2, 2, 0,
|
||||
1, 1, 2, 0, 1, 1, 2, 1, 3, 0, 0, 3, 1, 1, 0, 0, 0, 2, 0, 1,
|
||||
0, 2, 3, 1, 3, 0, 3, 1, 0, 0, 2, 1, 3, 3, 1, 3, 2, 1, 0, 2,
|
||||
0, 0, 3, 3, 0, 1, 2, 2, 0, 1, 0, 3,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, 2, 2, 3, 1, 0, 2, 3, 3, 3, 2, 0, 0, 3, 3, 1, 2, 2, 3,
|
||||
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.
|
||||
*
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user