Skip to content

Commit

Permalink
Merge pull request #503 from PQClean/fix-mceliece
Browse files Browse the repository at this point in the history
Fix mceliece warnings and errors
  • Loading branch information
thomwiggers committed Sep 12, 2023
2 parents 1379024 + da93bbc commit afcebe3
Show file tree
Hide file tree
Showing 710 changed files with 20 additions and 1,172 deletions.
1 change: 0 additions & 1 deletion crypto_kem/mceliece348864/avx2/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#define PQCLEAN_MCELIECE348864_AVX2_CRYPTO_CIPHERTEXTBYTES 96
#define PQCLEAN_MCELIECE348864_AVX2_CRYPTO_BYTES 32


int PQCLEAN_MCELIECE348864_AVX2_crypto_kem_enc(
uint8_t *c,
uint8_t *key,
Expand Down
1 change: 0 additions & 1 deletion crypto_kem/mceliece348864/avx2/benes.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,4 +286,3 @@ void benes(uint64_t *r, uint64_t cond[][32], int rev) {

transpose_64x64(bs);
}

2 changes: 0 additions & 2 deletions crypto_kem/mceliece348864/avx2/benes.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
This file is for Benes network related functions
*/


#include "namespace.h"

#define benes CRYPTO_NAMESPACE(benes)
Expand All @@ -16,4 +15,3 @@ void load_bits(uint64_t out[][32], const unsigned char *bits);
void benes(uint64_t *r, uint64_t cond[][32], int rev);

#endif

1 change: 0 additions & 1 deletion crypto_kem/mceliece348864/avx2/bm.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,3 @@ void bm(uint64_t out[ GFBITS ], vec128 in[ GFBITS ]) {

vec_mul_sp(out, out, &BC[0][0]);
}

2 changes: 0 additions & 2 deletions crypto_kem/mceliece348864/avx2/bm.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
see https://ieeexplore.ieee.org/document/87857
*/


#include "namespace.h"

#define bm CRYPTO_NAMESPACE(bm)
Expand All @@ -15,4 +14,3 @@
void bm(uint64_t out[GFBITS], vec128 in[GFBITS]);

#endif

1 change: 0 additions & 1 deletion crypto_kem/mceliece348864/avx2/consts.S
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,3 @@ MASK5_0:
.quad 0x00000000FFFFFFFF, 0x00000000FFFFFFFF, 0x00000000FFFFFFFF, 0x00000000FFFFFFFF
MASK5_1:
.quad 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000, 0xFFFFFFFF00000000

3 changes: 1 addition & 2 deletions crypto_kem/mceliece348864/avx2/controlbits.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ static void cbrecursion(unsigned char *out, long long pos, long long step, const
/* output: the result of apply the control bits to p */
static void layer(int16_t *p, const unsigned char *cb, int s, int n) {
int i, j;
int stride = 1 << (uint8_t)s;
int stride = 1 << (uint8_t)(s & 0x1F);
int index = 0;
int16_t d, m;

Expand Down Expand Up @@ -245,4 +245,3 @@ void controlbitsfrompermutation(unsigned char *out, const int16 *pi, long long w
}
}
}

2 changes: 0 additions & 2 deletions crypto_kem/mceliece348864/avx2/controlbits.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
/* See David Nassimi, Sartaj Sahni "Parallel algorithms to set up the Benes permutationnetwork" */
/* See also https://cr.yp.to/papers/controlbits-20200923.pdf */


#include "namespace.h"


#define controlbitsfrompermutation CRYPTO_NAMESPACE(controlbitsfrompermutation)

#include <inttypes.h>
Expand Down
2 changes: 0 additions & 2 deletions crypto_kem/mceliece348864/avx2/crypto_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
#define crypto_hash_32b(out, in, inlen) \
shake256(out, 32, in, inlen)


#define shake(out,outlen,in,inlen) \
shake256(out, outlen, in, inlen)


#endif
1 change: 0 additions & 1 deletion crypto_kem/mceliece348864/avx2/crypto_uint16.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,3 @@ void crypto_uint16_minmax(crypto_uint16 *crypto_uint16_a, crypto_uint16 *crypto_
*crypto_uint16_a = crypto_uint16_x ^ crypto_uint16_z;
*crypto_uint16_b = crypto_uint16_y ^ crypto_uint16_z;
}

1 change: 0 additions & 1 deletion crypto_kem/mceliece348864/avx2/crypto_uint32.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,3 @@ void crypto_uint32_minmax(crypto_uint32 *crypto_uint32_a, crypto_uint32 *crypto_
*crypto_uint32_a = crypto_uint32_x ^ crypto_uint32_z;
*crypto_uint32_b = crypto_uint32_y ^ crypto_uint32_z;
}

1 change: 0 additions & 1 deletion crypto_kem/mceliece348864/avx2/crypto_uint64.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,3 @@ void crypto_uint64_minmax(crypto_uint64 *crypto_uint64_a, crypto_uint64 *crypto_
*crypto_uint64_a = crypto_uint64_x ^ crypto_uint64_z;
*crypto_uint64_b = crypto_uint64_y ^ crypto_uint64_z;
}

2 changes: 0 additions & 2 deletions crypto_kem/mceliece348864/avx2/decrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,5 @@ int decrypt(unsigned char *e, const unsigned char *sk, const unsigned char *s) {

check_weight = weight_check(e, error128);


return 1 - (check_synd & check_weight);
}

2 changes: 0 additions & 2 deletions crypto_kem/mceliece348864/avx2/decrypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
This file is for Niederreiter decryption
*/


#include "namespace.h"

#define decrypt CRYPTO_NAMESPACE(decrypt)

int decrypt(unsigned char *e, const unsigned char *sk, const unsigned char *s);

#endif

3 changes: 0 additions & 3 deletions crypto_kem/mceliece348864/avx2/encrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
This file is for Niederreiter encryption
*/


#include "util.h"
#include "crypto_declassify.h"
#include "crypto_uint16.h"
Expand Down Expand Up @@ -115,7 +114,5 @@ static void gen_e(unsigned char *e) {
void encrypt(unsigned char *s, const unsigned char *pk, unsigned char *e) {
gen_e(e);


syndrome_asm(s, pk, e);
}

2 changes: 0 additions & 2 deletions crypto_kem/mceliece348864/avx2/encrypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
This file is for Niederreiter encryption
*/


#include "namespace.h"

#define encrypt CRYPTO_NAMESPACE(encrypt)

void encrypt(unsigned char *s, const unsigned char *pk, unsigned char *e);

#endif

1 change: 0 additions & 1 deletion crypto_kem/mceliece348864/avx2/fft.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,3 @@ void fft(vec256 out[][ GFBITS ], uint64_t *in) {
radix_conversions(in);
butterflies(out, in);
}

2 changes: 0 additions & 2 deletions crypto_kem/mceliece348864/avx2/fft.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
sse http://www.math.clemson.edu/~sgao/papers/GM10.pdf
*/


#include "namespace.h"

#define fft CRYPTO_NAMESPACE(fft)
Expand All @@ -18,4 +17,3 @@
void fft(vec256 out[][GFBITS], uint64_t *in);

#endif

1 change: 0 additions & 1 deletion crypto_kem/mceliece348864/avx2/fft_tr.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,4 +355,3 @@ void fft_tr(vec128 out[GFBITS], vec256 in[][ GFBITS ]) {
butterflies_tr(out, in);
radix_conversions_tr(out);
}

2 changes: 0 additions & 2 deletions crypto_kem/mceliece348864/avx2/fft_tr.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
This file is for transpose of the Gao-Mateer FFT
*/


#include "namespace.h"

#define fft_tr CRYPTO_NAMESPACE(fft_tr)
Expand All @@ -15,4 +14,3 @@
void fft_tr(vec128 out[GFBITS], vec256 in[][ GFBITS ]);

#endif

1 change: 0 additions & 1 deletion crypto_kem/mceliece348864/avx2/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,3 @@ void GF_mul(gf *out, gf *in0, gf *in1) {
out[i] = prod[i];
}
}

2 changes: 0 additions & 2 deletions crypto_kem/mceliece348864/avx2/gf.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
This file is for functions for field arithmetic
*/


#include "namespace.h"

#define gf_add CRYPTO_NAMESPACE(gf_add)
Expand Down Expand Up @@ -60,4 +59,3 @@ static inline uint64_t gf_mul2(gf a, gf b0, gf b1) {
}

#endif

1 change: 0 additions & 1 deletion crypto_kem/mceliece348864/avx2/int32_sort.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,3 @@ static void int32_sort(int32_t *x, long long n) {
}

#endif

1 change: 0 additions & 1 deletion crypto_kem/mceliece348864/avx2/operations.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,3 @@ int crypto_kem_keypair

return 0;
}

