From a1c709324880d99c3e704ea240a3c914c7b2574d Mon Sep 17 00:00:00 2001 From: couturie <raphael.couturier@univ-fcomte.fr> Date: Thu, 24 Aug 2017 19:13:55 +0000 Subject: [PATCH 1/1] new --- LightweightARM/LWARM/Makefile | 22 ++++++++++++++++++++++ LightweightARM/LWARM/lwarm.cpp | 22 +++++++++++----------- 2 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 LightweightARM/LWARM/Makefile diff --git a/LightweightARM/LWARM/Makefile b/LightweightARM/LWARM/Makefile new file mode 100644 index 0000000..b09e44a --- /dev/null +++ b/LightweightARM/LWARM/Makefile @@ -0,0 +1,22 @@ +CXX=g++ +C=gcc +#CFLAGS=-O3 -march=armv8-a+crypto -lrt -ftree-vectorize -flax-vector-conversions -mfpu=crypto-neon-fp-armv8 + +CFLAGS=-O3 -march=armv8-a+crypto+crc -lrt -ftree-vectorize -flax-vector-conversions + + + + +OBJ = pixmap_io.o lwarm.o + +%.o: %.c + $(C) -c -o $@ $< $(CFLAGS) + +%.o: %.cpp + $(CXX) -c -o $@ $< $(CFLAGS) + +lwarm: $(OBJ) + $(CXX) -o $@ $^ $(CFLAGS) + +clean: + rm -rf $(OBJ) lwarm diff --git a/LightweightARM/LWARM/lwarm.cpp b/LightweightARM/LWARM/lwarm.cpp index 8bb9da4..8a736a4 100644 --- a/LightweightARM/LWARM/lwarm.cpp +++ b/LightweightARM/LWARM/lwarm.cpp @@ -418,7 +418,7 @@ void KeyExpansion(uchar *RoundKey, uchar *key, int NN ) } // All other round keys are found from the previous round keys. - while (i < 160) + while (i < 256) { for(j=0;j<4;j++) { @@ -710,7 +710,10 @@ int main(int argc, char** argv) { int NN=128; - unsigned char RoundKey[240]; + unsigned char RoundKey[256]; + for(int i=0;i<256;i++) { + RoundKey[i]=0; + } for(int i=1; i<argc; i++){ if(strncmp(argv[i],"nb",2)==0) nb_test = atoi(&(argv[i][2])); //nb of test @@ -765,24 +768,21 @@ int main(int argc, char** argv) { KeyExpansion(RoundKey, enc_key, NN); - for (size_t i=0; i<240/16; ++i) { - for(int j=0; j<16; j++) { - cout<<(int)RoundKey[i*16+j]<<" "; - } - cout<<endl; + for (size_t i=0; i<256/16; ++i) { + rdkeys[i] = vld1q_u8(&RoundKey[i*16]); + print128_num(rdkeys[i]); } - exit(0); - cout<<"start of useless computation"<<endl; + /* cout<<"start of useless computation"<<endl; double dummy=0; - for(int i=0;i<20000000;i++) { + for(int i=0;i<40000000;i++) { dummy+=0.000000001*log(i+10); } cout<<"end of useless computation"<<dummy<<endl; - + */ int size = 64; uchar DK[size]; -- 2.39.5