mimxrt1160_crypto_hash.c
Go to the documentation of this file.
1 /**
2  * @file mimxrt1160_crypto_hash.c
3  * @brief i.MX RT1160 hash hardware accelerator
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneCRYPTO Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.4
29  **/
30 
31 //Switch to the appropriate trace level
32 #define TRACE_LEVEL CRYPTO_TRACE_LEVEL
33 
34 //Dependencies
35 #include "fsl_device_registers.h"
36 #include "fsl_caam.h"
37 #include "core/crypto.h"
40 #include "hash/hash_algorithms.h"
41 #include "debug.h"
42 
43 //Check crypto library configuration
44 #if (MIMXRT1160_CRYPTO_HASH_SUPPORT == ENABLED)
45 
46 //CAAM hash context
47 static caam_hash_ctx_t caamHashContext;
48 
49 
50 #if (SHA1_SUPPORT == ENABLED)
51 
52 /**
53  * @brief Digest a message using SHA-1
54  * @param[in] data Pointer to the message being hashed
55  * @param[in] length Length of the message
56  * @param[out] digest Pointer to the calculated digest
57  * @return Error code
58  **/
59 
60 error_t sha1Compute(const void *data, size_t length, uint8_t *digest)
61 {
62  size_t n;
63  status_t status;
64  caam_handle_t caamHandle;
65 
66  //Set CAAM job ring
67  caamHandle.jobRing = kCAAM_JobRing0;
68 
69  //Acquire exclusive access to the CAAM module
71 
72  //Initialize hash computation
73  status = CAAM_HASH_Init(CAAM, &caamHandle, &caamHashContext, kCAAM_Sha1,
74  NULL, 0);
75 
76  //Check status code
77  if(status == kStatus_Success)
78  {
79  //Digest message
80  status = CAAM_HASH_Update(&caamHashContext, data, length);
81  }
82 
83  //Check status code
84  if(status == kStatus_Success)
85  {
86  //Specify the size of the output buffer
88  //Finalize hash computation
89  status = CAAM_HASH_Finish(&caamHashContext, digest, &n);
90  }
91 
92  //Release exclusive access to the CAAM module
94 
95  //Return status code
96  return (status == kStatus_Success) ? NO_ERROR : ERROR_FAILURE;
97 }
98 
99 
100 /**
101  * @brief Initialize SHA-1 message digest context
102  * @param[in] context Pointer to the SHA-1 context to initialize
103  **/
104 
105 void sha1Init(Sha1Context *context)
106 {
107  caam_handle_t *caamHandle;
108 
109  //Point to the CAAM handle
110  caamHandle = &context->caamHandle;
111  //Set CAAM job ring
112  caamHandle->jobRing = kCAAM_JobRing0;
113 
114  //Acquire exclusive access to the CAAM module
116 
117  //Initialize hash computation
118  CAAM_HASH_Init(CAAM, caamHandle, &caamHashContext, kCAAM_Sha1, NULL, 0);
119  //Save hash context
120  osMemcpy(context->caamContext, &caamHashContext, sizeof(caam_hash_ctx_t));
121 
122  //Release exclusive access to the CAAM module
124 }
125 
126 
127 /**
128  * @brief Update the SHA-1 context with a portion of the message being hashed
129  * @param[in] context Pointer to the SHA-1 context
130  * @param[in] data Pointer to the buffer being hashed
131  * @param[in] length Length of the buffer
132  **/
133 
134 void sha1Update(Sha1Context *context, const void *data, size_t length)
135 {
136  //Acquire exclusive access to the CAAM module
138 
139  //Restore hash context
140  osMemcpy(&caamHashContext, context->caamContext, sizeof(caam_hash_ctx_t));
141  //Digest the message
142  CAAM_HASH_Update(&caamHashContext, data, length);
143  //Save hash context
144  osMemcpy(context->caamContext, &caamHashContext, sizeof(caam_hash_ctx_t));
145 
146  //Release exclusive access to the CAAM module
148 }
149 
150 
151 /**
152  * @brief Finish the SHA-1 message digest
153  * @param[in] context Pointer to the SHA-1 context
154  * @param[out] digest Calculated digest (optional parameter)
155  **/
156 
157 void sha1Final(Sha1Context *context, uint8_t *digest)
158 {
159  size_t n;
160 
161  //Specify the size of the output buffer
163 
164  //Acquire exclusive access to the CAAM module
166 
167  //Restore hash context
168  osMemcpy(&caamHashContext, context->caamContext, sizeof(caam_hash_ctx_t));
169  //Finalize hash computation
170  CAAM_HASH_Finish(&caamHashContext, context->digest, &n);
171 
172  //Release exclusive access to the CAAM module
174 
175  //Copy the resulting digest
176  if(digest != NULL)
177  {
178  osMemcpy(digest, context->digest, SHA1_DIGEST_SIZE);
179  }
180 }
181 
182 #endif
183 #if (SHA224_SUPPORT == ENABLED)
184 
185 /**
186  * @brief Digest a message using SHA-224
187  * @param[in] data Pointer to the message being hashed
188  * @param[in] length Length of the message
189  * @param[out] digest Pointer to the calculated digest
190  * @return Error code
191  **/
192 
193 error_t sha224Compute(const void *data, size_t length, uint8_t *digest)
194 {
195  size_t n;
196  status_t status;
197  caam_handle_t caamHandle;
198 
199  //Set CAAM job ring
200  caamHandle.jobRing = kCAAM_JobRing0;
201 
202  //Acquire exclusive access to the CAAM module
204 
205  //Initialize hash computation
206  status = CAAM_HASH_Init(CAAM, &caamHandle, &caamHashContext, kCAAM_Sha224,
207  NULL, 0);
208 
209  //Check status code
210  if(status == kStatus_Success)
211  {
212  //Digest message
213  status = CAAM_HASH_Update(&caamHashContext, data, length);
214  }
215 
216  //Check status code
217  if(status == kStatus_Success)
218  {
219  //Specify the size of the output buffer
221  //Finalize hash computation
222  status = CAAM_HASH_Finish(&caamHashContext, digest, &n);
223  }
224 
225  //Release exclusive access to the CAAM module
227 
228  //Return status code
229  return (status == kStatus_Success) ? NO_ERROR : ERROR_FAILURE;
230 }
231 
232 
233 /**
234  * @brief Initialize SHA-224 message digest context
235  * @param[in] context Pointer to the SHA-224 context to initialize
236  **/
237 
238 void sha224Init(Sha224Context *context)
239 {
240  caam_handle_t *caamHandle;
241 
242  //Point to the CAAM handle
243  caamHandle = &context->caamHandle;
244  //Set CAAM job ring
245  caamHandle->jobRing = kCAAM_JobRing0;
246 
247  //Acquire exclusive access to the CAAM module
249 
250  //Initialize hash computation
251  CAAM_HASH_Init(CAAM, caamHandle, &caamHashContext, kCAAM_Sha224, NULL, 0);
252  //Save hash context
253  osMemcpy(context->caamContext, &caamHashContext, sizeof(caam_hash_ctx_t));
254 
255  //Release exclusive access to the CAAM module
257 }
258 
259 
260 /**
261  * @brief Update the SHA-224 context with a portion of the message being hashed
262  * @param[in] context Pointer to the SHA-224 context
263  * @param[in] data Pointer to the buffer being hashed
264  * @param[in] length Length of the buffer
265  **/
266 
267 void sha224Update(Sha224Context *context, const void *data, size_t length)
268 {
269  //Acquire exclusive access to the CAAM module
271 
272  //Restore hash context
273  osMemcpy(&caamHashContext, context->caamContext, sizeof(caam_hash_ctx_t));
274  //Digest the message
275  CAAM_HASH_Update(&caamHashContext, data, length);
276  //Save hash context
277  osMemcpy(context->caamContext, &caamHashContext, sizeof(caam_hash_ctx_t));
278 
279  //Release exclusive access to the CAAM module
281 }
282 
283 
284 /**
285  * @brief Finish the SHA-224 message digest
286  * @param[in] context Pointer to the SHA-224 context
287  * @param[out] digest Calculated digest (optional parameter)
288  **/
289 
290 void sha224Final(Sha224Context *context, uint8_t *digest)
291 {
292  size_t n;
293 
294  //Specify the size of the output buffer
296 
297  //Acquire exclusive access to the CAAM module
299 
300  //Restore hash context
301  osMemcpy(&caamHashContext, context->caamContext, sizeof(caam_hash_ctx_t));
302  //Finalize hash computation
303  CAAM_HASH_Finish(&caamHashContext, context->digest, &n);
304 
305  //Release exclusive access to the CAAM module
307 
308  //Copy the resulting digest
309  if(digest != NULL)
310  {
311  osMemcpy(digest, context->digest, SHA224_DIGEST_SIZE);
312  }
313 }
314 
315 #endif
316 #if (SHA256_SUPPORT == ENABLED)
317 
318 /**
319  * @brief Digest a message using SHA-256
320  * @param[in] data Pointer to the message being hashed
321  * @param[in] length Length of the message
322  * @param[out] digest Pointer to the calculated digest
323  * @return Error code
324  **/
325 
326 error_t sha256Compute(const void *data, size_t length, uint8_t *digest)
327 {
328  size_t n;
329  status_t status;
330  caam_handle_t caamHandle;
331 
332  //Set CAAM job ring
333  caamHandle.jobRing = kCAAM_JobRing0;
334 
335  //Acquire exclusive access to the CAAM module
337 
338  //Initialize hash computation
339  status = CAAM_HASH_Init(CAAM, &caamHandle, &caamHashContext, kCAAM_Sha256,
340  NULL, 0);
341 
342  //Check status code
343  if(status == kStatus_Success)
344  {
345  //Digest message
346  status = CAAM_HASH_Update(&caamHashContext, data, length);
347  }
348 
349  //Check status code
350  if(status == kStatus_Success)
351  {
352  //Specify the size of the output buffer
354  //Finalize hash computation
355  status = CAAM_HASH_Finish(&caamHashContext, digest, &n);
356  }
357 
358  //Release exclusive access to the CAAM module
360 
361  //Return status code
362  return (status == kStatus_Success) ? NO_ERROR : ERROR_FAILURE;
363 }
364 
365 
366 /**
367  * @brief Initialize SHA-256 message digest context
368  * @param[in] context Pointer to the SHA-256 context to initialize
369  **/
370 
371 void sha256Init(Sha256Context *context)
372 {
373  caam_handle_t *caamHandle;
374 
375  //Point to the CAAM handle
376  caamHandle = &context->caamHandle;
377  //Set CAAM job ring
378  caamHandle->jobRing = kCAAM_JobRing0;
379 
380  //Acquire exclusive access to the CAAM module
382 
383  //Initialize hash computation
384  CAAM_HASH_Init(CAAM, caamHandle, &caamHashContext, kCAAM_Sha256, NULL, 0);
385  //Save hash context
386  osMemcpy(context->caamContext, &caamHashContext, sizeof(caam_hash_ctx_t));
387 
388  //Release exclusive access to the CAAM module
390 }
391 
392 
393 /**
394  * @brief Update the SHA-256 context with a portion of the message being hashed
395  * @param[in] context Pointer to the SHA-256 context
396  * @param[in] data Pointer to the buffer being hashed
397  * @param[in] length Length of the buffer
398  **/
399 
400 void sha256Update(Sha256Context *context, const void *data, size_t length)
401 {
402  //Acquire exclusive access to the CAAM module
404 
405  //Restore hash context
406  osMemcpy(&caamHashContext, context->caamContext, sizeof(caam_hash_ctx_t));
407  //Digest the message
408  CAAM_HASH_Update(&caamHashContext, data, length);
409  //Save hash context
410  osMemcpy(context->caamContext, &caamHashContext, sizeof(caam_hash_ctx_t));
411 
412  //Release exclusive access to the CAAM module
414 }
415 
416 
417 /**
418  * @brief Finish the SHA-256 message digest
419  * @param[in] context Pointer to the SHA-256 context
420  * @param[out] digest Calculated digest (optional parameter)
421  **/
422 
423 void sha256Final(Sha256Context *context, uint8_t *digest)
424 {
425  size_t n;
426 
427  //Specify the size of the output buffer
429 
430  //Acquire exclusive access to the CAAM module
432 
433  //Restore hash context
434  osMemcpy(&caamHashContext, context->caamContext, sizeof(caam_hash_ctx_t));
435  //Finalize hash computation
436  CAAM_HASH_Finish(&caamHashContext, context->digest, &n);
437 
438  //Release exclusive access to the CAAM module
440 
441  //Copy the resulting digest
442  if(digest != NULL)
443  {
444  osMemcpy(digest, context->digest, SHA256_DIGEST_SIZE);
445  }
446 }
447 
448 #endif
449 #if (SHA384_SUPPORT == ENABLED)
450 
451 /**
452  * @brief Digest a message using SHA-384
453  * @param[in] data Pointer to the message being hashed
454  * @param[in] length Length of the message
455  * @param[out] digest Pointer to the calculated digest
456  * @return Error code
457  **/
458 
459 error_t sha384Compute(const void *data, size_t length, uint8_t *digest)
460 {
461  size_t n;
462  status_t status;
463  caam_handle_t caamHandle;
464 
465  //Set CAAM job ring
466  caamHandle.jobRing = kCAAM_JobRing0;
467 
468  //Acquire exclusive access to the CAAM module
470 
471  //Initialize hash computation
472  status = CAAM_HASH_Init(CAAM, &caamHandle, &caamHashContext, kCAAM_Sha384,
473  NULL, 0);
474 
475  //Check status code
476  if(status == kStatus_Success)
477  {
478  //Digest message
479  status = CAAM_HASH_Update(&caamHashContext, data, length);
480  }
481 
482  //Check status code
483  if(status == kStatus_Success)
484  {
485  //Specify the size of the output buffer
487  //Finalize hash computation
488  status = CAAM_HASH_Finish(&caamHashContext, digest, &n);
489  }
490 
491  //Release exclusive access to the CAAM module
493 
494  //Return status code
495  return (status == kStatus_Success) ? NO_ERROR : ERROR_FAILURE;
496 }
497 
498 
499 /**
500  * @brief Initialize SHA-384 message digest context
501  * @param[in] context Pointer to the SHA-384 context to initialize
502  **/
503 
504 void sha384Init(Sha384Context *context)
505 {
506  caam_handle_t *caamHandle;
507 
508  //Point to the CAAM handle
509  caamHandle = &context->caamHandle;
510  //Set CAAM job ring
511  caamHandle->jobRing = kCAAM_JobRing0;
512 
513  //Acquire exclusive access to the CAAM module
515 
516  //Initialize hash computation
517  CAAM_HASH_Init(CAAM, caamHandle, &caamHashContext, kCAAM_Sha384, NULL, 0);
518  //Save hash context
519  osMemcpy(context->caamContext, &caamHashContext, sizeof(caam_hash_ctx_t));
520 
521  //Release exclusive access to the CAAM module
523 }
524 
525 
526 /**
527  * @brief Update the SHA-384 context with a portion of the message being hashed
528  * @param[in] context Pointer to the SHA-384 context
529  * @param[in] data Pointer to the buffer being hashed
530  * @param[in] length Length of the buffer
531  **/
532 
533 void sha384Update(Sha384Context *context, const void *data, size_t length)
534 {
535  //Acquire exclusive access to the CAAM module
537 
538  //Restore hash context
539  osMemcpy(&caamHashContext, context->caamContext, sizeof(caam_hash_ctx_t));
540  //Digest the message
541  CAAM_HASH_Update(&caamHashContext, data, length);
542  //Save hash context
543  osMemcpy(context->caamContext, &caamHashContext, sizeof(caam_hash_ctx_t));
544 
545  //Release exclusive access to the CAAM module
547 }
548 
549 
550 /**
551  * @brief Finish the SHA-384 message digest
552  * @param[in] context Pointer to the SHA-384 context
553  * @param[out] digest Calculated digest (optional parameter)
554  **/
555 
556 void sha384Final(Sha384Context *context, uint8_t *digest)
557 {
558  size_t n;
559 
560  //Specify the size of the output buffer
562 
563  //Acquire exclusive access to the CAAM module
565 
566  //Restore hash context
567  osMemcpy(&caamHashContext, context->caamContext, sizeof(caam_hash_ctx_t));
568  //Finalize hash computation
569  CAAM_HASH_Finish(&caamHashContext, context->digest, &n);
570 
571  //Release exclusive access to the CAAM module
573 
574  //Copy the resulting digest
575  if(digest != NULL)
576  {
577  osMemcpy(digest, context->digest, SHA384_DIGEST_SIZE);
578  }
579 }
580 
581 #endif
582 #if (SHA512_SUPPORT == ENABLED)
583 
584 /**
585  * @brief Digest a message using SHA-512
586  * @param[in] data Pointer to the message being hashed
587  * @param[in] length Length of the message
588  * @param[out] digest Pointer to the calculated digest
589  * @return Error code
590  **/
591 
592 error_t sha512Compute(const void *data, size_t length, uint8_t *digest)
593 {
594  size_t n;
595  status_t status;
596  caam_handle_t caamHandle;
597 
598  //Set CAAM job ring
599  caamHandle.jobRing = kCAAM_JobRing0;
600 
601  //Acquire exclusive access to the CAAM module
603 
604  //Initialize hash computation
605  status = CAAM_HASH_Init(CAAM, &caamHandle, &caamHashContext, kCAAM_Sha512,
606  NULL, 0);
607 
608  //Check status code
609  if(status == kStatus_Success)
610  {
611  //Digest message
612  status = CAAM_HASH_Update(&caamHashContext, data, length);
613  }
614 
615  //Check status code
616  if(status == kStatus_Success)
617  {
618  //Specify the size of the output buffer
620  //Finalize hash computation
621  status = CAAM_HASH_Finish(&caamHashContext, digest, &n);
622  }
623 
624  //Release exclusive access to the CAAM module
626 
627  //Return status code
628  return (status == kStatus_Success) ? NO_ERROR : ERROR_FAILURE;
629 }
630 
631 
632 /**
633  * @brief Initialize SHA-512 message digest context
634  * @param[in] context Pointer to the SHA-512 context to initialize
635  **/
636 
637 void sha512Init(Sha512Context *context)
638 {
639  caam_handle_t *caamHandle;
640 
641  //Point to the CAAM handle
642  caamHandle = &context->caamHandle;
643  //Set CAAM job ring
644  caamHandle->jobRing = kCAAM_JobRing0;
645 
646  //Acquire exclusive access to the CAAM module
648 
649  //Initialize hash computation
650  CAAM_HASH_Init(CAAM, caamHandle, &caamHashContext, kCAAM_Sha512, NULL, 0);
651  //Save hash context
652  osMemcpy(context->caamContext, &caamHashContext, sizeof(caam_hash_ctx_t));
653 
654  //Release exclusive access to the CAAM module
656 }
657 
658 
659 /**
660  * @brief Update the SHA-512 context with a portion of the message being hashed
661  * @param[in] context Pointer to the SHA-512 context
662  * @param[in] data Pointer to the buffer being hashed
663  * @param[in] length Length of the buffer
664  **/
665 
666 void sha512Update(Sha512Context *context, const void *data, size_t length)
667 {
668  //Acquire exclusive access to the CAAM module
670 
671  //Restore hash context
672  osMemcpy(&caamHashContext, context->caamContext, sizeof(caam_hash_ctx_t));
673  //Digest the message
674  CAAM_HASH_Update(&caamHashContext, data, length);
675  //Save hash context
676  osMemcpy(context->caamContext, &caamHashContext, sizeof(caam_hash_ctx_t));
677 
678  //Release exclusive access to the CAAM module
680 }
681 
682 
683 /**
684  * @brief Finish the SHA-512 message digest
685  * @param[in] context Pointer to the SHA-512 context
686  * @param[out] digest Calculated digest (optional parameter)
687  **/
688 
689 void sha512Final(Sha512Context *context, uint8_t *digest)
690 {
691  size_t n;
692 
693  //Specify the size of the output buffer
695 
696  //Acquire exclusive access to the CAAM module
698 
699  //Restore hash context
700  osMemcpy(&caamHashContext, context->caamContext, sizeof(caam_hash_ctx_t));
701  //Finalize hash computation
702  CAAM_HASH_Finish(&caamHashContext, context->digest, &n);
703 
704  //Release exclusive access to the CAAM module
706 
707  //Copy the resulting digest
708  if(digest != NULL)
709  {
710  osMemcpy(digest, context->digest, SHA512_DIGEST_SIZE);
711  }
712 }
713 
714 #endif
715 #endif
void sha1Init(Sha1Context *context)
Initialize SHA-1 message digest context.
error_t sha1Compute(const void *data, size_t length, uint8_t *digest)
Digest a message using SHA-1.
SHA-256 algorithm context.
Definition: sha256.h:62
error_t sha256Compute(const void *data, size_t length, uint8_t *digest)
Digest a message using SHA-256.
void sha512Update(Sha512Context *context, const void *data, size_t length)
Update the SHA-512 context with a portion of the message being hashed.
uint8_t data[]
Definition: ethernet.h:222
i.MX RT1160 hardware cryptographic accelerator (CAAM)
#define SHA224_DIGEST_SIZE
Definition: sha224.h:41
void sha256Init(Sha256Context *context)
Initialize SHA-256 message digest context.
void sha224Final(Sha224Context *context, uint8_t *digest)
Finish the SHA-224 message digest.
void sha512Final(Sha512Context *context, uint8_t *digest)
Finish the SHA-512 message digest.
#define osMemcpy(dest, src, length)
Definition: os_port.h:141
error_t sha384Compute(const void *data, size_t length, uint8_t *digest)
Digest a message using SHA-384.
error_t
Error codes.
Definition: error.h:43
error_t sha224Compute(const void *data, size_t length, uint8_t *digest)
Digest a message using SHA-224.
@ ERROR_FAILURE
Generic error code.
Definition: error.h:45
void sha224Update(Sha224Context *context, const void *data, size_t length)
Update the SHA-224 context with a portion of the message being hashed.
SHA-512 algorithm context.
Definition: sha512.h:62
General definitions for cryptographic algorithms.
void sha256Final(Sha256Context *context, uint8_t *digest)
Finish the SHA-256 message digest.
uint8_t length
Definition: tcp.h:368
void sha1Final(Sha1Context *context, uint8_t *digest)
Finish the SHA-1 message digest.
#define SHA384_DIGEST_SIZE
Definition: sha384.h:41
error_t sha512Compute(const void *data, size_t length, uint8_t *digest)
Digest a message using SHA-512.
Collection of hash algorithms.
void sha224Init(Sha224Context *context)
Initialize SHA-224 message digest context.
uint8_t digest[32]
Definition: sha256.h:66
#define SHA1_DIGEST_SIZE
Definition: sha1.h:45
uint8_t n
void osAcquireMutex(OsMutex *mutex)
Acquire ownership of the specified mutex object.
void osReleaseMutex(OsMutex *mutex)
Release ownership of the specified mutex object.
i.MX RT1160 hash hardware accelerator
uint8_t digest[64]
Definition: sha512.h:66
SHA-1 algorithm context.
Definition: sha1.h:62
void sha384Init(Sha384Context *context)
Initialize SHA-384 message digest context.
void sha1Update(Sha1Context *context, const void *data, size_t length)
Update the SHA-1 context with a portion of the message being hashed.
OsMutex mimxrt1160CryptoMutex
void sha512Init(Sha512Context *context)
Initialize SHA-512 message digest context.
#define SHA256_DIGEST_SIZE
Definition: sha256.h:45
void sha384Final(Sha384Context *context, uint8_t *digest)
Finish the SHA-384 message digest.
uint8_t digest[20]
Definition: sha1.h:66
#define SHA512_DIGEST_SIZE
Definition: sha512.h:45
void sha384Update(Sha384Context *context, const void *data, size_t length)
Update the SHA-384 context with a portion of the message being hashed.
@ NO_ERROR
Success.
Definition: error.h:44
Debugging facilities.
void sha256Update(Sha256Context *context, const void *data, size_t length)
Update the SHA-256 context with a portion of the message being hashed.