diff options
Diffstat (limited to 'src/plugins/lanplus/lanplus_crypt_impl.c')
-rw-r--r-- | src/plugins/lanplus/lanplus_crypt_impl.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/plugins/lanplus/lanplus_crypt_impl.c b/src/plugins/lanplus/lanplus_crypt_impl.c index 9652a5e..7603e6d 100644 --- a/src/plugins/lanplus/lanplus_crypt_impl.c +++ b/src/plugins/lanplus/lanplus_crypt_impl.c @@ -102,7 +102,7 @@ lanplus_rand(uint8_t * buffer, uint32_t num_bytes) * param mac specifies the algorithm to be used, currently SHA1, SHA256 and MD5 * are supported * param key is the key used for HMAC generation - * param key_len is the lenght of key + * param key_len is the length of key * param d is the data to be MAC'd * param n is the length of the data at d * param md is the result of the HMAC algorithm @@ -179,11 +179,15 @@ lanplus_encrypt_aes_cbc_128(const uint8_t * iv, } ctx = EVP_CIPHER_CTX_new(); - if (ctx == NULL) { + if (!ctx) { lprintf(LOG_DEBUG, "ERROR: EVP_CIPHER_CTX_new() failed"); return; } +#if OPENSSL_VERSION_NUMBER < 0x10100000L EVP_CIPHER_CTX_init(ctx); +#else + EVP_CIPHER_CTX_reset(ctx); +#endif EVP_EncryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv); EVP_CIPHER_CTX_set_padding(ctx, 0); @@ -258,11 +262,15 @@ lanplus_decrypt_aes_cbc_128(const uint8_t * iv, return; ctx = EVP_CIPHER_CTX_new(); - if (ctx == NULL) { + if (!ctx) { lprintf(LOG_DEBUG, "ERROR: EVP_CIPHER_CTX_new() failed"); return; } +#if OPENSSL_VERSION_NUMBER < 0x10100000L EVP_CIPHER_CTX_init(ctx); +#else + EVP_CIPHER_CTX_reset(ctx); +#endif EVP_DecryptInit_ex(ctx, EVP_aes_128_cbc(), NULL, key, iv); EVP_CIPHER_CTX_set_padding(ctx, 0); |