openwrt/package/boot/uboot-layerscape/patches/0003-avoid-calling-sec-firmware-get-random-when-no-kaslr-seed.patch

34 lines
993 B
Diff
Raw Normal View History

Index: uboot-layerscape-lf-6.1.1-1.0.0/arch/arm/cpu/armv8/sec_firmware.c
===================================================================
--- uboot-layerscape-lf-6.1.1-1.0.0.orig/arch/arm/cpu/armv8/sec_firmware.c
+++ uboot-layerscape-lf-6.1.1-1.0.0/arch/arm/cpu/armv8/sec_firmware.c
@@ -473,12 +473,6 @@ int fdt_fixup_kaslr(void *fdt)
return 0;
}
- ret = sec_firmware_get_random(rand, 8);
- if (ret < 0) {
- printf("WARNING: No random number to set kaslr-seed\n");
- return 0;
- }
-
err = fdt_check_header(fdt);
if (err < 0) {
printf("fdt_chosen: %s\n", fdt_strerror(err));
@@ -490,6 +484,15 @@ int fdt_fixup_kaslr(void *fdt)
if (nodeoffset < 0)
return 0;
+ if (fdt_find_or_add_subnode(fdt, nodeoffset, "kaslr-seed"))
+ return 0;
+
+ ret = sec_firmware_get_random(rand, 8);
+ if (ret < 0) {
+ printf("WARNING: No random number to set kaslr-seed\n");
+ return 0;
+ }
+
err = fdt_setprop(fdt, nodeoffset, "kaslr-seed", rand,
sizeof(rand));
if (err < 0) {