1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-11-24 00:11:27 +00:00
pqcrypto/crypto_kem/mceliece348864f/avx/vec256.h
Thom Wiggers b3f9d4f8d6
Classic McEliece (#259)
* Add McEliece reference implementations

* Add Vec implementations of McEliece

* Add sse implementations

* Add AVX2 implementations

* Get rid of stuff not supported by Mac ABI

* restrict to two cores

* Ditch .data files

* Remove .hidden from all .S files

* speed up duplicate consistency tests by batching

* make cpuinfo more robust

* Hope to stabilize macos cpuinfo without ccache

* Revert "Hope to stabilize macos cpuinfo without ccache"

This reverts commit 6129c3cabe1abbc8b956bc87e902a698e32bf322.

* Just hardcode what's available at travis

* Fixed-size types in api.h

* namespace all header files in mceliece

* Ditch operations.h

* Get rid of static inline functions

* fixup! Ditch operations.h
2020-02-05 13:09:56 +01:00

46 lines
2.1 KiB
C

#ifndef PQCLEAN_MCELIECE348864F_AVX_VEC256_H
#define PQCLEAN_MCELIECE348864F_AVX_VEC256_H
/*
This file is for functions related to 256-bit vectors
including functions for bitsliced field operations
*/
#include "vec128.h"
#include <immintrin.h>
typedef __m256i vec256;
vec256 PQCLEAN_MCELIECE348864F_AVX_vec256_set1_16b(uint16_t a);
vec256 PQCLEAN_MCELIECE348864F_AVX_vec256_setzero(void);
vec256 PQCLEAN_MCELIECE348864F_AVX_vec256_set4x(uint64_t a0, uint64_t a1, uint64_t a2, uint64_t a3);
// Extract requires a literal argument so need to be macros
#define PQCLEAN_MCELIECE348864F_AVX_vec256_extract2x(a,i) ((vec128) _mm256_extractf128_si256((vec256) (a),(i)))
#define PQCLEAN_MCELIECE348864F_AVX_vec256_extract(a,i) ((uint64_t) _mm256_extract_epi64((vec256) (a),(i)))
int PQCLEAN_MCELIECE348864F_AVX_vec256_testz(vec256 a);
vec256 PQCLEAN_MCELIECE348864F_AVX_vec256_and(vec256 a, vec256 b);
vec256 PQCLEAN_MCELIECE348864F_AVX_vec256_xor(vec256 a, vec256 b);
vec256 PQCLEAN_MCELIECE348864F_AVX_vec256_or(vec256 a, vec256 b);
vec256 PQCLEAN_MCELIECE348864F_AVX_vec256_sll_4x(vec256 a, int s);
vec256 PQCLEAN_MCELIECE348864F_AVX_vec256_srl_4x(vec256 a, int s);
vec256 PQCLEAN_MCELIECE348864F_AVX_vec256_unpack_low(vec256 a, vec256 b);
vec256 PQCLEAN_MCELIECE348864F_AVX_vec256_unpack_high(vec256 a, vec256 b);
vec256 PQCLEAN_MCELIECE348864F_AVX_vec256_unpack_low_2x(vec256 a, vec256 b);
vec256 PQCLEAN_MCELIECE348864F_AVX_vec256_unpack_high_2x(vec256 a, vec256 b);
vec256 PQCLEAN_MCELIECE348864F_AVX_vec256_or_reduce(const vec256 *a);
void PQCLEAN_MCELIECE348864F_AVX_vec256_copy(vec256 *dest, const vec256 *src);
/* bitsliced field multiplications */
void PQCLEAN_MCELIECE348864F_AVX_vec256_mul(vec256 *h, vec256 *f, const vec256 *g);
void PQCLEAN_MCELIECE348864F_AVX_vec256_sq(vec256 * /*out*/, const vec256 * /*in*/);
void PQCLEAN_MCELIECE348864F_AVX_vec256_inv(vec256 * /*out*/, const vec256 * /*in*/);
extern void PQCLEAN_MCELIECE348864F_AVX_vec256_maa_asm(vec256 *, vec256 *, const vec256 *);
extern void PQCLEAN_MCELIECE348864F_AVX_vec256_ama_asm(vec256 *, vec256 *, const vec256 *);
#endif