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 Jan 3, 2023
1 parent 0f69b6c commit b54f876
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 b54f876

Please sign in to comment.