blob: bcc6ba48fc7c2563559e4298b3d48699d94960e4 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Heiko Schocheredaf9b12014-03-03 12:19:26 +01002/*
3 * Copyright (c) 2013, Andreas Oetken.
Tom Rini10e47792018-05-06 17:58:06 -04004 */
Heiko Schocheredaf9b12014-03-03 12:19:26 +01005
6#ifndef _RSA_CHECKSUM_H
7#define _RSA_CHECKSUM_H
8
9#include <errno.h>
Jeroen Hofsteebfe88fe2014-06-12 22:27:12 +020010#include <u-boot/sha1.h>
11#include <u-boot/sha256.h>
Reuben Dowle1908fd92020-04-16 17:36:52 +120012#include <u-boot/sha512.h>
Heiko Schocheredaf9b12014-03-03 12:19:26 +010013
Simon Glass2c6a1b02021-09-25 19:43:33 -060014struct image_region;
15
Ruchika Gupta2c8987f2015-01-23 16:01:59 +053016/**
17 * hash_calculate() - Calculate hash over the data
18 *
19 * @name: Name of algorithm to be used for hash calculation
20 * @region: Array having info of regions over which hash needs to be calculated
21 * @region_count: Number of regions in the region array
22 * @checksum: Buffer contanining the output hash
23 *
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +010024 * Return: 0 if OK, < 0 if error
Ruchika Gupta2c8987f2015-01-23 16:01:59 +053025 */
26int hash_calculate(const char *name,
Simon Glass2c6a1b02021-09-25 19:43:33 -060027 const struct image_region *region, int region_count,
Ruchika Gupta2c8987f2015-01-23 16:01:59 +053028 uint8_t *checksum);
Heiko Schocheredaf9b12014-03-03 12:19:26 +010029
30#endif