mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
fit: cipher: aes: allow to read the IV in the FIT image
This commit add the support in u-boot to read the IV in the FIT image instead of u-boot device tree. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
This commit is contained in:
parent
a6982a6f76
commit
54ab7cf1dd
1 changed files with 15 additions and 7 deletions
|
@ -94,9 +94,11 @@ static int fit_image_setup_decrypt(struct image_cipher_info *info,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
info->iv = fdt_getprop(fit, cipher_noffset, "iv", NULL);
|
||||||
info->ivname = fdt_getprop(fit, cipher_noffset, "iv-name-hint", NULL);
|
info->ivname = fdt_getprop(fit, cipher_noffset, "iv-name-hint", NULL);
|
||||||
if (!info->ivname) {
|
|
||||||
printf("Can't get IV name\n");
|
if (!info->iv && !info->ivname) {
|
||||||
|
printf("Can't get IV or IV name\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,8 +122,12 @@ static int fit_image_setup_decrypt(struct image_cipher_info *info,
|
||||||
* Search the cipher node in the u-boot fdt
|
* Search the cipher node in the u-boot fdt
|
||||||
* the path should be: /cipher/key-<algo>-<key>-<iv>
|
* the path should be: /cipher/key-<algo>-<key>-<iv>
|
||||||
*/
|
*/
|
||||||
snprintf(node_path, sizeof(node_path), "/%s/key-%s-%s-%s",
|
if (info->ivname)
|
||||||
FIT_CIPHER_NODENAME, algo_name, info->keyname, info->ivname);
|
snprintf(node_path, sizeof(node_path), "/%s/key-%s-%s-%s",
|
||||||
|
FIT_CIPHER_NODENAME, algo_name, info->keyname, info->ivname);
|
||||||
|
else
|
||||||
|
snprintf(node_path, sizeof(node_path), "/%s/key-%s-%s",
|
||||||
|
FIT_CIPHER_NODENAME, algo_name, info->keyname);
|
||||||
|
|
||||||
noffset = fdt_path_offset(fdt, node_path);
|
noffset = fdt_path_offset(fdt, node_path);
|
||||||
if (noffset < 0) {
|
if (noffset < 0) {
|
||||||
|
@ -137,10 +143,12 @@ static int fit_image_setup_decrypt(struct image_cipher_info *info,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read iv */
|
/* read iv */
|
||||||
info->iv = fdt_getprop(fdt, noffset, "iv", NULL);
|
|
||||||
if (!info->iv) {
|
if (!info->iv) {
|
||||||
printf("Can't get IV in cipher node '%s'\n", node_path);
|
info->iv = fdt_getprop(fdt, noffset, "iv", NULL);
|
||||||
return -1;
|
if (!info->iv) {
|
||||||
|
printf("Can't get IV in cipher node '%s'\n", node_path);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue