blob: bebb4afdfdc8a713a99e6b7109b7d8331f1095ff [file] [log] [blame]
Lionel Debieve8cc21ea2019-08-26 15:14:51 +02001/*
Nicolas Toromanoff5d3ade02020-12-22 13:54:51 +01002 * Copyright (c) 2019-2022, STMicroelectronics - All Rights Reserved
Lionel Debieve8cc21ea2019-08-26 15:14:51 +02003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef STM32_HASH_H
8#define STM32_HASH_H
9
Nicolas Toromanoff5d3ade02020-12-22 13:54:51 +010010#include <stdint.h>
11
Lionel Debieve8cc21ea2019-08-26 15:14:51 +020012enum stm32_hash_algo_mode {
Nicolas Toromanoff5d3ade02020-12-22 13:54:51 +010013#if STM32_HASH_VER == 2
Lionel Debieve8cc21ea2019-08-26 15:14:51 +020014 HASH_MD5SUM,
Nicolas Toromanoff5d3ade02020-12-22 13:54:51 +010015#endif
Lionel Debieve8cc21ea2019-08-26 15:14:51 +020016 HASH_SHA1,
17 HASH_SHA224,
Nicolas Toromanoff5d3ade02020-12-22 13:54:51 +010018 HASH_SHA256,
19#if STM32_HASH_VER == 4
20 HASH_SHA384,
21 HASH_SHA512,
22#endif
Lionel Debieve8cc21ea2019-08-26 15:14:51 +020023};
24
Yann Gautierf36952b2019-10-02 16:33:41 +020025int stm32_hash_update(const uint8_t *buffer, size_t length);
Lionel Debieve8cc21ea2019-08-26 15:14:51 +020026int stm32_hash_final(uint8_t *digest);
27int stm32_hash_final_update(const uint8_t *buffer, uint32_t buf_length,
28 uint8_t *digest);
29void stm32_hash_init(enum stm32_hash_algo_mode mode);
30int stm32_hash_register(void);
31
32#endif /* STM32_HASH_H */