From 9c56de39b294743d4ce39b253d28c85f4406e397 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Sat, 5 Nov 2022 00:18:34 +0100 Subject: [PATCH] crypto: handle unsupported AES ciphers in webcrypto Refs: https://github.com/electron/electron/issues/36256 --- src/crypto/crypto_aes.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/crypto/crypto_aes.cc b/src/crypto/crypto_aes.cc index 5f84e21fc23763..c1c5bf762a765f 100644 --- a/src/crypto/crypto_aes.cc +++ b/src/crypto/crypto_aes.cc @@ -556,7 +556,10 @@ Maybe AESCipherTraits::AdditionalConfig( } params->cipher = EVP_get_cipherbynid(cipher_nid); - CHECK_NOT_NULL(params->cipher); + if (params->cipher == nullptr) { + THROW_ERR_CRYPTO_UNKNOWN_CIPHER(env); + return Nothing(); + } if (params->iv.size() < static_cast(EVP_CIPHER_iv_length(params->cipher))) {