Browse Source

hqc: Add -Wshadow and fix shadowing warnings

kyber
John M. Schanck 4 years ago
committed by Kris Kwiatkowski
parent
commit
0fcd954047
30 changed files with 115 additions and 100 deletions
  1. +2
    -2
      crypto_kem/hqc-128/META.yml
  2. +1
    -1
      crypto_kem/hqc-128/avx2/Makefile
  3. +3
    -3
      crypto_kem/hqc-128/avx2/bch.c
  4. +4
    -4
      crypto_kem/hqc-128/avx2/code.c
  5. +12
    -9
      crypto_kem/hqc-128/avx2/vector.c
  6. +1
    -1
      crypto_kem/hqc-128/clean/Makefile
  7. +2
    -2
      crypto_kem/hqc-192/META.yml
  8. +1
    -1
      crypto_kem/hqc-192/avx2/Makefile
  9. +3
    -3
      crypto_kem/hqc-192/avx2/bch.c
  10. +3
    -3
      crypto_kem/hqc-192/avx2/code.c
  11. +12
    -9
      crypto_kem/hqc-192/avx2/vector.c
  12. +1
    -1
      crypto_kem/hqc-192/clean/Makefile
  13. +2
    -2
      crypto_kem/hqc-256/META.yml
  14. +1
    -1
      crypto_kem/hqc-256/avx2/Makefile
  15. +3
    -3
      crypto_kem/hqc-256/avx2/bch.c
  16. +3
    -3
      crypto_kem/hqc-256/avx2/code.c
  17. +12
    -9
      crypto_kem/hqc-256/avx2/vector.c
  18. +1
    -1
      crypto_kem/hqc-256/clean/Makefile
  19. +2
    -2
      crypto_kem/hqc-rmrs-128/META.yml
  20. +1
    -1
      crypto_kem/hqc-rmrs-128/avx2/Makefile
  21. +12
    -10
      crypto_kem/hqc-rmrs-128/avx2/vector.c
  22. +1
    -1
      crypto_kem/hqc-rmrs-128/clean/Makefile
  23. +2
    -2
      crypto_kem/hqc-rmrs-192/META.yml
  24. +1
    -1
      crypto_kem/hqc-rmrs-192/avx2/Makefile
  25. +12
    -10
      crypto_kem/hqc-rmrs-192/avx2/vector.c
  26. +1
    -1
      crypto_kem/hqc-rmrs-192/clean/Makefile
  27. +2
    -2
      crypto_kem/hqc-rmrs-256/META.yml
  28. +1
    -1
      crypto_kem/hqc-rmrs-256/avx2/Makefile
  29. +12
    -10
      crypto_kem/hqc-rmrs-256/avx2/vector.c
  30. +1
    -1
      crypto_kem/hqc-rmrs-256/clean/Makefile

+ 2
- 2
crypto_kem/hqc-128/META.yml View File

@@ -22,9 +22,9 @@ principal-submitters:
- Loïc Bidoux
implementations:
- name: clean
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/22134db4/hqc
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/09ab89ed/hqc
- name: avx2
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/22134db4/hqc
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/09ab89ed/hqc
supported_platforms:
- architecture: x86_64
operating_systems:


+ 1
- 1
crypto_kem/hqc-128/avx2/Makefile View File

@@ -4,7 +4,7 @@ LIB=libhqc-128_avx2.a
HEADERS=alpha_table.h api.h bch.h code.h fft.h gen_matrix.h gf2x.h gf.h hqc.h parameters.h parsing.h repetition.h vector.h
OBJECTS=bch.o code.o fft.o gf2x.o gf.o hqc.o kem.o parsing.o repetition.o vector.o

CFLAGS=-O3 -mavx2 -mbmi -mpclmul -Wall -Wextra -Wpedantic -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)
CFLAGS=-O3 -mavx2 -mbmi -mpclmul -Wall -Wextra -Wshadow -Wpedantic -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)

all: $(LIB)



+ 3
- 3
crypto_kem/hqc-128/avx2/bch.c View File

