| // SPDX-License-Identifier: GPL-2.0+ |
| * Copyright (c) 2013, Andreas Oetken. |
| #include <asm/byteorder.h> |
| #include <asm/unaligned.h> |
| int hash_calculate(const char *name, |
| const struct image_region region[], |
| int region_count, uint8_t *checksum) |
| ret = hash_progressive_lookup_algo(name, &algo); |
| ret = algo->hash_init(algo, &ctx); |
| for (i = 0; i < region_count - 1; i++) { |
| ret = algo->hash_update(algo, ctx, region[i].data, |
| ret = algo->hash_update(algo, ctx, region[i].data, region[i].size, 1); |
| ret = algo->hash_finish(algo, ctx, checksum, algo->digest_size); |