From e38c16ec01bf23e02c6bc0c7ee5d046f253125d1 Mon Sep 17 00:00:00 2001 From: couturie Date: Sun, 21 Oct 2018 17:43:01 +0200 Subject: [PATCH 1/1] update of enhanced one round cbc --- .../EnhancedOneRound/enhanced_oneround.cpp | 62 +++++++++++++------ 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/OneRoundIoT/EnhancedOneRound/enhanced_oneround.cpp b/OneRoundIoT/EnhancedOneRound/enhanced_oneround.cpp index 04986d7..954a127 100644 --- a/OneRoundIoT/EnhancedOneRound/enhanced_oneround.cpp +++ b/OneRoundIoT/EnhancedOneRound/enhanced_oneround.cpp @@ -320,18 +320,32 @@ void encrypt_cbc(uchar* seq_in, uchar *seq_out, int len,uchar* RM, int *Pbox, in uchar *RM2; int h2=h*h; + + + + for(int a=0;a>=8; + IV1[a+1]=(mm&255); + mm>>=8; + IV1[a+2]=(mm&255); + mm>>=8; + IV1[a+3]=(mm&255); } for(int a=0;a>=8; + IV2[a+1]=(mm&255); + mm>>=8; + IV2[a+2]=(mm&255); + mm>>=8; + IV2[a+3]=(mm&255); } @@ -430,23 +444,34 @@ void decrypt_cbc(uchar* seq_in, uchar *seq_out, int len, uchar* RM, int *Pbox, i uchar *RM1; uchar *RM2; - - int h2=h*h; for(int a=0;a>=8; + IV1[a+1]=(mm&255); + mm>>=8; + IV1[a+2]=(mm&255); + mm>>=8; + IV1[a+3]=(mm&255); } for(int a=0;a>=8; + IV2[a+1]=(mm&255); + mm>>=8; + IV2[a+2]=(mm&255); + mm>>=8; + IV2[a+3]=(mm&255); } + + + for(int it=0;it