File tree 2 files changed +12
-7
lines changed
2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -33,15 +33,21 @@ constexpr size_t SHA256::HASH_SIZE;
33
33
34
34
void SHA256::begin ()
35
35
{
36
- br_sha256_init (&_ctx);
36
+ spare_len = 0 ;
37
+ ECCX08.beginSHA256 ();
37
38
}
38
39
39
40
void SHA256::update (uint8_t const * data, size_t const len)
40
41
{
41
- br_sha256_update (&_ctx, data, len);
42
+ if (len == 64 ) {
43
+ ECCX08.updateSHA256 (data);
44
+ } else {
45
+ memcpy (spare_buf, data, len);
46
+ spare_len = len;
47
+ }
42
48
}
43
49
44
50
void SHA256::finalize (uint8_t * hash)
45
51
{
46
- br_sha256_out (&_ctx , hash);
52
+ ECCX08. endSHA256 (spare_buf, spare_len , hash);
47
53
}
Original file line number Diff line number Diff line change 22
22
* INCLUDE
23
23
******************************************************************************/
24
24
25
- #include " ../bearssl/bearssl_hash .h"
25
+ #include " ArduinoECCX08 .h"
26
26
27
27
/* *****************************************************************************
28
28
* CLASS DECLARATION
@@ -40,9 +40,8 @@ class SHA256
40
40
void finalize (uint8_t * hash);
41
41
42
42
private:
43
-
44
- br_sha256_context _ctx;
45
-
43
+ uint8_t spare_buf[64 ];
44
+ size_t spare_len = 0 ;
46
45
};
47
46
48
47
#endif /* ARDUINO_TLS_UTILITY_SHA256_H_ */
You can’t perform that action at this time.
0 commit comments