2 changes: 0 additions & 2 deletions crypto_kem/mceliece348864/avx2/operations.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "namespace.h"


#include "crypto_kem.h"

int crypto_kem_enc(
Expand All @@ -25,4 +24,3 @@ int crypto_kem_keypair
);

#endif

2 changes: 0 additions & 2 deletions crypto_kem/mceliece348864/avx2/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "namespace.h"


#define GFBITS 12
#define SYS_N 3488
#define SYS_T 64
Expand All @@ -20,4 +19,3 @@
#define GFMASK ((1 << GFBITS) - 1)

#endif

1 change: 0 additions & 1 deletion crypto_kem/mceliece348864/avx2/pk_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,4 +393,3 @@ int pk_gen(unsigned char *pk, const unsigned char *irr, const uint32_t *perm, in

return 0;
}

2 changes: 0 additions & 2 deletions crypto_kem/mceliece348864/avx2/pk_gen.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
This file is for public-key generation
*/


#include "namespace.h"

#define pk_gen CRYPTO_NAMESPACE(pk_gen)
Expand All @@ -14,4 +13,3 @@
int pk_gen(unsigned char *pk, const unsigned char *irr, const uint32_t *perm, int16_t *pi);

#endif

1 change: 0 additions & 1 deletion crypto_kem/mceliece348864/avx2/sk_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,3 @@ int genpoly_gen(gf *out, gf *f) {

return 0;
}

