X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/Cipher_code.git/blobdiff_plain/4fa9c3d0a87911ef71653cb99aa1c70f633a9473..cf457ee9b22e34dcc92f91f0400035a2f7d85d82:/OneRoundIoT/openssl/openssl_evp.c diff --git a/OneRoundIoT/openssl/openssl_evp.c b/OneRoundIoT/openssl/openssl_evp.c index 3c1416f..b452b9a 100644 --- a/OneRoundIoT/openssl/openssl_evp.c +++ b/OneRoundIoT/openssl/openssl_evp.c @@ -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();