mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-23 05:08:24 +00:00
tools: fix build without LIBCRYPTO support
Commitcb9faa6f98
("tools: Use a single target-independent config to enable OpenSSL") introduced a target-independent configuration to build crypto features in host tools. But since commit2c21256b27
("hash: Use Kconfig to enable hashing in host tools and SPL") the build without OpenSSL is broken, due to FIT signature/encryption features. Add missing conditional compilation tokens to fix this. Signed-off-by: Paul-Erwan Rio <paulerwan.rio@gmail.com> Tested-by: Alexander Dahl <ada@thorsis.com> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
b646a1053f
commit
03e598263e
5 changed files with 10 additions and 4 deletions
|
@ -1465,7 +1465,7 @@ int calculate_hash(const void *data, int data_len, const char *algo,
|
||||||
* device
|
* device
|
||||||
*/
|
*/
|
||||||
#if defined(USE_HOSTCC)
|
#if defined(USE_HOSTCC)
|
||||||
# if defined(CONFIG_FIT_SIGNATURE)
|
# if CONFIG_IS_ENABLED(FIT_SIGNATURE)
|
||||||
# define IMAGE_ENABLE_SIGN 1
|
# define IMAGE_ENABLE_SIGN 1
|
||||||
# define FIT_IMAGE_ENABLE_VERIFY 1
|
# define FIT_IMAGE_ENABLE_VERIFY 1
|
||||||
# include <openssl/evp.h>
|
# include <openssl/evp.h>
|
||||||
|
|
|
@ -51,6 +51,7 @@ config TOOLS_FIT_RSASSA_PSS
|
||||||
Support the rsassa-pss signature scheme in the tools builds
|
Support the rsassa-pss signature scheme in the tools builds
|
||||||
|
|
||||||
config TOOLS_FIT_SIGNATURE
|
config TOOLS_FIT_SIGNATURE
|
||||||
|
depends on TOOLS_LIBCRYPTO
|
||||||
def_bool y
|
def_bool y
|
||||||
help
|
help
|
||||||
Enable signature verification of FIT uImages in the tools builds
|
Enable signature verification of FIT uImages in the tools builds
|
||||||
|
|
|
@ -61,7 +61,7 @@ static int fit_add_file_data(struct image_tool_params *params, size_t size_inc,
|
||||||
ret = fit_set_timestamp(ptr, 0, time);
|
ret = fit_set_timestamp(ptr, 0, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ret)
|
if (CONFIG_IS_ENABLED(FIT_SIGNATURE) && !ret)
|
||||||
ret = fit_pre_load_data(params->keydir, dest_blob, ptr);
|
ret = fit_pre_load_data(params->keydir, dest_blob, ptr);
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
|
|
|
@ -14,8 +14,10 @@
|
||||||
#include <image.h>
|
#include <image.h>
|
||||||
#include <version.h>
|
#include <version.h>
|
||||||
|
|
||||||
|
#if CONFIG_IS_ENABLED(FIT_SIGNATURE)
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fit_set_hash_value - set hash value in requested has node
|
* fit_set_hash_value - set hash value in requested has node
|
||||||
|
@ -1131,6 +1133,7 @@ static int fit_config_add_verification_data(const char *keydir,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_IS_ENABLED(FIT_SIGNATURE)
|
||||||
/*
|
/*
|
||||||
* 0) open file (open)
|
* 0) open file (open)
|
||||||
* 1) read certificate (PEM_read_X509)
|
* 1) read certificate (PEM_read_X509)
|
||||||
|
@ -1239,6 +1242,7 @@ int fit_pre_load_data(const char *keydir, void *keydest, void *fit)
|
||||||
out:
|
out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int fit_cipher_data(const char *keydir, void *keydest, void *fit,
|
int fit_cipher_data(const char *keydir, void *keydest, void *fit,
|
||||||
const char *comment, int require_keys,
|
const char *comment, int require_keys,
|
||||||
|
|
|
@ -115,7 +115,7 @@ static void usage(const char *msg)
|
||||||
" -B => align size in hex for FIT structure and header\n"
|
" -B => align size in hex for FIT structure and header\n"
|
||||||
" -b => append the device tree binary to the FIT\n"
|
" -b => append the device tree binary to the FIT\n"
|
||||||
" -t => update the timestamp in the FIT\n");
|
" -t => update the timestamp in the FIT\n");
|
||||||
#ifdef CONFIG_FIT_SIGNATURE
|
#if CONFIG_IS_ENABLED(FIT_SIGNATURE)
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Signing / verified boot options: [-k keydir] [-K dtb] [ -c <comment>] [-p addr] [-r] [-N engine]\n"
|
"Signing / verified boot options: [-k keydir] [-K dtb] [ -c <comment>] [-p addr] [-r] [-N engine]\n"
|
||||||
" -k => set directory containing private keys\n"
|
" -k => set directory containing private keys\n"
|
||||||
|
@ -130,8 +130,9 @@ static void usage(const char *msg)
|
||||||
" -o => algorithm to use for signing\n");
|
" -o => algorithm to use for signing\n");
|
||||||
#else
|
#else
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Signing / verified boot not supported (CONFIG_FIT_SIGNATURE undefined)\n");
|
"Signing / verified boot not supported (CONFIG_TOOLS_FIT_SIGNATURE undefined)\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fprintf(stderr, " %s -V ==> print version information and exit\n",
|
fprintf(stderr, " %s -V ==> print version information and exit\n",
|
||||||
params.cmdname);
|
params.cmdname);
|
||||||
fprintf(stderr, "Use '-T list' to see a list of available image types\n");
|
fprintf(stderr, "Use '-T list' to see a list of available image types\n");
|
||||||
|
|
Loading…
Add table
Reference in a new issue