mimxrt1170_crypto_hash.c
Go to the documentation of this file.
1 /**
2  * @file mimxrt1170_crypto_hash.c
3  * @brief i.MX RT1170 hash hardware accelerator
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2025 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.5.0
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 (MIMXRT1170_CRYPTO_HASH_SUPPORT == ENABLED)
45 
46 //IAR EWARM compiler?
47 #if defined(__ICCARM__)
48 
49 //CAAM hash context
50 #pragma data_alignment = 16
51 caam_hash_ctx_t caamHashContext;
52 
53 //CAAM digest output
54 #pragma data_alignment = 16
55 uint8_t caamDigestOut[64];
56 
57 //ARM or GCC compiler?
58 #else
59 
60 //CAAM hash context
61 caam_hash_ctx_t caamHashContext
62  __attribute__((aligned(16)));
63 
64 //CAAM digest output
65 uint8_t caamDigestOut[64]
66  __attribute__((aligned(16)));
67 
68 #endif
69 
70 
71 #if (SHA1_SUPPORT == ENABLED)
72 
73 /**
74  * @brief Digest a message using SHA-1
75  * @param[in] data Pointer to the message being hashed
76  * @param[in] length Length of the message
77  * @param[out] digest Pointer to the calculated digest
78  * @return Error code
79  **/
80 
81 error_t sha1Compute(const void *data, size_t length, uint8_t *digest)
82 {
83  size_t n;
84  status_t status;
85  caam_handle_t caamHandle;
86 
87  //Set CAAM job ring
88  caamHandle.jobRing = kCAAM_JobRing0;
89 
90  //Acquire exclusive access to the CAAM module
92 
93  //Initialize hash computation
94  status = CAAM_HASH_Init(CAAM, &caamHandle, &caamHashContext, kCAAM_Sha1,
95  NULL, 0);
96 
97  //Check status code
98  if(status == kStatus_Success)
99  {
100  //Digest message
101  status = CAAM_HASH_Update(&caamHashContext, data, length);
102  }
103 
104  //Check status code
105  if(status == kStatus_Success)
106  {
107  //Specify the size of the output buffer
109  //Finalize hash computation
110  status = CAAM_HASH_Finish(&caamHashContext, caamDigestOut, &n);
111  }
112 
113  //Check status code
114  if(status == kStatus_Success)
115  {
116  //Copy the resulting digest
117  osMemcpy(digest, caamDigestOut, SHA1_DIGEST_SIZE);
118  }
119 
120  //Release exclusive access to the CAAM module
122 
123  //Return status code
124  return (status == kStatus_Success) ? NO_ERROR : ERROR_FAILURE;
125 }
126 
127 
128 /**
129  * @brief Initialize SHA-1 message digest context
130  * @param[in] context Pointer to the SHA-1 context to initialize
131  **/
132 
133 void sha1Init(Sha1Context *context)
134 {
135  caam_handle_t *caamHandle;
136 
137  //Point to the CAAM handle
138  caamHandle = &context->caamHandle;
139  //Set CAAM job ring
140  caamHandle->jobRing = kCAAM_JobRing0;
141 
142  //Acquire exclusive access to the CAAM module
144 
145  //Initialize hash computation
146  CAAM_HASH_Init(CAAM, caamHandle, &caamHashContext, kCAAM_Sha1, NULL, 0);
147  //Save hash context
148  osMemcpy(context->caamContext, &caamHashContext, sizeof(caam_hash_ctx_t));
149 
150  //Release exclusive access to the CAAM module
152 }
153 
154 
155 /**
156  * @brief Update the SHA-1 context with a portion of the message being hashed
157  * @param[in] context Pointer to the SHA-1 context
158  * @param[in] data Pointer to the buffer being hashed
159  * @param[in] length Length of the buffer
160  **/
161 
162 void sha1Update(Sha1Context *context, const void *data, size_t length)
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  //Digest the message
170  CAAM_HASH_Update(&caamHashContext, data, length);
171  //Save hash context
172  osMemcpy(context->caamContext, &caamHashContext, sizeof(caam_hash_ctx_t));
173 
174  //Release exclusive access to the CAAM module
176 }
177 
178 
179 /**
180  * @brief Finish the SHA-1 message digest
181  * @param[in] context Pointer to the SHA-1 context
182  * @param[out] digest Calculated digest
183  **/
184 
185 void sha1Final(Sha1Context *context, uint8_t *digest)
186 {
187  size_t n;
188 
189  //Specify the size of the output buffer
191 
192  //Acquire exclusive access to the CAAM module
194 
195  //Restore hash context
196  osMemcpy(&caamHashContext, context->caamContext, sizeof(caam_hash_ctx_t));
197  //Finalize hash computation
198  CAAM_HASH_Finish(&caamHashContext, caamDigestOut, &n);
199 
200  //Save the resulting digest
201  osMemcpy(digest, caamDigestOut, SHA1_DIGEST_SIZE);
202 
203  //Release exclusive access to the CAAM module
205 }
206 
207 #endif
208 #if (SHA224_SUPPORT == ENABLED)
209 
210 /**
211  * @brief Digest a message using SHA-224
212  * @param[in] data Pointer to the message being hashed
213  * @param[in] length Length of the message
214  * @param[out] digest Pointer to the calculated digest
215  * @return Error code
216  **/
217 
218 error_t sha224Compute(const void *data, size_t length, uint8_t *digest)
219 {
220  size_t n;
221  status_t status;
222  caam_handle_t caamHandle;
223 
224  //Set CAAM job ring
225  caamHandle.jobRing = kCAAM_JobRing0;
226 
227  //Acquire exclusive access to the CAAM module
229 
230  //Initialize hash computation
231  status = CAAM_HASH_Init(CAAM, &caamHandle, &caamHashContext, kCAAM_Sha224,
232  NULL, 0);
233 
234  //Check status code
235  if(status == kStatus_Success)
236  {
237  //Digest message
238  status = CAAM_HASH_Update(&caamHashContext, data, length);
239  }
240 
241  //Check status code
242  if(status == kStatus_Success)
243  {
244  //Specify the size of the output buffer
246  //Finalize hash computation
247  status = CAAM_HASH_Finish(&caamHashContext, caamDigestOut, &n);
248  }
249 
250  //Check status code
251  if(status == kStatus_Success)
252  {
253  //Copy the resulting digest
254  osMemcpy(digest, caamDigestOut, SHA224_DIGEST_SIZE);
255  }
256 
257  //Release exclusive access to the CAAM module
259 
260  //Return status code
261  return (status == kStatus_Success) ? NO_ERROR : ERROR_FAILURE;
262 }
263 
264 
265 /**
266  * @brief Initialize SHA-224 message digest context
267  * @param[in] context Pointer to the SHA-224 context to initialize
268  **/
269 
270 void sha224Init(Sha224Context *context)
271 {
272  caam_handle_t *caamHandle;
273 
274  //Point to the CAAM handle
275  caamHandle = &context->caamHandle;
276  //Set CAAM job ring
277  caamHandle->jobRing = kCAAM_JobRing0;
278 
279  //Acquire exclusive access to the CAAM module
281 
282  //Initialize hash computation
283  CAAM_HASH_Init(CAAM, caamHandle, &caamHashContext, kCAAM_Sha224, NULL, 0);
284  //Save hash context
285  osMemcpy(context->caamContext, &caamHashContext, sizeof(caam_hash_ctx_t));
286 
287  //Release exclusive access to the CAAM module
289 }
290 
291 
292 /**
293  * @brief Update the SHA-224 context with a portion of the message being hashed
294  * @param[in] context Pointer to the SHA-224 context
295  * @param[in] data Pointer to the buffer being hashed
296  * @param[in] length Length of the buffer
297  **/
298 
299 void sha224Update(Sha224Context *context, const void *data, size_t length)
300 {
301  //Acquire exclusive access to the CAAM module
303 
304  //Restore hash context
305  osMemcpy(&caamHashContext, context->caamContext, sizeof(caam_hash_ctx_t));
306  //Digest the message
307  CAAM_HASH_Update(&caamHashContext, data, length);
308  //Save hash context
309  osMemcpy(context->caamContext, &caamHashContext, sizeof(caam_hash_ctx_t));
310 
311  //Release exclusive access to the CAAM module
313 }
314 
315 
316 /**
317  * @brief Finish the SHA-224 message digest
318  * @param[in] context Pointer to the SHA-224 context
319  * @param[out] digest Calculated digest
320  **/
321 
322 void sha224Final(Sha224Context *context, uint8_t *digest)
323 {
324  size_t n;
325 
326  //Specify the size of the output buffer
328 
329  //Acquire exclusive access to the CAAM module
331 
332  //Restore hash context
333  osMemcpy(&caamHashContext, context->caamContext, sizeof(caam_hash_ctx_t));
334  //Finalize hash computation
335  CAAM_HASH_Finish(&caamHashContext, caamDigestOut, &n);
336 
337  //Save the resulting digest
338  osMemcpy(digest, caamDigestOut, SHA224_DIGEST_SIZE);
339 
340  //Release exclusive access to the CAAM module
342 }
343 
344 #endif
345 #if (SHA256_SUPPORT == ENABLED)
346 
347 /**
348  * @brief Digest a message using SHA-256
349  * @param[in] data Pointer to the message being hashed
350  * @param[in] length Length of the message
351  * @param[out] digest Pointer to the calculated digest
352  * @return Error code
353  **/
354 
355 error_t sha256Compute(const void *data, size_t length, uint8_t *digest)
356 {
357  size_t n;
358  status_t status;
359  caam_handle_t caamHandle;
360 
361  //Set CAAM job ring
362  caamHandle.jobRing = kCAAM_JobRing0;
363 
364  //Acquire exclusive access to the CAAM module
366 
367  //Initialize hash computation
368  status = CAAM_HASH_Init(CAAM, &caamHandle, &caamHashContext, kCAAM_Sha256,
369  NULL, 0);
370 
371  //Check status code
372  if(status == kStatus_Success)
373  {
374  //Digest message
375  status = CAAM_HASH_Update(&caamHashContext, data, length);
376  }
377 
378  //Check status code
379  if(status == kStatus_Success)
380  {
381  //Specify the size of the output buffer
383  //Finalize hash computation
384  status = CAAM_HASH_Finish(&caamHashContext, caamDigestOut, &n);
385  }
386 
387  //Check status code
388  if(status == kStatus_Success)
389  {
390  //Copy the resulting digest
391  osMemcpy(digest, caamDigestOut, SHA256_DIGEST_SIZE);
392  }
393 
394  //Release exclusive access to the CAAM module
396 
397  //Return status code
398  return (status == kStatus_Success) ? NO_ERROR : ERROR_FAILURE;
399 }
400 
401 
402 /**
403  * @brief Initialize SHA-256 message digest context
404  * @param[in] context Pointer to the SHA-256 context to initialize
405  **/
406 
407 void sha256Init(Sha256Context *context)
408 {
409  caam_handle_t *caamHandle;
410 
411  //Point to the CAAM handle
412  caamHandle = &context->caamHandle;
413  //Set CAAM job ring
414  caamHandle->jobRing = kCAAM_JobRing0;
415 
416  //Acquire exclusive access to the CAAM module
418 
419  //Initialize hash computation
420  CAAM_HASH_Init(CAAM, caamHandle, &caamHashContext, kCAAM_Sha256, NULL, 0);
421  //Save hash context
422  osMemcpy(context->caamContext, &caamHashContext, sizeof(caam_hash_ctx_t));
423 
424  //Release exclusive access to the CAAM module
426 }
427 
428 
429 /**
430  * @brief Update the SHA-256 context with a portion of the message being hashed
431  * @param[in] context Pointer to the SHA-256 context
432  * @param[in] data Pointer to the buffer being hashed
433  * @param[in] length Length of the buffer
434  **/
435 
436 void sha256Update(Sha256Context *context, const void *data, size_t length)
437 {
438  //Acquire exclusive access to the CAAM module
440 
441  //Restore hash context
442  osMemcpy(&caamHashContext, context->caamContext, sizeof(caam_hash_ctx_t));
443  //Digest the message
444  CAAM_HASH_Update(&caamHashContext, data, length);
445  //Save hash context
446  osMemcpy(context->caamContext, &caamHashContext, sizeof(caam_hash_ctx_t));
447 
448  //Release exclusive access to the CAAM module
450 }
451 
452 
453 /**
454  * @brief Finish the SHA-256 message digest
455  * @param[in] context Pointer to the SHA-256 context
456  * @param[out] digest Calculated digest
457  **/
458 
459 void sha256Final(Sha256Context *context, uint8_t *digest)
460 {
461  size_t n;
462 
463  //Specify the size of the output buffer
465 
466  //Acquire exclusive access to the CAAM module
468 
469  //Restore hash context
470  osMemcpy(&caamHashContext, context->caamContext, sizeof(caam_hash_ctx_t));
471  //Finalize hash computation
472  CAAM_HASH_Finish(&caamHashContext, caamDigestOut, &n);
473 
474  //Save the resulting digest
475  osMemcpy(digest, caamDigestOut, SHA256_DIGEST_SIZE);
476 
477  //Release exclusive access to the CAAM module
479 }
480 
481 #endif
482 #if (SHA384_SUPPORT == ENABLED)
483 
484 /**
485  * @brief Digest a message using SHA-384
486  * @param[in] data Pointer to the message being hashed
487  * @param[in] length Length of the message
488  * @param[out] digest Pointer to the calculated digest
489  * @return Error code
490  **/
491 
492 error_t sha384Compute(const void *data, size_t length, uint8_t *digest)
493 {
494  size_t n;
495  status_t status;
496  caam_handle_t caamHandle;
497 
498  //Set CAAM job ring
499  caamHandle.jobRing = kCAAM_JobRing0;
500 
501  //Acquire exclusive access to the CAAM module
503 
504  //Initialize hash computation
505  status = CAAM_HASH_Init(CAAM, &caamHandle, &caamHashContext, kCAAM_Sha384,
506  NULL, 0);
507 
508  //Check status code
509  if(status == kStatus_Success)
510  {
511  //Digest message
512  status = CAAM_HASH_Update(&caamHashContext, data, length);
513  }
514 
515  //Check status code
516  if(status == kStatus_Success)
517  {
518  //Specify the size of the output buffer
520  //Finalize hash computation
521  status = CAAM_HASH_Finish(&caamHashContext, caamDigestOut, &n);
522  }
523 
524  //Check status code
525  if(status == kStatus_Success)
526  {
527  //Copy the resulting digest
528  osMemcpy(digest, caamDigestOut, SHA384_DIGEST_SIZE);
529  }
530 
531  //Release exclusive access to the CAAM module
533 
534  //Return status code
535  return (status == kStatus_Success) ? NO_ERROR : ERROR_FAILURE;
536 }
537 
538 
539 /**
540  * @brief Initialize SHA-384 message digest context
541  * @param[in] context Pointer to the SHA-384 context to initialize
542  **/
543 
544 void sha384Init(Sha384Context *context)
545 {
546  caam_handle_t *caamHandle;
547 
548  //Point to the CAAM handle
549  caamHandle = &context->caamHandle;
550  //Set CAAM job ring
551  caamHandle->jobRing = kCAAM_JobRing0;
552 
553  //Acquire exclusive access to the CAAM module
555 
556  //Initialize hash computation
557  CAAM_HASH_Init(CAAM, caamHandle, &caamHashContext, kCAAM_Sha384, NULL, 0);
558  //Save hash context
559  osMemcpy(context->caamContext, &caamHashContext, sizeof(caam_hash_ctx_t));
560 
561  //Release exclusive access to the CAAM module
563 }
564 
565 
566 /**
567  * @brief Update the SHA-384 context with a portion of the message being hashed
568  * @param[in] context Pointer to the SHA-384 context
569  * @param[in] data Pointer to the buffer being hashed
570  * @param[in] length Length of the buffer
571  **/
572 
573 void sha384Update(Sha384Context *context, const void *data, size_t length)
574 {
575  //Acquire exclusive access to the CAAM module
577 
578  //Restore hash context
579  osMemcpy(&caamHashContext, context->caamContext, sizeof(caam_hash_ctx_t));
580  //Digest the message
581  CAAM_HASH_Update(&caamHashContext, data, length);
582  //Save hash context
583  osMemcpy(context->caamContext, &caamHashContext, sizeof(caam_hash_ctx_t));
584 
585  //Release exclusive access to the CAAM module
587 }
588 
589 
590 /**
591  * @brief Finish the SHA-384 message digest
592  * @param[in] context Pointer to the SHA-384 context
593  * @param[out] digest Calculated digest
594  **/
595 
596 void sha384Final(Sha384Context *context, uint8_t *digest)
597 {
598  size_t n;
599 
600  //Specify the size of the output buffer
602 
603  //Acquire exclusive access to the CAAM module
605 
606  //Restore hash context
607  osMemcpy(&caamHashContext, context->caamContext, sizeof(caam_hash_ctx_t));
608  //Finalize hash computation
609  CAAM_HASH_Finish(&caamHashContext, caamDigestOut, &n);
610 
611  //Save the resulting digest
612  osMemcpy(digest, caamDigestOut, SHA384_DIGEST_SIZE);
613 
614  //Release exclusive access to the CAAM module
616 }
617 
618 #endif
619 #if (SHA512_SUPPORT == ENABLED)
620 
621 /**
622  * @brief Digest a message using SHA-512
623  * @param[in] data Pointer to the message being hashed
624  * @param[in] length Length of the message
625  * @param[out] digest Pointer to the calculated digest
626  * @return Error code
627  **/
628 
629 error_t sha512Compute(const void *data, size_t length, uint8_t *digest)
630 {
631  size_t n;
632  status_t status;
633  caam_handle_t caamHandle;
634 
635  //Set CAAM job ring
636  caamHandle.jobRing = kCAAM_JobRing0;
637 
638  //Acquire exclusive access to the CAAM module
640 
641  //Initialize hash computation
642  status = CAAM_HASH_Init(CAAM, &caamHandle, &caamHashContext, kCAAM_Sha512,
643  NULL, 0);
644 
645  //Check status code
646  if(status == kStatus_Success)
647  {
648  //Digest message
649  status = CAAM_HASH_Update(&caamHashContext, data, length);
650  }
651 
652  //Check status code
653  if(status == kStatus_Success)
654  {
655  //Specify the size of the output buffer
657  //Finalize hash computation
658  status = CAAM_HASH_Finish(&caamHashContext, caamDigestOut, &n);
659  }
660 
661  //Check status code
662  if(status == kStatus_Success)
663  {
664  //Copy the resulting digest
665  osMemcpy(digest, caamDigestOut, SHA512_DIGEST_SIZE);
666  }
667 
668  //Release exclusive access to the CAAM module
670 
671  //Return status code
672  return (status == kStatus_Success) ? NO_ERROR : ERROR_FAILURE;
673 }
674 
675 
676 /**
677  * @brief Initialize SHA-512 message digest context
678  * @param[in] context Pointer to the SHA-512 context to initialize
679  **/
680 
681 void sha512Init(Sha512Context *context)
682 {
683  caam_handle_t *caamHandle;
684 
685  //Point to the CAAM handle
686  caamHandle = &context->caamHandle;
687  //Set CAAM job ring
688  caamHandle->jobRing = kCAAM_JobRing0;
689 
690  //Acquire exclusive access to the CAAM module
692 
693  //Initialize hash computation
694  CAAM_HASH_Init(CAAM, caamHandle, &caamHashContext, kCAAM_Sha512, NULL, 0);
695  //Save hash context
696  osMemcpy(context->caamContext, &caamHashContext, sizeof(caam_hash_ctx_t));
697 
698  //Release exclusive access to the CAAM module
700 }
701 
702 
703 /**
704  * @brief Update the SHA-512 context with a portion of the message being hashed
705  * @param[in] context Pointer to the SHA-512 context
706  * @param[in] data Pointer to the buffer being hashed
707  * @param[in] length Length of the buffer
708  **/
709 
710 void sha512Update(Sha512Context *context, const void *data, size_t length)
711 {
712  //Acquire exclusive access to the CAAM module
714 
715  //Restore hash context
716  osMemcpy(&caamHashContext, context->caamContext, sizeof(caam_hash_ctx_t));
717  //Digest the message
718  CAAM_HASH_Update(&caamHashContext, data, length);
719  //Save hash context
720  osMemcpy(context->caamContext, &caamHashContext, sizeof(caam_hash_ctx_t));
721 
722  //Release exclusive access to the CAAM module
724 }
725 
726 
727 /**
728  * @brief Finish the SHA-512 message digest
729  * @param[in] context Pointer to the SHA-512 context
730  * @param[out] digest Calculated digest
731  **/
732 
733 void sha512Final(Sha512Context *context, uint8_t *digest)
734 {
735  size_t n;
736 
737  //Specify the size of the output buffer
739 
740  //Acquire exclusive access to the CAAM module
742 
743  //Restore hash context
744  osMemcpy(&caamHashContext, context->caamContext, sizeof(caam_hash_ctx_t));
745  //Finalize hash computation
746  CAAM_HASH_Finish(&caamHashContext, caamDigestOut, &n);
747 
748  //Save the resulting digest
749  osMemcpy(digest, caamDigestOut, SHA512_DIGEST_SIZE);
750 
751  //Release exclusive access to the CAAM module
753 }
754 
755 #endif
756 #endif
void sha1Init(Sha1Context *context)
Initialize SHA-1 message digest context.
SHA-256 algorithm context.
Definition: sha256.h:62
uint8_t data[]
Definition: ethernet.h:222
OsMutex mimxrt1170CryptoMutex
#define SHA224_DIGEST_SIZE
Definition: sha224.h:41
void sha384Update(Sha384Context *context, const void *data, size_t length)
Update the SHA-384 context with a portion of the message being hashed.
void sha224Final(Sha224Context *context, uint8_t *digest)
Finish the SHA-224 message digest.
error_t sha1Compute(const void *data, size_t length, uint8_t *digest)
Digest a message using SHA-1.
error_t sha224Compute(const void *data, size_t length, uint8_t *digest)
Digest a message using SHA-224.
error_t sha256Compute(const void *data, size_t length, uint8_t *digest)
Digest a message using SHA-256.
#define osMemcpy(dest, src, length)
Definition: os_port.h:144
void sha512Update(Sha512Context *context, const void *data, size_t length)
Update the SHA-512 context with a portion of the message being hashed.
error_t
Error codes.
Definition: error.h:43
void sha512Final(Sha512Context *context, uint8_t *digest)
Finish the SHA-512 message digest.
void sha224Init(Sha224Context *context)
Initialize SHA-224 message digest context.
error_t sha384Compute(const void *data, size_t length, uint8_t *digest)
Digest a message using SHA-384.
@ ERROR_FAILURE
Generic error code.
Definition: error.h:45
void sha256Init(Sha256Context *context)
Initialize SHA-256 message digest context.
SHA-512 algorithm context.
Definition: sha512.h:62
General definitions for cryptographic algorithms.
void sha1Final(Sha1Context *context, uint8_t *digest)
Finish the SHA-1 message digest.
void sha224Update(Sha224Context *context, const void *data, size_t length)
Update the SHA-224 context with a portion of the message being hashed.
i.MX RT1170 hardware cryptographic accelerator (CAAM)
uint8_t length
Definition: tcp.h:375
caam_hash_ctx_t caamHashContext __attribute__((aligned(16)))
#define SHA384_DIGEST_SIZE
Definition: sha384.h:41
Collection of hash algorithms.
error_t sha512Compute(const void *data, size_t length, uint8_t *digest)
Digest a message using SHA-512.
#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.
void sha256Final(Sha256Context *context, uint8_t *digest)
Finish the SHA-256 message digest.
void sha256Update(Sha256Context *context, const void *data, size_t length)
Update the SHA-256 context with a portion of the message being hashed.
void sha512Init(Sha512Context *context)
Initialize SHA-512 message digest context.
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.
#define SHA256_DIGEST_SIZE
Definition: sha256.h:45
#define SHA512_DIGEST_SIZE
Definition: sha512.h:45
i.MX RT1170 hash hardware accelerator
@ NO_ERROR
Success.
Definition: error.h:44
Debugging facilities.
void sha384Final(Sha384Context *context, uint8_t *digest)
Finish the SHA-384 message digest.