aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorHugo Cornelis <hugo.cornelis@essensium.com>2024-03-21 12:22:22 +0100
committerTom Rini <trini@konsulko.com>2024-04-12 08:53:31 -0600
commit55a7d60f8f10b1c3c5a8e29571c065d61f5dd12f (patch)
tree9a52802d444c51a62204cf3d4c5bc68e02c95cb1 /tools
parent7b2d32a7d6a782063bed80fa2161305eba627caa (diff)
downloadu-boot-55a7d60f8f10b1c3c5a8e29571c065d61f5dd12f.zip
u-boot-55a7d60f8f10b1c3c5a8e29571c065d61f5dd12f.tar.gz
u-boot-55a7d60f8f10b1c3c5a8e29571c065d61f5dd12f.tar.bz2
image-host: Fix error value paths and emit error messages to stderr.
A recent refactoring in image-host.c messed up the return values of the function that reads the encryptiong keys. This patch fixes this and also makes sure that error output goes to stderr instead of to stdout. Signed-off-by: Hugo Cornelis <hugo.cornelis@essensium.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/image-host.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/image-host.c b/tools/image-host.c
index b2a0f2e..7bfc0cb 100644
--- a/tools/image-host.c
+++ b/tools/image-host.c
@@ -346,17 +346,17 @@ static int fit_image_read_key_iv_data(const char *keydir, const char *key_iv_nam
unsigned char *key_iv_data, int expected_size)
{
char filename[PATH_MAX];
- int ret = -1;
+ int ret;
ret = snprintf(filename, sizeof(filename), "%s/%s%s",
keydir, key_iv_name, ".bin");
if (ret >= sizeof(filename)) {
- printf("Can't format the key or IV filename when setting up the cipher: insufficient buffer space\n");
- ret = -1;
+ fprintf(stderr, "Can't format the key or IV filename when setting up the cipher: insufficient buffer space\n");
+ return -1;
}
if (ret < 0) {
- printf("Can't format the key or IV filename when setting up the cipher: snprintf error\n");
- ret = -1;
+ fprintf(stderr, "Can't format the key or IV filename when setting up the cipher: snprintf error\n");
+ return -1;
}
ret = fit_image_read_data(filename, key_iv_data, expected_size);