From 08325d5e1ec4c416c5908d9f6c5ca250deefc237 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Couturier?= Date: Sat, 24 Aug 2019 22:17:31 +0200 Subject: [PATCH] update --- OneRoundIoT/NEW/Makefile | 8 ++++++- OneRoundIoT/NEW/scprng.cpp | 45 ++++++++++++++++++++++++++++---------- 2 files changed, 40 insertions(+), 13 deletions(-) diff --git a/OneRoundIoT/NEW/Makefile b/OneRoundIoT/NEW/Makefile index 1e5720f..993c8ac 100644 --- a/OneRoundIoT/NEW/Makefile +++ b/OneRoundIoT/NEW/Makefile @@ -20,12 +20,18 @@ endif scprng.o: scprng.cpp $(CXX) -c -o $@ $< $(CFLAGS) +scprng_old.o: scprng_old.cpp + $(CXX) -c -o $@ $< $(CFLAGS) + scprng: pixmap_io.o scprng.o $(CXX) -o $@ $^ $(CFLAGS) +scprng_old: pixmap_io.o scprng_old.o + $(CXX) -o $@ $^ $(CFLAGS) + clean: - rm -rf *.o scprng + rm -rf *.o scprng scprng_old diff --git a/OneRoundIoT/NEW/scprng.cpp b/OneRoundIoT/NEW/scprng.cpp index e0cc4c4..18a9686 100644 --- a/OneRoundIoT/NEW/scprng.cpp +++ b/OneRoundIoT/NEW/scprng.cpp @@ -192,29 +192,35 @@ void rc4keyperm(uchar *key,int len, int rp,int *sc, int size_DK) { } } +#define ROR64(x,r) (((x)>>(r))|((x)<<(64-(r)))) +#define ROL64(x,r) (((x)<<(r))|((x)>>(64-(r)))) +#define R(x,y,k) (x=ROR64(x,18), x+=y, x^=k, y=ROL64(y,13), y^=x) -void scprng(uint64_t *plain, uint64_t* cipher, int bufsize, int nb_bloc, uint64_t *Val, uchar *Sbox1, uchar *Sbox2, uchar * Sbox3, uchar *Sbox4, int *Pbox, int *Pbox2, int *Pbox3, int *Pbox4, uchar *DK, int delta) { - int update=0; - for(int nb=0;nb