You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -21,22 +23,28 @@
21
23
#defineMBEDTLS_SHA256_ALT_H
22
24
23
25
#if defined (MBEDTLS_SHA256_ALT)
24
-
#include"mbedtls/platform.h"
25
-
#include"mbedtls/config.h"
26
26
27
27
#include"cmsis.h"
28
28
#include<string.h>
29
+
29
30
#ifdef__cplusplus
30
31
extern"C" {
31
32
#endif
32
33
34
+
#defineMBEDTLS_SHA256_BLOCK_SIZE ((size_t)(64)) // must be a multiple of 4
33
35
/**
34
36
* \brief SHA-256 context structure
37
+
* \note HAL_HASH_SHA256_Accumulate cannot handle less than 4 bytes, unless it is the last call to the function
38
+
* A MBEDTLS_SHA256_BLOCK_SIZE bytes buffer is used to save values and handle the processing
39
+
* MBEDTLS_SHA256_BLOCK_SIZE bytes per MBEDTLS_SHA256_BLOCK_SIZE bytes
40
+
* If sha256_finish is called and sbuf_len>0, the remaining bytes are accumulated prior to the call to HAL_HASH_SHA256_Finish
35
41
*/
36
42
typedefstruct
37
43
{
38
44
intis224; /*!< 0 => SHA-256, else SHA-224 */
39
45
HASH_HandleTypeDefhhash_sha256;
46
+
unsigned charsbuf[MBEDTLS_SHA256_BLOCK_SIZE]; /*!< MBEDTLS_SHA256_BLOCK_SIZE buffer to store values so that algorithm is caled once the buffer is filled */
47
+
unsigned charsbuf_len; /*!< number of bytes to be processed in sbuf */
0 commit comments