@@ -146,7 +146,7 @@ void compute_syndromes(__m256i *syndromes, const uint64_t *rcv) {
__m256i tmp_repeat;
uint32_t *aux;
int16_t *alpha_tmp;
uint32_t i;
size_t i, j;
uint32_t nzflag;
// static variable so that it is stored in the DATA segment
// not in the STACK segment
@@ -167,11 +167,11 @@ void compute_syndromes(__m256i *syndromes, const uint64_t *rcv) {
}

// Evaluation of the polynomial corresponding to the vector v in alpha^i for i in {1, ..., 2 * PARAM_DELTA}
for (size_t j = 0; j < SYND_SIZE_256; ++j) {
for (j = 0; j < SYND_SIZE_256; ++j) {
S = zero_256;
alpha_tmp = table_alpha_ij + (j << 4);

for (size_t i = 0; i < PARAM_N1; ++i) {
for (i = 0; i < PARAM_N1; ++i) {
nzflag = ((-(int32_t) tmp_array[i]) >> 31) & 1;
tmp_repeat = _mm256_set1_epi64x(nzflag);
L = _mm256_cmpeq_epi64(tmp_repeat, un_256);


+ 4
- 4
crypto_kem/hqc-128/avx2/code.c View File

@@ -35,9 +35,9 @@ static inline uint64_t mux(uint64_t a, uint64_t b, int64_t bit) {
*/
void PQCLEAN_HQC128_AVX2_code_encode(uint64_t *em, const uint64_t *m) {
const uint64_t mask[2][2] = {{0x0UL, 0x0UL}, {0x7FFFFFFFUL, 0x3FFFFFFFUL}};
size_t i, pos_r;
size_t i, j, pos_r;
uint64_t bit;
uint64_t idx_r;
uint16_t idx_r;
uint64_t select;


@@ -71,8 +71,8 @@ void PQCLEAN_HQC128_AVX2_code_encode(uint64_t *em, const uint64_t *m) {
/* now we add the message m */
/* systematic encoding */
pos_r = PARAM_N2 * (PARAM_N1 - PARAM_K);
for (int32_t i = 0; i < 4; i++) {
for (int32_t j = 0; j < 64; j++) {
for (i = 0; i < 4; i++) {
for (j = 0; j < 64; j++) {
bit = (m[i] >> j) & 0x1;




+ 12
- 9
crypto_kem/hqc-128/avx2/vector.c View File

@@ -36,9 +36,13 @@ void PQCLEAN_HQC128_AVX2_vect_set_random_fixed_weight(AES_XOF_struct *ctx, uint6
__m256i bit256[PARAM_OMEGA_R];
__m256i bloc256[PARAM_OMEGA_R];
__m256i posCmp256 = _mm256_set_epi64x(3, 2, 1, 0);
__m256i pos256;
__m256i mask256;
__m256i aux;
__m256i i256;
uint64_t bloc, pos, bit64;
uint8_t inc;
size_t i, j;
size_t i, j, k;

i = 0;
j = random_bytes_size;
@@ -58,7 +62,7 @@ void PQCLEAN_HQC128_AVX2_vect_set_random_fixed_weight(AES_XOF_struct *ctx, uint6
tmp[i] = tmp[i] % PARAM_N;

inc = 1;
for (uint32_t k = 0; k < i; k++) {
for (k = 0; k < i; k++) {
if (tmp[k] == tmp[i]) {
inc = 0;
}
@@ -71,19 +75,18 @@ void PQCLEAN_HQC128_AVX2_vect_set_random_fixed_weight(AES_XOF_struct *ctx, uint6
bloc = tmp[i] >> 6;
bloc256[i] = _mm256_set1_epi64x(bloc >> 2);
pos = (bloc & 0x3UL);
__m256i pos256 = _mm256_set1_epi64x(pos);
__m256i mask256 = _mm256_cmpeq_epi64(pos256, posCmp256);
pos256 = _mm256_set1_epi64x(pos);
mask256 = _mm256_cmpeq_epi64(pos256, posCmp256);
bit64 = 1ULL << (tmp[i] & 0x3f);
__m256i bloc256 = _mm256_set1_epi64x(bit64);
bit256[i] = bloc256 & mask256;
bit256[i] = _mm256_set1_epi64x(bit64)&mask256;
}

for (i = 0; i < CEIL_DIVIDE(PARAM_N, 256); i++) {
__m256i aux = _mm256_loadu_si256(((__m256i *)v) + i);
__m256i i256 = _mm256_set1_epi64x(i);
aux = _mm256_loadu_si256(((__m256i *)v) + i);
i256 = _mm256_set1_epi64x(i);

for (j = 0; j < weight; j++) {
__m256i mask256 = _mm256_cmpeq_epi64(bloc256[j], i256);
mask256 = _mm256_cmpeq_epi64(bloc256[j], i256);
aux ^= bit256[j] & mask256;
}
_mm256_storeu_si256(((__m256i *)v) + i, aux);


+ 1
- 1
crypto_kem/hqc-128/clean/Makefile View File

@@ -4,7 +4,7 @@ LIB=libhqc-128_clean.a
HEADERS=api.h bch.h code.h fft.h gf2x.h gf.h hqc.h parameters.h parsing.h repetition.h vector.h
OBJECTS=bch.o code.o fft.o gf2x.o gf.o hqc.o kem.o parsing.o repetition.o vector.o

CFLAGS=-O3 -Wall -Wextra -Wpedantic -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)
CFLAGS=-O3 -Wall -Wextra -Wpedantic -Wshadow -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)

all: $(LIB)



+ 2
- 2
crypto_kem/hqc-192/META.yml View File

@@ -22,9 +22,9 @@ principal-submitters:
- Loïc Bidoux
implementations:
- name: clean
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/22134db4/hqc
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/09ab89ed/hqc
- name: avx2
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/22134db4/hqc
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/09ab89ed/hqc
supported_platforms:
- architecture: x86_64
operating_systems:


+ 1
- 1
crypto_kem/hqc-192/avx2/Makefile View File

@@ -4,7 +4,7 @@ LIB=libhqc-192_avx2.a
HEADERS=alpha_table.h api.h bch.h code.h fft.h gen_matrix.h gf2x.h gf.h hqc.h parameters.h parsing.h repetition.h vector.h
OBJECTS=bch.o code.o fft.o gf2x.o gf.o hqc.o kem.o parsing.o repetition.o vector.o

CFLAGS=-O3 -mavx2 -mbmi -mpclmul -Wall -Wextra -Wpedantic -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)
CFLAGS=-O3 -mavx2 -mbmi -mpclmul -Wall -Wextra -Wshadow -Wpedantic -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)

all: $(LIB)



+ 3
- 3
crypto_kem/hqc-192/avx2/bch.c View File

@@ -146,7 +146,7 @@ void compute_syndromes(__m256i *syndromes, const uint64_t *rcv) {
__m256i tmp_repeat;
uint32_t *aux;
int16_t *alpha_tmp;
uint32_t i;
size_t i, j;
uint32_t nzflag;
// static variable so that it is stored in the DATA segment
// not in the STACK segment
@@ -167,11 +167,11 @@ void compute_syndromes(__m256i *syndromes, const uint64_t *rcv) {
}

// Evaluation of the polynomial corresponding to the vector v in alpha^i for i in {1, ..., 2 * PARAM_DELTA}
for (size_t j = 0; j < SYND_SIZE_256; ++j) {
for (j = 0; j < SYND_SIZE_256; ++j) {
S = zero_256;
alpha_tmp = table_alpha_ij + (j << 4);

for (size_t i = 0; i < PARAM_N1; ++i) {
for (i = 0; i < PARAM_N1; ++i) {
nzflag = ((-(int32_t) tmp_array[i]) >> 31) & 1;
tmp_repeat = _mm256_set1_epi64x(nzflag);
L = _mm256_cmpeq_epi64(tmp_repeat, un_256);


+ 3
- 3
crypto_kem/hqc-192/avx2/code.c View File

@@ -35,7 +35,7 @@ static inline uint64_t mux(uint64_t a, uint64_t b, int64_t bit) {
*/
void PQCLEAN_HQC192_AVX2_code_encode(uint64_t *em, const uint64_t *m) {
const uint64_t mask[2][2] = {{0x0UL, 0x0UL}, {0x7FFFFFFFFFFFFFFUL, 0x3FFFFFFFFFFFFFFUL}};
size_t i, pos_r;
size_t i, j, pos_r;
uint64_t bit;
uint16_t idx_r;
uint64_t select;
@@ -71,8 +71,8 @@ void PQCLEAN_HQC192_AVX2_code_encode(uint64_t *em, const uint64_t *m) {
/* now we add the message m */
/* systematic encoding */
pos_r = PARAM_N2 * (PARAM_N1 - PARAM_K);
for (int32_t i = 0; i < 4; i++) {
for (int32_t j = 0; j < 64; j++) {
for (i = 0; i < 4; i++) {
for (j = 0; j < 64; j++) {
bit = (m[i] >> j) & 0x1;




+ 12
- 9
crypto_kem/hqc-192/avx2/vector.c View File

@@ -36,9 +36,13 @@ void PQCLEAN_HQC192_AVX2_vect_set_random_fixed_weight(AES_XOF_struct *ctx, uint6
__m256i bit256[PARAM_OMEGA_R];
__m256i bloc256[PARAM_OMEGA_R];
__m256i posCmp256 = _mm256_set_epi64x(3, 2, 1, 0);
__m256i pos256;
__m256i mask256;
__m256i aux;
__m256i i256;
uint64_t bloc, pos, bit64;
uint8_t inc;
size_t i, j;
size_t i, j, k;

i = 0;
j = random_bytes_size;
@@ -58,7 +62,7 @@ void PQCLEAN_HQC192_AVX2_vect_set_random_fixed_weight(AES_XOF_struct *ctx, uint6
tmp[i] = tmp[i] % PARAM_N;

inc = 1;
for (uint32_t k = 0; k < i; k++) {
for (k = 0; k < i; k++) {
if (tmp[k] == tmp[i]) {
inc = 0;
}
@@ -71,19 +75,18 @@ void PQCLEAN_HQC192_AVX2_vect_set_random_fixed_weight(AES_XOF_struct *ctx, uint6
bloc = tmp[i] >> 6;
bloc256[i] = _mm256_set1_epi64x(bloc >> 2);
pos = (bloc & 0x3UL);
__m256i pos256 = _mm256_set1_epi64x(pos);
__m256i mask256 = _mm256_cmpeq_epi64(pos256, posCmp256);
pos256 = _mm256_set1_epi64x(pos);
mask256 = _mm256_cmpeq_epi64(pos256, posCmp256);
bit64 = 1ULL << (tmp[i] & 0x3f);
__m256i bloc256 = _mm256_set1_epi64x(bit64);
bit256[i] = bloc256 & mask256;
bit256[i] = _mm256_set1_epi64x(bit64)&mask256;
}

for (i = 0; i < CEIL_DIVIDE(PARAM_N, 256); i++) {
__m256i aux = _mm256_loadu_si256(((__m256i *)v) + i);
__m256i i256 = _mm256_set1_epi64x(i);
aux = _mm256_loadu_si256(((__m256i *)v) + i);
i256 = _mm256_set1_epi64x(i);

for (j = 0; j < weight; j++) {
__m256i mask256 = _mm256_cmpeq_epi64(bloc256[j], i256);
mask256 = _mm256_cmpeq_epi64(bloc256[j], i256);
aux ^= bit256[j] & mask256;
}
_mm256_storeu_si256(((__m256i *)v) + i, aux);


+ 1
- 1
crypto_kem/hqc-192/clean/Makefile View File

@@ -4,7 +4,7 @@ LIB=libhqc-192_clean.a
HEADERS=api.h bch.h code.h fft.h gf2x.h gf.h hqc.h parameters.h parsing.h repetition.h vector.h
OBJECTS=bch.o code.o fft.o gf2x.o gf.o hqc.o kem.o parsing.o repetition.o vector.o

CFLAGS=-O3 -Wall -Wextra -Wpedantic -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)
CFLAGS=-O3 -Wall -Wextra -Wpedantic -Wshadow -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)

all: $(LIB)



+ 2
- 2
crypto_kem/hqc-256/META.yml View File

@@ -22,9 +22,9 @@ principal-submitters:
- Loïc Bidoux
implementations:
- name: clean
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/22134db4/hqc
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/09ab89ed/hqc
- name: avx2
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/22134db4/hqc
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/09ab89ed/hqc
supported_platforms:
- architecture: x86_64
operating_systems:


+ 1
- 1
crypto_kem/hqc-256/avx2/Makefile View File

@@ -4,7 +4,7 @@ LIB=libhqc-256_avx2.a
HEADERS=alpha_table.h api.h bch.h code.h fft.h gen_matrix.h gf2x.h gf.h hqc.h parameters.h parsing.h repetition.h vector.h
OBJECTS=bch.o code.o fft.o gf2x.o gf.o hqc.o kem.o parsing.o repetition.o vector.o

CFLAGS=-O3 -mavx2 -mbmi -mpclmul -Wall -Wextra -Wpedantic -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)
CFLAGS=-O3 -mavx2 -mbmi -mpclmul -Wall -Wextra -Wshadow -Wpedantic -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)

all: $(LIB)



+ 3
- 3
crypto_kem/hqc-256/avx2/bch.c View File

@@ -146,7 +146,7 @@ void compute_syndromes(__m256i *syndromes, const uint64_t *rcv) {
__m256i tmp_repeat;
uint32_t *aux;
int16_t *alpha_tmp;
uint32_t i;
size_t i, j;
uint32_t nzflag;
// static variable so that it is stored in the DATA segment
// not in the STACK segment
@@ -167,11 +167,11 @@ void compute_syndromes(__m256i *syndromes, const uint64_t *rcv) {
}

// Evaluation of the polynomial corresponding to the vector v in alpha^i for i in {1, ..., 2 * PARAM_DELTA}
for (size_t j = 0; j < SYND_SIZE_256; ++j) {
for (j = 0; j < SYND_SIZE_256; ++j) {
S = zero_256;
alpha_tmp = table_alpha_ij + (j << 4);

for (size_t i = 0; i < PARAM_N1; ++i) {
for (i = 0; i < PARAM_N1; ++i) {
nzflag = ((-(int32_t) tmp_array[i]) >> 31) & 1;
tmp_repeat = _mm256_set1_epi64x(nzflag);
L = _mm256_cmpeq_epi64(tmp_repeat, un_256);


+ 3
- 3
crypto_kem/hqc-256/avx2/code.c View File

@@ -35,7 +35,7 @@ static inline uint64_t mux(uint64_t a, uint64_t b, int64_t bit) {
*/
void PQCLEAN_HQC256_AVX2_code_encode(uint64_t *em, const uint64_t *m) {
const uint64_t mask[2][3] = {{0x0UL, 0x0UL, 0x0UL}, {0xFFFFFFFFFFFFFFFFUL, 0xFFFFFFFFFFFFFFFFUL, 0x3FFFFFUL}};
size_t i, pos_r;
size_t i, j, pos_r;
uint64_t bit;
uint64_t idx_r;
uint64_t idx_2;
@@ -76,8 +76,8 @@ void PQCLEAN_HQC256_AVX2_code_encode(uint64_t *em, const uint64_t *m) {
/* now we add the message m */
/* systematic encoding */
pos_r = PARAM_N2 * (PARAM_N1 - PARAM_K);
for (int32_t i = 0; i < 4; i++) {
for (int32_t j = 0; j < 64; j++) {
for (i = 0; i < 4; i++) {
for (j = 0; j < 64; j++) {
bit = (m[i] >> j) & 0x1;




+ 12
- 9
crypto_kem/hqc-256/avx2/vector.c View File

@@ -36,9 +36,13 @@ void PQCLEAN_HQC256_AVX2_vect_set_random_fixed_weight(AES_XOF_struct *ctx, uint6
__m256i bit256[PARAM_OMEGA_R];
__m256i bloc256[PARAM_OMEGA_R];
__m256i posCmp256 = _mm256_set_epi64x(3, 2, 1, 0);
__m256i pos256;
__m256i mask256;
__m256i aux;
__m256i i256;
uint64_t bloc, pos, bit64;
uint8_t inc;
size_t i, j;
size_t i, j, k;

i = 0;
j = random_bytes_size;
@@ -58,7 +62,7 @@ void PQCLEAN_HQC256_AVX2_vect_set_random_fixed_weight(AES_XOF_struct *ctx, uint6
tmp[i] = tmp[i] % PARAM_N;

inc = 1;
for (uint32_t k = 0; k < i; k++) {
for (k = 0; k < i; k++) {
if (tmp[k] == tmp[i]) {
inc = 0;
}
@@ -71,19 +75,18 @@ void PQCLEAN_HQC256_AVX2_vect_set_random_fixed_weight(AES_XOF_struct *ctx, uint6
bloc = tmp[i] >> 6;
bloc256[i] = _mm256_set1_epi64x(bloc >> 2);
pos = (bloc & 0x3UL);
__m256i pos256 = _mm256_set1_epi64x(pos);
__m256i mask256 = _mm256_cmpeq_epi64(pos256, posCmp256);
pos256 = _mm256_set1_epi64x(pos);
mask256 = _mm256_cmpeq_epi64(pos256, posCmp256);
bit64 = 1ULL << (tmp[i] & 0x3f);
__m256i bloc256 = _mm256_set1_epi64x(bit64);
bit256[i] = bloc256 & mask256;
bit256[i] = _mm256_set1_epi64x(bit64)&mask256;
}

for (i = 0; i < CEIL_DIVIDE(PARAM_N, 256); i++) {
__m256i aux = _mm256_loadu_si256(((__m256i *)v) + i);
__m256i i256 = _mm256_set1_epi64x(i);
aux = _mm256_loadu_si256(((__m256i *)v) + i);
i256 = _mm256_set1_epi64x(i);

for (j = 0; j < weight; j++) {
__m256i mask256 = _mm256_cmpeq_epi64(bloc256[j], i256);
mask256 = _mm256_cmpeq_epi64(bloc256[j], i256);
aux ^= bit256[j] & mask256;
}
_mm256_storeu_si256(((__m256i *)v) + i, aux);


+ 1
- 1
crypto_kem/hqc-256/clean/Makefile View File

@@ -4,7 +4,7 @@ LIB=libhqc-256_clean.a
HEADERS=api.h bch.h code.h fft.h gf2x.h gf.h hqc.h parameters.h parsing.h repetition.h vector.h
OBJECTS=bch.o code.o fft.o gf2x.o gf.o hqc.o kem.o parsing.o repetition.o vector.o

CFLAGS=-O3 -Wall -Wextra -Wpedantic -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)
CFLAGS=-O3 -Wall -Wextra -Wpedantic -Wshadow -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)

all: $(LIB)



+ 2
- 2
crypto_kem/hqc-rmrs-128/META.yml View File

@@ -22,9 +22,9 @@ principal-submitters:
- Loïc Bidoux
implementations:
- name: clean
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/22134db4/hqc
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/09ab89ed/hqc
- name: avx2
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/22134db4/hqc
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/09ab89ed/hqc
supported_platforms:
- architecture: x86_64
operating_systems:


+ 1
- 1
crypto_kem/hqc-rmrs-128/avx2/Makefile View File

@@ -4,7 +4,7 @@ LIB=libhqc-rmrs-128_avx2.a
HEADERS=api.h code.h fft.h gf2x.h gf.h hqc.h parameters.h parsing.h reed_muller.h reed_solomon.h vector.h
OBJECTS=code.o fft.o gf2x.o gf.o hqc.o kem.o parsing.o reed_muller.o reed_solomon.o vector.o

CFLAGS=-O3 -mavx2 -mbmi -mpclmul -Wall -Wextra -Wpedantic -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)
CFLAGS=-O3 -mavx2 -mbmi -mpclmul -Wall -Wextra -Wshadow -Wpedantic -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)

all: $(LIB)



+ 12
- 10
crypto_kem/hqc-rmrs-128/avx2/vector.c View File

@@ -36,9 +36,13 @@ void PQCLEAN_HQCRMRS128_AVX2_vect_set_random_fixed_weight(AES_XOF_struct *ctx, u
__m256i bit256[PARAM_OMEGA_R];
__m256i bloc256[PARAM_OMEGA_R];
__m256i posCmp256 = _mm256_set_epi64x(3, 2, 1, 0);
__m256i pos256;
__m256i mask256;
__m256i aux;
__m256i i256;
uint64_t bloc, pos, bit64;
uint8_t inc;
size_t i, j;
size_t i, j, k;

i = 0;
j = random_bytes_size;
@@ -58,7 +62,7 @@ void PQCLEAN_HQCRMRS128_AVX2_vect_set_random_fixed_weight(AES_XOF_struct *ctx, u
tmp[i] = tmp[i] % PARAM_N;

inc = 1;
for (uint32_t k = 0; k < i; k++) {
for (k = 0; k < i; k++) {
if (tmp[k] == tmp[i]) {
inc = 0;
}
@@ -71,19 +75,18 @@ void PQCLEAN_HQCRMRS128_AVX2_vect_set_random_fixed_weight(AES_XOF_struct *ctx, u
bloc = tmp[i] >> 6;
bloc256[i] = _mm256_set1_epi64x(bloc >> 2);
pos = (bloc & 0x3UL);
__m256i pos256 = _mm256_set1_epi64x(pos);
__m256i mask256 = _mm256_cmpeq_epi64(pos256, posCmp256);
pos256 = _mm256_set1_epi64x(pos);
mask256 = _mm256_cmpeq_epi64(pos256, posCmp256);
bit64 = 1ULL << (tmp[i] & 0x3f);
__m256i bloc256 = _mm256_set1_epi64x(bit64);
bit256[i] = bloc256 & mask256;
bit256[i] = _mm256_set1_epi64x(bit64)&mask256;
}

for (i = 0; i < CEIL_DIVIDE(PARAM_N, 256); i++) {
__m256i aux = _mm256_loadu_si256(((__m256i *)v) + i);
__m256i i256 = _mm256_set1_epi64x(i);
aux = _mm256_loadu_si256(((__m256i *)v) + i);
i256 = _mm256_set1_epi64x(i);

for (j = 0; j < weight; j++) {
__m256i mask256 = _mm256_cmpeq_epi64(bloc256[j], i256);
mask256 = _mm256_cmpeq_epi64(bloc256[j], i256);
aux ^= bit256[j] & mask256;
}
_mm256_storeu_si256(((__m256i *)v) + i, aux);
@@ -148,7 +151,6 @@ uint8_t PQCLEAN_HQCRMRS128_AVX2_vect_compare(const uint8_t *v1, const uint8_t *v




/**
* @brief Resize a vector so that it contains <b>size_o</b> bits
*


+ 1
- 1
crypto_kem/hqc-rmrs-128/clean/Makefile View File

@@ -4,7 +4,7 @@ LIB=libhqc-rmrs-128_clean.a
HEADERS=api.h code.h fft.h gf2x.h gf.h hqc.h parameters.h parsing.h reed_muller.h reed_solomon.h vector.h
OBJECTS=code.o fft.o gf2x.o gf.o hqc.o kem.o parsing.o reed_muller.o reed_solomon.o vector.o

CFLAGS=-O3 -Wall -Wextra -Wpedantic -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)
CFLAGS=-O3 -Wall -Wextra -Wpedantic -Wshadow -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)

all: $(LIB)



+ 2
- 2
crypto_kem/hqc-rmrs-192/META.yml View File

@@ -22,9 +22,9 @@ principal-submitters:
- Loïc Bidoux
implementations:
- name: clean
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/22134db4/hqc
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/09ab89ed/hqc
- name: avx2
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/22134db4/hqc
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/09ab89ed/hqc
supported_platforms:
- architecture: x86_64
operating_systems:


+ 1
- 1
crypto_kem/hqc-rmrs-192/avx2/Makefile View File

@@ -4,7 +4,7 @@ LIB=libhqc-rmrs-192_avx2.a
HEADERS=api.h code.h fft.h gf2x.h gf.h hqc.h parameters.h parsing.h reed_muller.h reed_solomon.h vector.h
OBJECTS=code.o fft.o gf2x.o gf.o hqc.o kem.o parsing.o reed_muller.o reed_solomon.o vector.o

CFLAGS=-O3 -mavx2 -mbmi -mpclmul -Wall -Wextra -Wpedantic -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)
CFLAGS=-O3 -mavx2 -mbmi -mpclmul -Wall -Wextra -Wshadow -Wpedantic -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)

all: $(LIB)



+ 12
- 10
crypto_kem/hqc-rmrs-192/avx2/vector.c View File

@@ -36,9 +36,13 @@ void PQCLEAN_HQCRMRS192_AVX2_vect_set_random_fixed_weight(AES_XOF_struct *ctx, u
__m256i bit256[PARAM_OMEGA_R];
__m256i bloc256[PARAM_OMEGA_R];
__m256i posCmp256 = _mm256_set_epi64x(3, 2, 1, 0);
__m256i pos256;
__m256i mask256;
__m256i aux;
__m256i i256;
uint64_t bloc, pos, bit64;
uint8_t inc;
size_t i, j;
size_t i, j, k;

i = 0;
j = random_bytes_size;
@@ -58,7 +62,7 @@ void PQCLEAN_HQCRMRS192_AVX2_vect_set_random_fixed_weight(AES_XOF_struct *ctx, u
tmp[i] = tmp[i] % PARAM_N;

inc = 1;
for (uint32_t k = 0; k < i; k++) {
for (k = 0; k < i; k++) {
if (tmp[k] == tmp[i]) {
inc = 0;
}
@@ -71,19 +75,18 @@ void PQCLEAN_HQCRMRS192_AVX2_vect_set_random_fixed_weight(AES_XOF_struct *ctx, u
bloc = tmp[i] >> 6;
bloc256[i] = _mm256_set1_epi64x(bloc >> 2);
pos = (bloc & 0x3UL);
__m256i pos256 = _mm256_set1_epi64x(pos);
__m256i mask256 = _mm256_cmpeq_epi64(pos256, posCmp256);
pos256 = _mm256_set1_epi64x(pos);
mask256 = _mm256_cmpeq_epi64(pos256, posCmp256);
bit64 = 1ULL << (tmp[i] & 0x3f);
__m256i bloc256 = _mm256_set1_epi64x(bit64);
bit256[i] = bloc256 & mask256;
bit256[i] = _mm256_set1_epi64x(bit64)&mask256;
}

for (i = 0; i < CEIL_DIVIDE(PARAM_N, 256); i++) {
__m256i aux = _mm256_loadu_si256(((__m256i *)v) + i);
__m256i i256 = _mm256_set1_epi64x(i);
aux = _mm256_loadu_si256(((__m256i *)v) + i);
i256 = _mm256_set1_epi64x(i);

for (j = 0; j < weight; j++) {
__m256i mask256 = _mm256_cmpeq_epi64(bloc256[j], i256);
mask256 = _mm256_cmpeq_epi64(bloc256[j], i256);
aux ^= bit256[j] & mask256;
}
_mm256_storeu_si256(((__m256i *)v) + i, aux);
@@ -148,7 +151,6 @@ uint8_t PQCLEAN_HQCRMRS192_AVX2_vect_compare(const uint8_t *v1, const uint8_t *v




/**
* @brief Resize a vector so that it contains <b>size_o</b> bits
*


+ 1
- 1
crypto_kem/hqc-rmrs-192/clean/Makefile View File

@@ -4,7 +4,7 @@ LIB=libhqc-rmrs-192_clean.a
HEADERS=api.h code.h fft.h gf2x.h gf.h hqc.h parameters.h parsing.h reed_muller.h reed_solomon.h vector.h
OBJECTS=code.o fft.o gf2x.o gf.o hqc.o kem.o parsing.o reed_muller.o reed_solomon.o vector.o

CFLAGS=-O3 -Wall -Wextra -Wpedantic -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)
CFLAGS=-O3 -Wall -Wextra -Wpedantic -Wshadow -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)

all: $(LIB)



+ 2
- 2
crypto_kem/hqc-rmrs-256/META.yml View File

@@ -22,9 +22,9 @@ principal-submitters:
- Loïc Bidoux
implementations:
- name: clean
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/22134db4/hqc
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/09ab89ed/hqc
- name: avx2
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/22134db4/hqc
version: hqc-submission_2020-05-29 via https://github.com/jschanck/package-pqclean/tree/09ab89ed/hqc
supported_platforms:
- architecture: x86_64
operating_systems:


+ 1
- 1
crypto_kem/hqc-rmrs-256/avx2/Makefile View File

@@ -4,7 +4,7 @@ LIB=libhqc-rmrs-256_avx2.a
HEADERS=api.h code.h fft.h gf2x.h gf.h hqc.h parameters.h parsing.h reed_muller.h reed_solomon.h vector.h
OBJECTS=code.o fft.o gf2x.o gf.o hqc.o kem.o parsing.o reed_muller.o reed_solomon.o vector.o

CFLAGS=-O3 -mavx2 -mbmi -mpclmul -Wall -Wextra -Wpedantic -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)
CFLAGS=-O3 -mavx2 -mbmi -mpclmul -Wall -Wextra -Wshadow -Wpedantic -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)

all: $(LIB)



+ 12
- 10
crypto_kem/hqc-rmrs-256/avx2/vector.c View File

@@ -36,9 +36,13 @@ void PQCLEAN_HQCRMRS256_AVX2_vect_set_random_fixed_weight(AES_XOF_struct *ctx, u
__m256i bit256[PARAM_OMEGA_R];
__m256i bloc256[PARAM_OMEGA_R];
__m256i posCmp256 = _mm256_set_epi64x(3, 2, 1, 0);
__m256i pos256;
__m256i mask256;
__m256i aux;
__m256i i256;
uint64_t bloc, pos, bit64;
uint8_t inc;
size_t i, j;
size_t i, j, k;

i = 0;
j = random_bytes_size;
@@ -58,7 +62,7 @@ void PQCLEAN_HQCRMRS256_AVX2_vect_set_random_fixed_weight(AES_XOF_struct *ctx, u
tmp[i] = tmp[i] % PARAM_N;

inc = 1;
for (uint32_t k = 0; k < i; k++) {
for (k = 0; k < i; k++) {
if (tmp[k] == tmp[i]) {
inc = 0;
}
@@ -71,19 +75,18 @@ void PQCLEAN_HQCRMRS256_AVX2_vect_set_random_fixed_weight(AES_XOF_struct *ctx, u
bloc = tmp[i] >> 6;
bloc256[i] = _mm256_set1_epi64x(bloc >> 2);
pos = (bloc & 0x3UL);
__m256i pos256 = _mm256_set1_epi64x(pos);
__m256i mask256 = _mm256_cmpeq_epi64(pos256, posCmp256);
pos256 = _mm256_set1_epi64x(pos);
mask256 = _mm256_cmpeq_epi64(pos256, posCmp256);
bit64 = 1ULL << (tmp[i] & 0x3f);
__m256i bloc256 = _mm256_set1_epi64x(bit64);
bit256[i] = bloc256 & mask256;
bit256[i] = _mm256_set1_epi64x(bit64)&mask256;
}

for (i = 0; i < CEIL_DIVIDE(PARAM_N, 256); i++) {
__m256i aux = _mm256_loadu_si256(((__m256i *)v) + i);
__m256i i256 = _mm256_set1_epi64x(i);
aux = _mm256_loadu_si256(((__m256i *)v) + i);
i256 = _mm256_set1_epi64x(i);

for (j = 0; j < weight; j++) {
__m256i mask256 = _mm256_cmpeq_epi64(bloc256[j], i256);
mask256 = _mm256_cmpeq_epi64(bloc256[j], i256);
aux ^= bit256[j] & mask256;
}
_mm256_storeu_si256(((__m256i *)v) + i, aux);
@@ -148,7 +151,6 @@ uint8_t PQCLEAN_HQCRMRS256_AVX2_vect_compare(const uint8_t *v1, const uint8_t *v




/**
* @brief Resize a vector so that it contains <b>size_o</b> bits
*


+ 1
- 1
crypto_kem/hqc-rmrs-256/clean/Makefile View File

@@ -4,7 +4,7 @@ LIB=libhqc-rmrs-256_clean.a
HEADERS=api.h code.h fft.h gf2x.h gf.h hqc.h parameters.h parsing.h reed_muller.h reed_solomon.h vector.h
OBJECTS=code.o fft.o gf2x.o gf.o hqc.o kem.o parsing.o reed_muller.o reed_solomon.o vector.o

CFLAGS=-O3 -Wall -Wextra -Wpedantic -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)
CFLAGS=-O3 -Wall -Wextra -Wpedantic -Wshadow -Wvla -Werror -Wredundant-decls -Wmissing-prototypes -std=c99 -I../../../common $(EXTRAFLAGS)

all: $(LIB)



Loading…
Cancel
Save