hc
2023-11-20 21dac118b553f9ebfb6b3a809dbe1794dfa9fb0b
u-boot/lib/rsa/rsa-verify.c
....@@ -86,11 +86,17 @@
8686 uint8_t buf[sig_len];
8787 rsa_key rsa_key;
8888 int i, ret;
89
+#ifdef CONFIG_FIT_ENABLE_RSA4096_SUPPORT
90
+ if (key_len != RSA4096_BYTES)
91
+ return -EINVAL;
8992
93
+ rsa_key.algo = CRYPTO_RSA4096;
94
+#else
9095 if (key_len != RSA2048_BYTES)
9196 return -EINVAL;
9297
9398 rsa_key.algo = CRYPTO_RSA2048;
99
+#endif
94100 rsa_key.n = malloc(key_len);
95101 rsa_key.e = malloc(key_len);
96102 rsa_key.c = malloc(key_len);
....@@ -599,7 +605,7 @@
599605 struct udevice *dev;
600606 struct key_prop prop;
601607 char name[100] = {0};
602
- u16 secure_boot_enable = 0;
608
+ u16 secure_flags = 0;
603609 const void *blob = info->fdt_blob;
604610 uint8_t digest[FIT_MAX_HASH_LEN];
605611 uint8_t digest_read[FIT_MAX_HASH_LEN];
....@@ -610,11 +616,11 @@
610616 return -ENODEV;
611617
612618 ret = misc_otp_read(dev, OTP_SECURE_BOOT_ENABLE_ADDR,
613
- &secure_boot_enable, OTP_SECURE_BOOT_ENABLE_SIZE);
619
+ &secure_flags, OTP_SECURE_BOOT_ENABLE_SIZE);
614620 if (ret)
615621 return ret;
616622
617
- if (secure_boot_enable)
623
+ if (secure_flags == 0xff)
618624 return 0;
619625
620626 sig_node = fdt_subnode_offset(blob, 0, FIT_SIG_NODENAME);
....@@ -701,9 +707,9 @@
701707 goto error;
702708 }
703709
704
- secure_boot_enable = 0xff;
710
+ secure_flags = 0xff;
705711 ret = misc_otp_write(dev, OTP_SECURE_BOOT_ENABLE_ADDR,
706
- &secure_boot_enable, OTP_SECURE_BOOT_ENABLE_SIZE);
712
+ &secure_flags, OTP_SECURE_BOOT_ENABLE_SIZE);
707713 if (ret)
708714 goto error;
709715