]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
lib: rsa: fix compilation error without openssl
authorShiji Yang <yangshiji66@outlook.com>
Thu, 19 Jun 2025 16:38:17 +0000 (00:38 +0800)
committerTom Rini <trini@konsulko.com>
Sun, 22 Jun 2025 16:16:39 +0000 (10:16 -0600)
The symbol TOOLS_IMAGE_PRE_LOAD doesn't depend on TOOLS_LIBCRYPTO.
If we choose to build tools without openssl, rsa_verify_openssl()
will attempt to call the unavailable openssl library functions.

Fixes: 942c8c8e6697 ("rsa: Add rsa_verify_openssl() to use openssl for host builds")
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
include/image.h
lib/rsa/rsa-verify.c
tools/image-host.c

index c1db8383459c9d7ce1ecc318ccccb4627a7066e5..5f4e23a0ae90885192140e89fe32f6a46ab26619 100644 (file)
@@ -1688,7 +1688,7 @@ struct sig_header_s {
  */
 int image_pre_load(ulong addr);
 
-#if defined(USE_HOSTCC)
+#if defined(USE_HOSTCC) && CONFIG_IS_ENABLED(LIBCRYPTO)
 /**
  * rsa_verify_openssl() - Verify a signature against some data with openssl API
  *
index 4a0418a75f18e21e80612240aa626c0a240bc38c..b65fbe440073f4f2fb1b74e6f56dc623117abfd4 100644 (file)
@@ -570,7 +570,7 @@ int rsa_verify(struct image_sign_info *info,
        uint8_t hash[info->crypto->key_len];
        int ret;
 
-#ifdef USE_HOSTCC
+#if defined(USE_HOSTCC) && CONFIG_IS_ENABLED(LIBCRYPTO)
        if (!info->fdt_blob)
                return rsa_verify_openssl(info, region, region_count, sig, sig_len);
 #endif
index a9b8690276386aa21983612c6a306b7897a0af26..21dd7f2d922648294581b8df652ff0a5583cadbb 100644 (file)
@@ -19,7 +19,7 @@
 #include <openssl/evp.h>
 #endif
 
-#if CONFIG_IS_ENABLED(IMAGE_PRE_LOAD)
+#if CONFIG_IS_ENABLED(IMAGE_PRE_LOAD) && CONFIG_IS_ENABLED(LIBCRYPTO)
 #include <openssl/rsa.h>
 #include <openssl/err.h>
 #endif
@@ -1416,7 +1416,7 @@ int fit_check_sign(const void *fit, const void *key,
 }
 #endif
 
-#if CONFIG_IS_ENABLED(IMAGE_PRE_LOAD)
+#if CONFIG_IS_ENABLED(IMAGE_PRE_LOAD) && CONFIG_IS_ENABLED(LIBCRYPTO)
 /**
  * rsa_verify_openssl() - Verify a signature against some data with openssl API
  *