]> AND Private Git Repository - Cipher_code.git/commitdiff
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
new
authorcouturie <couturie@extinction>
Fri, 18 Aug 2017 13:25:28 +0000 (15:25 +0200)
committercouturie <couturie@extinction>
Fri, 18 Aug 2017 13:25:28 +0000 (15:25 +0200)
OneRoundIoT/OneRound/Makefile [new file with mode: 0644]
OneRoundIoT/openssl/Makefile [new file with mode: 0644]
OneRoundIoT/openssl/openssl_evp.c

diff --git a/OneRoundIoT/OneRound/Makefile b/OneRoundIoT/OneRound/Makefile
new file mode 100644 (file)
index 0000000..8aa0484
--- /dev/null
@@ -0,0 +1,16 @@
+CXX=g++
+C=gcc
+CFLAGS=-O3  -std=c++11
+OBJ = pixmap_io.o one_round_new.o 
+
+%.o: %.c 
+       $(C) -c -o $@ $< $(CFLAGS)
+
+%.o: %.cpp 
+       $(CXX) -c -o $@ $< $(CFLAGS)
+
+one_round_new: $(OBJ)
+       $(CXX) -o $@ $^ $(CFLAGS)
+
+clean:
+       rm -rf $(OBJ) one_round_new
diff --git a/OneRoundIoT/openssl/Makefile b/OneRoundIoT/openssl/Makefile
new file mode 100644 (file)
index 0000000..d123b57
--- /dev/null
@@ -0,0 +1,15 @@
+C=gcc
+CFLAGS= -I /usr/include/openssl/ -lcrypto -O3 -std=c99
+OBJ =    pixmap_io.o openssl_evp.o
+
+
+openssl_evp: $(OBJ)
+       $(C) -o $@ $^ $(CFLAGS)
+
+
+%.o: %.c 
+       $(C) -c -o $@ $< 
+
+
+clean:
+       rm -rf $(OBJ)  openssl_evp
index 3c1416ffb16a0a1c8c78d053717aaa7cb4d6307a..b452b9ae6b4d3811070c65462c404c407b253c5d 100644 (file)
@@ -60,10 +60,11 @@ int encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key,
 
   //256
   //avant ecb
-  if(ctr)
+  if(ctr) {
     if(1 != EVP_EncryptInit_ex(ctx, EVP_aes_128_ctr(), NULL, key, iv))
       handleErrors();
-    else
+  }
+  else
       if(1 != EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv))
        handleErrors();
 
@@ -118,10 +119,11 @@ int decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *key,
   //256
 
   //avant => ecb
-  if(ctr)
+  if(ctr) {
     if(1 != EVP_DecryptInit_ex(ctx, EVP_aes_128_ctr(), NULL, key, iv))
       handleErrors();
-    else
+  }
+  else
       if(1 != EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv))
     handleErrors();