1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-11-30 03:11:43 +00:00
pqcrypto/crypto_kem/mceliece460896/avx/vec128.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

42 lines
1.7 KiB
C

#ifndef PQCLEAN_MCELIECE460896_AVX_VEC128_H
#define PQCLEAN_MCELIECE460896_AVX_VEC128_H
/*
This file is for functions related to 128-bit vectors
including functions for bitsliced field operations
*/
#include "params.h"
#include <immintrin.h>
#include <stdint.h>
typedef __m128i vec128;
// this needs to be a macro, because
// _mm_extract_epi64 requires a literal int argument.
#define PQCLEAN_MCELIECE460896_AVX_vec128_extract(a, i) ((uint64_t) _mm_extract_epi64((vec128) (a), (i)))
int PQCLEAN_MCELIECE460896_AVX_vec128_testz(vec128 a);
vec128 PQCLEAN_MCELIECE460896_AVX_vec128_set1_16b(uint16_t a);
vec128 PQCLEAN_MCELIECE460896_AVX_vec128_setzero(void);
vec128 PQCLEAN_MCELIECE460896_AVX_vec128_and(vec128 a, vec128 b);
vec128 PQCLEAN_MCELIECE460896_AVX_vec128_xor(vec128 a, vec128 b);
vec128 PQCLEAN_MCELIECE460896_AVX_vec128_or(vec128 a, vec128 b);
vec128 PQCLEAN_MCELIECE460896_AVX_vec128_sll_2x(vec128 a, int s);
vec128 PQCLEAN_MCELIECE460896_AVX_vec128_srl_2x(vec128 a, int s);
vec128 PQCLEAN_MCELIECE460896_AVX_vec128_set2x(uint64_t a0, uint64_t a1);
vec128 PQCLEAN_MCELIECE460896_AVX_vec128_unpack_low(vec128 a, vec128 b);
vec128 PQCLEAN_MCELIECE460896_AVX_vec128_unpack_high(vec128 a, vec128 b);
vec128 PQCLEAN_MCELIECE460896_AVX_vec128_setbits(uint64_t a);
void PQCLEAN_MCELIECE460896_AVX_vec128_copy(vec128 *dest, const vec128 *src);
void PQCLEAN_MCELIECE460896_AVX_vec128_add(vec128 *c, const vec128 *a, const vec128 *b);
vec128 PQCLEAN_MCELIECE460896_AVX_vec128_or_reduce(const vec128 *a);
extern void PQCLEAN_MCELIECE460896_AVX_vec128_mul_asm(vec128 *, vec128 *, const vec128 *, int);
/* bitsliced field multiplications */
void PQCLEAN_MCELIECE460896_AVX_vec128_mul(vec128 *h, vec128 *f, const vec128 *g);
#endif