|
1 | 1 | /*
|
2 |
| - * sha1_alt.h SHA-1 hash |
3 |
| - ******************************************************************************* |
| 2 | + * \file sha1_alt.h |
| 3 | + * |
| 4 | + * \brief SHA1 hw acceleration (hash function) |
| 5 | + * |
4 | 6 | * Copyright (C) 2017, STMicroelectronics
|
5 | 7 | * SPDX-License-Identifier: Apache-2.0
|
6 | 8 | *
|
|
30 | 32 | extern "C" {
|
31 | 33 | #endif
|
32 | 34 |
|
33 |
| -#define MBEDTLS_SHA1_BLOCK_SIZE (64) |
| 35 | +#define MBEDTLS_SHA1_BLOCK_SIZE (64) // must be a multiple of 4 |
34 | 36 | /**
|
35 | 37 | * \brief SHA-1 context structure
|
36 | 38 | * \note HAL_HASH_SHA1_Accumulate cannot handle less than 4 bytes, unless it is the last call to the function
|
37 |
| - * A 64 bytes buffer is used to save values and handle the processing 64 bytes per 64 bytes |
38 |
| - * If SHA1_finish is called and sbuf_len>0, the remaining bytes are accumulated before the call to HAL_HASH_SHA1_Finish |
| 39 | + * A MBEDTLS_SHA1_BLOCK_SIZE bytes buffer is used to save values and handle the processing |
| 40 | + * MBEDTLS_SHA1_BLOCK_SIZE bytes per MBEDTLS_SHA1_BLOCK_SIZE bytes |
| 41 | + * If SHA1_finish is called and sbuf_len>0, the remaining bytes are accumulated prior to the call to HAL_HASH_SHA1_Finish |
39 | 42 | */
|
40 | 43 | typedef struct
|
41 | 44 | {
|
42 |
| - unsigned char sbuf[MBEDTLS_SHA1_BLOCK_SIZE]; /*!< 64 buffer to store values so that algorithm is caled once the buffer is filled */ |
| 45 | + unsigned char sbuf[MBEDTLS_SHA1_BLOCK_SIZE]; /*!< MBEDTLS_SHA1_BLOCK_SIZE buffer to store values so that algorithm is caled once the buffer is filled */ |
43 | 46 | unsigned char sbuf_len; /*!< number of bytes remaining in sbuf to be processed */
|
44 | 47 | HASH_HandleTypeDef hhash_sha1; /*!< ST HAL HASH struct */
|
45 | 48 | }
|
@@ -99,14 +102,6 @@ void mbedtls_sha1_process( mbedtls_sha1_context *ctx, const unsigned char data[6
|
99 | 102 | }
|
100 | 103 | #endif
|
101 | 104 |
|
102 |
| -#ifdef __cplusplus |
103 |
| -extern "C" { |
104 |
| -#endif |
105 |
| - |
106 |
| -#ifdef __cplusplus |
107 |
| -} |
108 |
| -#endif |
109 |
| - |
110 | 105 | #endif /* MBEDTLS_SHA1_ALT */
|
111 | 106 |
|
112 | 107 | #endif /* sha1_alt.h */
|
0 commit comments