Browse Source

fixed compile warnings / errors

pull/253/head
Logan007 4 years ago
parent
commit
84f389d6d4
  1. 25
      speck.c
  2. 1
      speck.h

25
speck.c

@ -8,15 +8,12 @@
#include "speck.h" #include "speck.h"
#if defined (__AVX2__) // AVX support ---------------------------------------------------- #if defined (__AVX2__) // AVX support ----------------------------------------------------
#include <immintrin.h> #include <immintrin.h>
#define u32 uint32_t
#define u64 uint64_t
#define u256 __m256i
#define LCS(x,r) (((x)<<r)|((x)>>(64-r))) #define LCS(x,r) (((x)<<r)|((x)>>(64-r)))
#define RCS(x,r) (((x)>>r)|((x)<<(64-r))) #define RCS(x,r) (((x)>>r)|((x)<<(64-r)))
@ -220,12 +217,6 @@ int speck_expand_key (const unsigned char *k, speck_context_t *ctx) {
#include <immintrin.h> #include <immintrin.h>
#define SPECK_CTX_BYVAL 1
#define u32 unsigned
#define u64 unsigned long long
#define u128 __m128i
#define LCS(x,r) (((x)<<r)|((x)>>(64-r))) #define LCS(x,r) (((x)<<r)|((x)>>(64-r)))
#define RCS(x,r) (((x)>>r)|((x)<<(64-r))) #define RCS(x,r) (((x)>>r)|((x)<<(64-r)))
@ -295,11 +286,6 @@ int speck_expand_key (const unsigned char *k, speck_context_t *ctx) {
RK(B,A,k,key,21), RK(C,A,k,key,22), RK(D,A,k,key,23), RK(B,A,k,key,24), RK(C,A,k,key,25), RK(D,A,k,key,26), RK(B,A,k,key,27), \ RK(B,A,k,key,21), RK(C,A,k,key,22), RK(D,A,k,key,23), RK(B,A,k,key,24), RK(C,A,k,key,25), RK(D,A,k,key,26), RK(B,A,k,key,27), \
RK(C,A,k,key,28), RK(D,A,k,key,29), RK(B,A,k,key,30), RK(C,A,k,key,31), RK(D,A,k,key,32), RK(B,A,k,key,33)) RK(C,A,k,key,28), RK(D,A,k,key,29), RK(B,A,k,key,30), RK(C,A,k,key,31), RK(D,A,k,key,32), RK(B,A,k,key,33))
typedef struct {
u128 rk[34];
u64 key[34];
} speck_context_t;
static int speck_encrypt_xor (unsigned char *out, const unsigned char *in, u64 nonce[], const speck_context_t ctx, int numbytes) { static int speck_encrypt_xor (unsigned char *out, const unsigned char *in, u64 nonce[], const speck_context_t ctx, int numbytes) {
@ -415,10 +401,6 @@ int speck_expand_key (const unsigned char *k, speck_context_t *ctx) {
#include <arm_neon.h> #include <arm_neon.h>
#define u32 uint32_t
#define u64 uint64_t
#define u128 uint64x2_t
#define LCS(x,r) (((x)<<r)|((x)>>(64-r))) #define LCS(x,r) (((x)<<r)|((x)>>(64-r)))
#define RCS(x,r) (((x)>>r)|((x)<<(64-r))) #define RCS(x,r) (((x)>>r)|((x)<<(64-r)))
@ -479,11 +461,6 @@ int speck_expand_key (const unsigned char *k, speck_context_t *ctx) {
RK(B,A,k,key,21), RK(C,A,k,key,22), RK(D,A,k,key,23), RK(B,A,k,key,24), RK(C,A,k,key,25), RK(D,A,k,key,26), RK(B,A,k,key,27), \ RK(B,A,k,key,21), RK(C,A,k,key,22), RK(D,A,k,key,23), RK(B,A,k,key,24), RK(C,A,k,key,25), RK(D,A,k,key,26), RK(B,A,k,key,27), \
RK(C,A,k,key,28), RK(D,A,k,key,29), RK(B,A,k,key,30), RK(C,A,k,key,31), RK(D,A,k,key,32), RK(B,A,k,key,33)) RK(C,A,k,key,28), RK(D,A,k,key,29), RK(B,A,k,key,30), RK(C,A,k,key,31), RK(D,A,k,key,32), RK(B,A,k,key,33))
typedef struct {
u128 rk[34];
u64 key[34];
} speck_context_t;
static int speck_encrypt_xor (unsigned char *out, const unsigned char *in, u64 nonce[], speck_context_t *ctx, int numbytes) { static int speck_encrypt_xor (unsigned char *out, const unsigned char *in, u64 nonce[], speck_context_t *ctx, int numbytes) {

1
speck.h

@ -7,6 +7,7 @@
#define htole64(x) OSSwapHostToLittleInt64(x) #define htole64(x) OSSwapHostToLittleInt64(x)
#endif #endif
#define u32 uint32_t
#define u64 uint64_t #define u64 uint64_t
#if defined (__AVX2__) #if defined (__AVX2__)

Loading…
Cancel
Save