2 changes: 0 additions & 2 deletions crypto_kem/mceliece348864/avx2/sk_gen.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
This file is for secret-key generation
*/


#include "namespace.h"

#define genpoly_gen CRYPTO_NAMESPACE(genpoly_gen)
Expand All @@ -16,4 +15,3 @@
int genpoly_gen(gf *out, gf *f);

#endif

2 changes: 0 additions & 2 deletions crypto_kem/mceliece348864/avx2/transpose.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
This file is for matrix transposition
*/


#include "namespace.h"

#define transpose_64x128_sp_asm CRYPTO_NAMESPACE(transpose_64x128_sp_asm)
Expand All @@ -28,4 +27,3 @@ static inline void transpose_64x256_sp(vec256 *in) {
}

#endif

2 changes: 0 additions & 2 deletions crypto_kem/mceliece348864/avx2/uint64_sort.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "namespace.h"


#define int64_sort CRYPTO_NAMESPACE(int64_sort)

#include <inttypes.h>
Expand Down Expand Up @@ -51,4 +50,3 @@ static void uint64_sort(uint64_t *x, long long n) {
}

#endif

3 changes: 0 additions & 3 deletions crypto_kem/mceliece348864/avx2/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
This file is for loading/storing data in a little-endian fashion
*/


#include "namespace.h"


#include "gf.h"
#include "vec128.h"

Expand Down Expand Up @@ -114,4 +112,3 @@ static inline void store16(unsigned char *out, vec128 in) {
}

#endif

1 change: 0 additions & 1 deletion crypto_kem/mceliece348864/avx2/vec.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,3 @@ void vec_GF_mul(vec out[ GFBITS ], vec v[ GFBITS ], gf a[ SYS_T ]) {
out[i] = buf[i][0];
}
}

1 change: 0 additions & 1 deletion crypto_kem/mceliece348864/avx2/vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,3 @@ static inline void vec_mul_gf(vec out[ GFBITS ], vec v[ GFBITS ], gf a) {
void vec_GF_mul(vec out[GFBITS], vec v[GFBITS], gf a[SYS_T]);

#endif

2 changes: 0 additions & 2 deletions crypto_kem/mceliece348864/avx2/vec128.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
including functions for bitsliced field operations
*/


#include "namespace.h"

#define vec128_mul_asm CRYPTO_NAMESPACE(vec128_mul_asm)
Expand Down Expand Up @@ -99,4 +98,3 @@ static inline void vec128_mul(vec128 *h, vec128 *f, const vec128 *g) {
}

#endif

2 changes: 0 additions & 2 deletions crypto_kem/mceliece348864/avx2/vec256.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
including functions for bitsliced field operations
*/


#include "namespace.h"

#define vec256_ama_asm CRYPTO_NAMESPACE(vec256_ama_asm)
Expand Down Expand Up @@ -108,4 +107,3 @@ extern void vec256_maa_asm(vec256 *, vec256 *, const vec256 *);
extern void vec256_ama_asm(vec256 *, vec256 *, const vec256 *);

#endif

1 change: 0 additions & 1 deletion crypto_kem/mceliece348864/clean/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#define PQCLEAN_MCELIECE348864_CLEAN_CRYPTO_CIPHERTEXTBYTES 96
#define PQCLEAN_MCELIECE348864_CLEAN_CRYPTO_BYTES 32


int PQCLEAN_MCELIECE348864_CLEAN_crypto_kem_enc(
uint8_t *c,
uint8_t *key,
Expand Down
1 change: 0 additions & 1 deletion crypto_kem/mceliece348864/clean/benes.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,3 @@ void support_gen(gf *s, const unsigned char *c) {
}
}
}

2 changes: 0 additions & 2 deletions crypto_kem/mceliece348864/clean/benes.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
This file is for Benes network related functions
*/


#include "namespace.h"

#define apply_benes CRYPTO_NAMESPACE(apply_benes)
Expand All @@ -16,4 +15,3 @@ void apply_benes(unsigned char *r, const unsigned char *bits, int rev);
void support_gen(gf *s, const unsigned char *c);

#endif

1 change: 0 additions & 1 deletion crypto_kem/mceliece348864/clean/bm.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,3 @@ void bm(gf *out, gf *s) {
out[i] = C[ SYS_T - i ];
}
}

2 changes: 0 additions & 2 deletions crypto_kem/mceliece348864/clean/bm.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
see http://crypto.stanford.edu/~mironov/cs359/massey.pdf
*/


#include "gf.h"
#include "namespace.h"

Expand All @@ -14,4 +13,3 @@
void bm(gf *out, gf *s);

#endif

0 comments on commit afcebe3

Please sign in to comment.