Lionel Debieve | 8cc21ea | 2019-08-26 15:14:51 +0200 | [diff] [blame] | 1 | /* |
Nicolas Toromanoff | 5d3ade0 | 2020-12-22 13:54:51 +0100 | [diff] [blame] | 2 | * Copyright (c) 2019-2022, STMicroelectronics - All Rights Reserved |
Lionel Debieve | 8cc21ea | 2019-08-26 15:14:51 +0200 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef STM32_HASH_H |
| 8 | #define STM32_HASH_H |
| 9 | |
Nicolas Toromanoff | 5d3ade0 | 2020-12-22 13:54:51 +0100 | [diff] [blame] | 10 | #include <stdint.h> |
| 11 | |
Lionel Debieve | 8cc21ea | 2019-08-26 15:14:51 +0200 | [diff] [blame] | 12 | enum stm32_hash_algo_mode { |
Nicolas Toromanoff | 5d3ade0 | 2020-12-22 13:54:51 +0100 | [diff] [blame] | 13 | #if STM32_HASH_VER == 2 |
Lionel Debieve | 8cc21ea | 2019-08-26 15:14:51 +0200 | [diff] [blame] | 14 | HASH_MD5SUM, |
Nicolas Toromanoff | 5d3ade0 | 2020-12-22 13:54:51 +0100 | [diff] [blame] | 15 | #endif |
Lionel Debieve | 8cc21ea | 2019-08-26 15:14:51 +0200 | [diff] [blame] | 16 | HASH_SHA1, |
| 17 | HASH_SHA224, |
Nicolas Toromanoff | 5d3ade0 | 2020-12-22 13:54:51 +0100 | [diff] [blame] | 18 | HASH_SHA256, |
| 19 | #if STM32_HASH_VER == 4 |
| 20 | HASH_SHA384, |
| 21 | HASH_SHA512, |
| 22 | #endif |
Lionel Debieve | 8cc21ea | 2019-08-26 15:14:51 +0200 | [diff] [blame] | 23 | }; |
| 24 | |
Yann Gautier | f36952b | 2019-10-02 16:33:41 +0200 | [diff] [blame] | 25 | int stm32_hash_update(const uint8_t *buffer, size_t length); |
Lionel Debieve | 8cc21ea | 2019-08-26 15:14:51 +0200 | [diff] [blame] | 26 | int stm32_hash_final(uint8_t *digest); |
| 27 | int stm32_hash_final_update(const uint8_t *buffer, uint32_t buf_length, |
| 28 | uint8_t *digest); |
| 29 | void stm32_hash_init(enum stm32_hash_algo_mode mode); |
| 30 | int stm32_hash_register(void); |
| 31 | |
| 32 | #endif /* STM32_HASH_H */ |