From: couturie Date: Sun, 10 Sep 2017 17:26:58 +0000 (+0200) Subject: new X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Cipher_code.git/commitdiff_plain/0cfc0f796f3128e0c375e90c901ede9dbf7d2a6c?ds=sidebyside;hp=1bae5007d1fabd3147e642352fac765684a7aad6 new --- diff --git a/OneRoundIoT/OneRound/one_round_new.cpp b/OneRoundIoT/OneRound/one_round_new.cpp index 9c58017..2637e31 100644 --- a/OneRoundIoT/OneRound/one_round_new.cpp +++ b/OneRoundIoT/OneRound/one_round_new.cpp @@ -178,19 +178,18 @@ void encrypt_ctr(uchar* seq_in, uchar *seq_out, int len,uchar* RM1,int *Pbox, in fX[a+3]=X[a+3]; } - /* if(it<513) { - for(int a=0;a(seq, seq2,len,RM1,Pbox,PboxRM,Sbox1,Sbox2,0); + } + break; + case 128: + for(i=0;i(seq, seq2,len,RM1,Pbox,PboxRM,Sbox1,Sbox2,1); + else + encrypt<128*128>(seq, seq2,len,RM1,Pbox,PboxRM,Sbox1,Sbox2,0); + } break; } @@ -650,6 +659,14 @@ int main(int argc, char** argv) { decrypt<64*64>(seq2,seq,len,RM2,Pbox,PboxRM,Inv_Sbox1,Inv_Sbox2,0); } break; + case 128: + for(i=0;i(seq2, seq,len,RM2,Pbox,PboxRM,Sbox1,Sbox2,0); + else + decrypt<128*128>(seq2,seq,len,RM2,Pbox,PboxRM,Inv_Sbox1,Inv_Sbox2,0); + } + break; } time+=TimeStop(t); diff --git a/OneRoundIoT/openssl/openssl_evp.c b/OneRoundIoT/openssl/openssl_evp.c index 67bcd2d..4e99565 100644 --- a/OneRoundIoT/openssl/openssl_evp.c +++ b/OneRoundIoT/openssl/openssl_evp.c @@ -57,7 +57,9 @@ int encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key, * In this example we are using 256 bit AES (i.e. a 256 bit key). The * IV size for *most* modes is the same as the block size. For AES this * is 128 bits */ - + static double time=0; + double t=0; + t=TimeStart(); //256 //avant ecb if(ctr) { @@ -68,6 +70,10 @@ int encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key, if(1 != EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv)) handleErrors(); + time+=TimeStop(t); + printf("Time init %f\n",time); + + // int cipherBlockSize = EVP_CIPHER_CTX_block_size(ctx); // printf("INFO(evp_encrypt): block size: %d\n", cipherBlockSize);