Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Heiko Schocher | edaf9b1 | 2014-03-03 12:19:26 +0100 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2013, Andreas Oetken. |
Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 4 | */ |
Heiko Schocher | edaf9b1 | 2014-03-03 12:19:26 +0100 | [diff] [blame] | 5 | |
| 6 | #ifndef _RSA_CHECKSUM_H |
| 7 | #define _RSA_CHECKSUM_H |
| 8 | |
| 9 | #include <errno.h> |
Jeroen Hofstee | bfe88fe | 2014-06-12 22:27:12 +0200 | [diff] [blame] | 10 | #include <u-boot/sha1.h> |
| 11 | #include <u-boot/sha256.h> |
Reuben Dowle | 1908fd9 | 2020-04-16 17:36:52 +1200 | [diff] [blame] | 12 | #include <u-boot/sha512.h> |
Heiko Schocher | edaf9b1 | 2014-03-03 12:19:26 +0100 | [diff] [blame] | 13 | |
Simon Glass | 2c6a1b0 | 2021-09-25 19:43:33 -0600 | [diff] [blame] | 14 | struct image_region; |
| 15 | |
Ruchika Gupta | 2c8987f | 2015-01-23 16:01:59 +0530 | [diff] [blame] | 16 | /** |
| 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 | * |
| 24 | * @return 0 if OK, < 0 if error |
| 25 | */ |
| 26 | int hash_calculate(const char *name, |
Simon Glass | 2c6a1b0 | 2021-09-25 19:43:33 -0600 | [diff] [blame] | 27 | const struct image_region *region, int region_count, |
Ruchika Gupta | 2c8987f | 2015-01-23 16:01:59 +0530 | [diff] [blame] | 28 | uint8_t *checksum); |
Heiko Schocher | edaf9b1 | 2014-03-03 12:19:26 +0100 | [diff] [blame] | 29 | |
| 30 | #endif |