luks: Check for out-of-memory with Argon2
This algorithm can use a lot of memory, so add a check for this condition and return the correct error. Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
@@ -676,7 +676,10 @@ static int try_keyslot_argon2(struct udevice *blk, struct disk_partition *pinfo,
|
||||
ks->kdf.salt_len, derived_key,
|
||||
ks->area.key_size);
|
||||
if (ret) {
|
||||
log_err("Argon2id failed: %s\n", argon2_error_message(ret));
|
||||
log_err("Argon2id failed: %s (code=%d)\n",
|
||||
argon2_error_message(ret), ret);
|
||||
if (ret == ARGON2_MEMORY_ALLOCATION_ERROR)
|
||||
return -ENOMEM;
|
||||
return -EPROTO;
|
||||
}
|
||||
log_debug("LUKS2 Argon2: key derivation succeeded\n");
|
||||
|
||||
Reference in New Issue
Block a user