Skip to content

Commit

Permalink
crypto: handle unsupported AES ciphers in webcrypto
Browse files Browse the repository at this point in the history
Refs: electron/electron#36256
PR-URL: #45321
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com>
  • Loading branch information
panva authored and danielleadams committed Dec 30, 2022
1 parent 584792c commit 0e2f0a5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/crypto/crypto_aes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,10 @@ Maybe<bool> 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<bool>();
}

if (params->iv.size() <
static_cast<size_t>(EVP_CIPHER_iv_length(params->cipher))) {
Expand Down

0 comments on commit 0e2f0a5

Please sign in to comment.