Fix compilation, still needs more work.

This commit is contained in:
2023-11-22 05:43:27 +00:00
parent d102fa1d28
commit 998560f5a0
4 changed files with 14 additions and 15 deletions
+7
View File
@@ -1,3 +1,10 @@
#if defined(__x86_64__)
#include <immintrin.h> // AVX2
#include <tmmintrin.h> // SSSE3
#elif defined(__aarch64__)
#include "sse2neon.h"
#endif
#define VEC4_ROT(A, IMM) \
_mm_or_si128(_mm_slli_epi32(A, IMM), _mm_srli_epi32(A, (32 - IMM)))
+3
View File
@@ -1,3 +1,6 @@
#include <immintrin.h> // AVX2
#include <tmmintrin.h> // SSSE3
#define VEC8_ROT(A, IMM) \
_mm256_or_si256(_mm256_slli_epi32(A, IMM), _mm256_srli_epi32(A, (32 - IMM)))
+4 -13
View File
@@ -1,7 +1,7 @@
#include <stdbool.h>
#include <stdint.h>
static const uint64_t CHA_BLOCK_SIZE = 64;
#define CHA_BLOCK_SIZE 64
typedef struct cha_ctx {
uint32_t state[16];
@@ -15,20 +15,11 @@ typedef struct cha_ctx {
#pragma GCC target("ssse3")
#pragma GCC target("avx2")
#endif
#include <emmintrin.h> // SSE2
#include "cha4block.h"
#include <immintrin.h> // AVX2
#include <tmmintrin.h> // SSSE3
#include "cha8block.h"
#elif defined(__aarch64__)
#include "sse2neon.h"
#include "cha4block.h"
#endif
#include "cha1block.h"
#include "cha4block.h"
#include <assert.h>
#include <stdbool.h>
@@ -40,7 +31,6 @@ typedef struct cha_ctx {
#include <time.h>
#include <unistd.h>
/// @brief Initialize cha_ctx
/// @param ctx holds ChaCha20 state
/// @param key 32 byte key
@@ -79,7 +69,8 @@ void cha_update(cha_ctx* ctx, uint8_t* out, uint64_t outlen) {
if (ctx->uncount) {
memmove(ctx->unconsumed, ctx->unconsumed + N, ctx->uncount);
}
if (c == out + outlen) return;
if (c == out + outlen)
return;
}
#if defined(__x86_64__)
// TODO: Handle resume if we are not at block boundary