]> AND Private Git Repository - Cipher_code.git/blobdiff - OneRoundIoT/openssl/openssl_evp.c
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
new
[Cipher_code.git] / OneRoundIoT / openssl / openssl_evp.c
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();