Heiko Schocher | edaf9b1 | 2014-03-03 12:19:26 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013, Andreas Oetken. |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
| 7 | #ifndef _RSA_CHECKSUM_H |
| 8 | #define _RSA_CHECKSUM_H |
| 9 | |
| 10 | #include <errno.h> |
| 11 | #include <image.h> |
Jeroen Hofstee | bfe88fe | 2014-06-12 22:27:12 +0200 | [diff] [blame] | 12 | #include <u-boot/sha1.h> |
| 13 | #include <u-boot/sha256.h> |
Heiko Schocher | edaf9b1 | 2014-03-03 12:19:26 +0100 | [diff] [blame] | 14 | |
Heiko Schocher | 4b81756 | 2014-03-03 12:19:27 +0100 | [diff] [blame] | 15 | extern const uint8_t padding_sha256_rsa4096[]; |
Heiko Schocher | edaf9b1 | 2014-03-03 12:19:26 +0100 | [diff] [blame] | 16 | extern const uint8_t padding_sha256_rsa2048[]; |
| 17 | extern const uint8_t padding_sha1_rsa2048[]; |
| 18 | |
Ruchika Gupta | 2c8987f | 2015-01-23 16:01:59 +0530 | [diff] [blame] | 19 | /** |
| 20 | * hash_calculate() - Calculate hash over the data |
| 21 | * |
| 22 | * @name: Name of algorithm to be used for hash calculation |
| 23 | * @region: Array having info of regions over which hash needs to be calculated |
| 24 | * @region_count: Number of regions in the region array |
| 25 | * @checksum: Buffer contanining the output hash |
| 26 | * |
| 27 | * @return 0 if OK, < 0 if error |
| 28 | */ |
| 29 | int hash_calculate(const char *name, |
| 30 | const struct image_region region[], int region_count, |
| 31 | uint8_t *checksum); |
Heiko Schocher | edaf9b1 | 2014-03-03 12:19:26 +0100 | [diff] [blame] | 32 | |
| 33 | #endif |