diff --git a/libwvdrmengine/cdm/core/src/privacy_crypto_boringssl.cpp b/libwvdrmengine/cdm/core/src/privacy_crypto_boringssl.cpp index bd5b52e0..6f1b83f2 100644 --- a/libwvdrmengine/cdm/core/src/privacy_crypto_boringssl.cpp +++ b/libwvdrmengine/cdm/core/src/privacy_crypto_boringssl.cpp @@ -90,22 +90,13 @@ bool AesCbcKey::Encrypt(const std::string& in, std::string* out, return false; } -#if (OPENSSL_VERSION_NUMBER < 0x10100000L) - EVP_CIPHER_CTX ctx_struct; - EVP_CIPHER_CTX* evp_cipher_ctx = &ctx_struct; -#else EVP_CIPHER_CTX* evp_cipher_ctx = EVP_CIPHER_CTX_new(); -#endif if (EVP_EncryptInit(evp_cipher_ctx, EVP_aes_128_cbc(), reinterpret_cast(&key_[0]), reinterpret_cast(&(*iv)[0])) == 0) { LOGE("AesCbcKey::Encrypt: AES CBC setup failure: %s", ERR_error_string(ERR_get_error(), NULL)); -#if (OPENSSL_VERSION_NUMBER < 0x10100000L) - EVP_CIPHER_CTX_cleanup(evp_cipher_ctx); -#else EVP_CIPHER_CTX_free(evp_cipher_ctx); -#endif return false; } @@ -117,11 +108,7 @@ bool AesCbcKey::Encrypt(const std::string& in, std::string* out, in.size()) == 0) { LOGE("AesCbcKey::Encrypt: encryption failure: %s", ERR_error_string(ERR_get_error(), NULL)); -#if (OPENSSL_VERSION_NUMBER < 0x10100000L) - EVP_CIPHER_CTX_cleanup(evp_cipher_ctx); -#else EVP_CIPHER_CTX_free(evp_cipher_ctx); -#endif return false; } @@ -131,19 +118,11 @@ bool AesCbcKey::Encrypt(const std::string& in, std::string* out, &padding) == 0) { LOGE("AesCbcKey::Encrypt: PKCS7 padding failure: %s", ERR_error_string(ERR_get_error(), NULL)); -#if (OPENSSL_VERSION_NUMBER < 0x10100000L) - EVP_CIPHER_CTX_cleanup(evp_cipher_ctx); -#else EVP_CIPHER_CTX_free(evp_cipher_ctx); -#endif return false; } -#if (OPENSSL_VERSION_NUMBER < 0x10100000L) - EVP_CIPHER_CTX_cleanup(evp_cipher_ctx); -#else EVP_CIPHER_CTX_free(evp_cipher_ctx); -#endif out->resize(out_length + padding); return true; } @@ -219,13 +198,7 @@ static int LogOpenSSLError(const char* msg, size_t /* len */, void* /* ctx */) { static bool VerifyPSSSignature(EVP_PKEY *pkey, const std::string &message, const std::string &signature) { -#if (OPENSSL_VERSION_NUMBER < 0x10100000L) - EVP_MD_CTX ctx_struct; - EVP_MD_CTX* evp_md_ctx = &ctx_struct; - EVP_MD_CTX_init(evp_md_ctx); -#else EVP_MD_CTX* evp_md_ctx = EVP_MD_CTX_new(); -#endif EVP_PKEY_CTX *pctx = NULL; if (EVP_DigestVerifyInit(evp_md_ctx, &pctx, EVP_sha1(), NULL /* no ENGINE */, @@ -265,20 +238,12 @@ static bool VerifyPSSSignature(EVP_PKEY *pkey, const std::string &message, goto err; } -#if (OPENSSL_VERSION_NUMBER < 0x10100000L) - EVP_MD_CTX_cleanup(evp_md_ctx); -#else EVP_MD_CTX_free(evp_md_ctx); -#endif return true; err: ERR_print_errors_cb(LogOpenSSLError, NULL); -#if (OPENSSL_VERSION_NUMBER < 0x10100000L) - EVP_MD_CTX_cleanup(evp_md_ctx); -#else EVP_MD_CTX_free(evp_md_ctx); -#endif return false; }