Fix compilation, still needs more work.
This commit is contained in:
@@ -1,2 +0,0 @@
|
|||||||
__PYCACHE__
|
|
||||||
.*
|
|
||||||
@@ -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) \
|
#define VEC4_ROT(A, IMM) \
|
||||||
_mm_or_si128(_mm_slli_epi32(A, IMM), _mm_srli_epi32(A, (32 - IMM)))
|
_mm_or_si128(_mm_slli_epi32(A, IMM), _mm_srli_epi32(A, (32 - IMM)))
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
#include <immintrin.h> // AVX2
|
||||||
|
#include <tmmintrin.h> // SSSE3
|
||||||
|
|
||||||
#define VEC8_ROT(A, IMM) \
|
#define VEC8_ROT(A, IMM) \
|
||||||
_mm256_or_si256(_mm256_slli_epi32(A, IMM), _mm256_srli_epi32(A, (32 - IMM)))
|
_mm256_or_si256(_mm256_slli_epi32(A, IMM), _mm256_srli_epi32(A, (32 - IMM)))
|
||||||
|
|
||||||
|
|||||||
+4
-13
@@ -1,7 +1,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
static const uint64_t CHA_BLOCK_SIZE = 64;
|
#define CHA_BLOCK_SIZE 64
|
||||||
|
|
||||||
typedef struct cha_ctx {
|
typedef struct cha_ctx {
|
||||||
uint32_t state[16];
|
uint32_t state[16];
|
||||||
@@ -15,20 +15,11 @@ typedef struct cha_ctx {
|
|||||||
#pragma GCC target("ssse3")
|
#pragma GCC target("ssse3")
|
||||||
#pragma GCC target("avx2")
|
#pragma GCC target("avx2")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <emmintrin.h> // SSE2
|
|
||||||
#include "cha4block.h"
|
|
||||||
|
|
||||||
#include <immintrin.h> // AVX2
|
|
||||||
#include <tmmintrin.h> // SSSE3
|
|
||||||
#include "cha8block.h"
|
#include "cha8block.h"
|
||||||
|
|
||||||
#elif defined(__aarch64__)
|
|
||||||
#include "sse2neon.h"
|
|
||||||
#include "cha4block.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "cha1block.h"
|
#include "cha1block.h"
|
||||||
|
#include "cha4block.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
@@ -40,7 +31,6 @@ typedef struct cha_ctx {
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
/// @brief Initialize cha_ctx
|
/// @brief Initialize cha_ctx
|
||||||
/// @param ctx holds ChaCha20 state
|
/// @param ctx holds ChaCha20 state
|
||||||
/// @param key 32 byte key
|
/// @param key 32 byte key
|
||||||
@@ -79,7 +69,8 @@ void cha_update(cha_ctx* ctx, uint8_t* out, uint64_t outlen) {
|
|||||||
if (ctx->uncount) {
|
if (ctx->uncount) {
|
||||||
memmove(ctx->unconsumed, ctx->unconsumed + N, ctx->uncount);
|
memmove(ctx->unconsumed, ctx->unconsumed + N, ctx->uncount);
|
||||||
}
|
}
|
||||||
if (c == out + outlen) return;
|
if (c == out + outlen)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
#if defined(__x86_64__)
|
#if defined(__x86_64__)
|
||||||
// TODO: Handle resume if we are not at block boundary
|
// TODO: Handle resume if we are not at block boundary
|
||||||
|
|||||||
Reference in New Issue
Block a user