diff options
author | Alexandru Gagniuc | 2021-02-19 12:45:10 -0600 |
---|---|---|
committer | Tom Rini | 2021-04-14 15:06:08 -0400 |
commit | 0bcb28dfb946b32ed7550fc4c24c5dcea6718554 (patch) | |
tree | d54d4cda64bf44ce534d03d26ae3913f1a957746 /lib/rsa | |
parent | 3505fa572793d50f7ae53a46630cf5976b69e700 (diff) |
lib: Rename rsa-checksum.c to hash-checksum.c
rsa-checksum.c sontains the hash_calculate() implementations. Despite
the "rsa-" file prefix, this function is useful for other algorithms.
To prevent confusion, move this file to lib/, and rename it to
hash-checksum.c, to give it a more "generic" feel.
Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib/rsa')
-rw-r--r-- | lib/rsa/Makefile | 2 | ||||
-rw-r--r-- | lib/rsa/rsa-checksum.c | 51 |
2 files changed, 1 insertions, 52 deletions
diff --git a/lib/rsa/Makefile b/lib/rsa/Makefile index 8b75d41f04b..c9ac72c1e26 100644 --- a/lib/rsa/Makefile +++ b/lib/rsa/Makefile @@ -5,6 +5,6 @@ # (C) Copyright 2000-2007 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. -obj-$(CONFIG_$(SPL_TPL_)RSA_VERIFY) += rsa-verify.o rsa-checksum.o +obj-$(CONFIG_$(SPL_TPL_)RSA_VERIFY) += rsa-verify.o obj-$(CONFIG_$(SPL_TPL_)RSA_VERIFY_WITH_PKEY) += rsa-keyprop.o obj-$(CONFIG_RSA_SOFTWARE_EXP) += rsa-mod-exp.o diff --git a/lib/rsa/rsa-checksum.c b/lib/rsa/rsa-checksum.c deleted file mode 100644 index e60debb7df3..00000000000 --- a/lib/rsa/rsa-checksum.c +++ /dev/null @@ -1,51 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright (c) 2013, Andreas Oetken. - */ - -#ifndef USE_HOSTCC -#include <common.h> -#include <fdtdec.h> -#include <asm/byteorder.h> -#include <linux/errno.h> -#include <asm/unaligned.h> -#include <hash.h> -#else -#include "fdt_host.h" -#endif -#include <u-boot/rsa.h> - -int hash_calculate(const char *name, - const struct image_region region[], - int region_count, uint8_t *checksum) -{ - struct hash_algo *algo; - int ret = 0; - void *ctx; - uint32_t i; - i = 0; - - ret = hash_progressive_lookup_algo(name, &algo); - if (ret) - return ret; - - ret = algo->hash_init(algo, &ctx); - if (ret) - return ret; - - for (i = 0; i < region_count - 1; i++) { - ret = algo->hash_update(algo, ctx, region[i].data, - region[i].size, 0); - if (ret) - return ret; - } - - ret = algo->hash_update(algo, ctx, region[i].data, region[i].size, 1); - if (ret) - return ret; - ret = algo->hash_finish(algo, ctx, checksum, algo->digest_size); - if (ret) - return ret; - - return 0; -} |