|
|
@ -6,6 +6,7 @@ |
|
|
|
#include <stdlib.h> |
|
|
|
#include <stdint.h> |
|
|
|
|
|
|
|
#include "speck.h" |
|
|
|
|
|
|
|
#if defined (__AVX2__) // AVX support ----------------------------------------------------
|
|
|
|
|
|
|
@ -606,10 +607,6 @@ int speck_expand_key (const unsigned char *k, speck_context_t *ctx) { |
|
|
|
#define ROL64(x,r) (((x)<<(r))|((x)>>(64-(r)))) |
|
|
|
#define R(x,y,k) (x=ROR64(x,8), x+=y, x^=k, y=ROL64(y,3), y^=x) |
|
|
|
|
|
|
|
typedef struct { |
|
|
|
u64 key[34]; |
|
|
|
} speck_context_t; |
|
|
|
|
|
|
|
|
|
|
|
static int speck_encrypt (u64 *u, u64 *v, speck_context_t *ctx) { |
|
|
|
|
|
|
@ -709,10 +706,10 @@ int speck_test () { |
|
|
|
speck_ctr (pt, pt, 16, iv, &ctx); |
|
|
|
#endif |
|
|
|
u64 i; |
|
|
|
// fprintf (stderr, "rk00: %016llx\n", ctx.key[0]);
|
|
|
|
// fprintf (stderr, "rk33: %016llx\n", ctx.key[33]);
|
|
|
|
// fprintf (stderr, "out : %016lx\n", *(uint64_t*)pt);
|
|
|
|
// fprintf (stderr, "mem : " ); for (i=0; i < 16; i++) fprintf (stderr, "%02x ", pt[i]); fprintf (stderr, "\n");
|
|
|
|
// fprintf (stderr, "rk00: %016llx\n", ctx.key[0]);
|
|
|
|
// fprintf (stderr, "rk33: %016llx\n", ctx.key[33]);
|
|
|
|
// fprintf (stderr, "out : %016lx\n", *(uint64_t*)pt);
|
|
|
|
// fprintf (stderr, "mem : " ); for (i=0; i < 16; i++) fprintf (stderr, "%02x ", pt[i]); fprintf (stderr, "\n");
|
|
|
|
|
|
|
|
int ret = 1; |
|
|
|
for (i=0; i < 16; i++) |
|
|
@ -722,8 +719,8 @@ int speck_test () { |
|
|
|
} |
|
|
|
|
|
|
|
/*
|
|
|
|
int main (int argc, char* argv[]) { |
|
|
|
int main (int argc, char* argv[]) { |
|
|
|
|
|
|
|
fprintf (stdout, "SPECK SELF TEST RESULT: %u\n", speck_test (0,NULL)); |
|
|
|
} |
|
|
|
} |
|
|
|
*/ |
|
|
|