Skip to contentSkip to conversation

Refactor IMAGE_ENABLE_VERIFY to handle builds without SPL verification

PATCH New Alex Kiernan 3 participants 3 messages Apr 18, 2019 – May 6, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Refactor IMAGE_ENABLE_VERIFY to handle builds without SPL verification

If building with SPL_LOAD_FIT_FULL and FIT_SIGNATURE, but without SPL_FIT_SIGNATURE then the build fails with:

common/built-in.o: In function `fit_image_verify_with_data':
common/image-fit.c:1220: undefined reference to fit_image_verify_required_sigs' common/image-fit.c:1244: undefined reference to fit_image_check_sig' common/built-in.o: In function `fit_image_load':
common/image-fit.c:1857: undefined reference to `fit_config_verify'

Refactor so that host builds still depend on FIT_SIGNATURE, but target builds check FIT_SIGNATURE/SPL_FIT_SIGNATURE dependent on the build.

---
Green travis build:

https://travis-ci.org/akiernan/u-boot/builds/521570862

 include/image.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
include/image.h +6 -6
index 765ffecee0a7..c8522189ebab 100644
@@ -1071,18 +1071,18 @@ int calculate_hash(const void *data, int data_len, const char *algo,
  * At present we only support signing on the host, and verification on the
  * device
  */
-#if defined(CONFIG_FIT_SIGNATURE)
-# ifdef USE_HOSTCC
+#if defined(USE_HOSTCC)
+# if defined(CONFIG_FIT_SIGNATURE)
 #  define IMAGE_ENABLE_SIGN	1
 #  define IMAGE_ENABLE_VERIFY	1
-# include  <openssl/evp.h>
-#else
+#  include <openssl/evp.h>
+# else
 #  define IMAGE_ENABLE_SIGN	0
-#  define IMAGE_ENABLE_VERIFY	1
+#  define IMAGE_ENABLE_VERIFY	0
 # endif
 #else
 # define IMAGE_ENABLE_SIGN	0
-# define IMAGE_ENABLE_VERIFY	0
+# define IMAGE_ENABLE_VERIFY	CONFIG_IS_ENABLED(FIT_SIGNATURE)
 #endif
 
 #ifdef USE_HOSTCC
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 Refactor IMAGE_ENABLE_VERIFY to handle builds without SPL verification

Quoted 13 lines · Alex Kiernan

If building with SPL_LOAD_FIT_FULL and FIT_SIGNATURE, but without SPL_FIT_SIGNATURE then the build fails with:

common/built-in.o: In function `fit_image_verify_with_data':
common/image-fit.c:1220: undefined reference to fit_image_verify_required_sigs' common/image-fit.c:1244: undefined reference to fit_image_check_sig' common/built-in.o: In function `fit_image_load':
common/image-fit.c:1857: undefined reference to `fit_config_verify'

Refactor so that host builds still depend on FIT_SIGNATURE, but target builds check FIT_SIGNATURE/SPL_FIT_SIGNATURE dependent on the build.

Quoted 8 lines

---
Green travis build:

https://travis-ci.org/akiernan/u-boot/builds/521570862

 include/image.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
#2 lore raw

PATCH 1/1 Refactor IMAGE_ENABLE_VERIFY to handle builds without SPL verification

In reply to Alex Kiernan
Quoted 9 lines · Alex Kiernan

If building with SPL_LOAD_FIT_FULL and FIT_SIGNATURE, but without SPL_FIT_SIGNATURE then the build fails with:

common/built-in.o: In function `fit_image_verify_with_data':
common/image-fit.c:1220: undefined reference to fit_image_verify_required_sigs' common/image-fit.c:1244: undefined reference to fit_image_check_sig' common/built-in.o: In function `fit_image_load':
common/image-fit.c:1857: undefined reference to `fit_config_verify'

Quoted 5 lines

Refactor so that host builds still depend on FIT_SIGNATURE, but target builds check FIT_SIGNATURE/SPL_FIT_SIGNATURE dependent on the build.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190506/8e33d6b4/attachment.sig>