32 #define TRACE_LEVEL CRYPTO_TRACE_LEVEL
43 #if (SAMA5D3_CRYPTO_HASH_SUPPORT == ENABLED)
57 p = (uint32_t *)
data;
58 SHA->SHA_IDATAR[0] =
p[0];
59 SHA->SHA_IDATAR[1] =
p[1];
60 SHA->SHA_IDATAR[2] =
p[2];
61 SHA->SHA_IDATAR[3] =
p[3];
62 SHA->SHA_IDATAR[4] =
p[4];
63 SHA->SHA_IDATAR[5] =
p[5];
64 SHA->SHA_IDATAR[6] =
p[6];
65 SHA->SHA_IDATAR[7] =
p[7];
66 SHA->SHA_IDATAR[8] =
p[8];
67 SHA->SHA_IDATAR[9] =
p[9];
68 SHA->SHA_IDATAR[10] =
p[10];
69 SHA->SHA_IDATAR[11] =
p[11];
70 SHA->SHA_IDATAR[12] =
p[12];
71 SHA->SHA_IDATAR[13] =
p[13];
72 SHA->SHA_IDATAR[14] =
p[14];
73 SHA->SHA_IDATAR[15] =
p[15];
78 SHA->SHA_IODATAR[0] =
p[16];
79 SHA->SHA_IODATAR[1] =
p[17];
80 SHA->SHA_IODATAR[2] =
p[18];
81 SHA->SHA_IODATAR[3] =
p[19];
82 SHA->SHA_IODATAR[4] =
p[20];
83 SHA->SHA_IODATAR[5] =
p[21];
84 SHA->SHA_IODATAR[6] =
p[22];
85 SHA->SHA_IODATAR[7] =
p[23];
86 SHA->SHA_IODATAR[8] =
p[24];
87 SHA->SHA_IODATAR[9] =
p[25];
88 SHA->SHA_IODATAR[10] =
p[26];
89 SHA->SHA_IODATAR[11] =
p[27];
90 SHA->SHA_IODATAR[12] =
p[28];
91 SHA->SHA_IODATAR[13] =
p[29];
92 SHA->SHA_IODATAR[14] =
p[30];
93 SHA->SHA_IODATAR[15] =
p[31];
97 SHA->SHA_CR = SHA_CR_START;
100 while((SHA->SHA_ISR & SHA_ISR_DATRDY) == 0)
106 #if (SHA1_SUPPORT == ENABLED)
126 SHA->SHA_CR = SHA_CR_SWRST;
128 SHA->SHA_MR = SHA_MR_ALGO_SHA1 | SHA_MR_SMOD_MANUAL_START;
130 SHA->SHA_CR = SHA_CR_FIRST;
162 p = (uint32_t *) digest;
163 p[0] = SHA->SHA_IODATAR[0];
164 p[1] = SHA->SHA_IODATAR[1];
165 p[2] = SHA->SHA_IODATAR[2];
166 p[3] = SHA->SHA_IODATAR[3];
167 p[4] = SHA->SHA_IODATAR[4];
177 #if (SHA224_SUPPORT == ENABLED)
197 SHA->SHA_CR = SHA_CR_SWRST;
199 SHA->SHA_MR = SHA_MR_ALGO_SHA224 | SHA_MR_SMOD_MANUAL_START;
201 SHA->SHA_CR = SHA_CR_FIRST;
233 p = (uint32_t *) digest;
234 p[0] = SHA->SHA_IODATAR[0];
235 p[1] = SHA->SHA_IODATAR[1];
236 p[2] = SHA->SHA_IODATAR[2];
237 p[3] = SHA->SHA_IODATAR[3];
238 p[4] = SHA->SHA_IODATAR[4];
239 p[5] = SHA->SHA_IODATAR[5];
240 p[6] = SHA->SHA_IODATAR[6];
250 #if (SHA256_SUPPORT == ENABLED)
270 SHA->SHA_CR = SHA_CR_SWRST;
272 SHA->SHA_MR = SHA_MR_ALGO_SHA256 | SHA_MR_SMOD_MANUAL_START;
274 SHA->SHA_CR = SHA_CR_FIRST;
306 p = (uint32_t *) digest;
307 p[0] = SHA->SHA_IODATAR[0];
308 p[1] = SHA->SHA_IODATAR[1];
309 p[2] = SHA->SHA_IODATAR[2];
310 p[3] = SHA->SHA_IODATAR[3];
311 p[4] = SHA->SHA_IODATAR[4];
312 p[5] = SHA->SHA_IODATAR[5];
313 p[6] = SHA->SHA_IODATAR[6];
314 p[7] = SHA->SHA_IODATAR[7];
324 #if (SHA384_SUPPORT == ENABLED)
344 SHA->SHA_CR = SHA_CR_SWRST;
346 SHA->SHA_MR = SHA_MR_ALGO_SHA384 | SHA_MR_SMOD_MANUAL_START;
348 SHA->SHA_CR = SHA_CR_FIRST;
380 p = (uint32_t *) digest;
381 p[0] = SHA->SHA_IODATAR[0];
382 p[1] = SHA->SHA_IODATAR[1];
383 p[2] = SHA->SHA_IODATAR[2];
384 p[3] = SHA->SHA_IODATAR[3];
385 p[4] = SHA->SHA_IODATAR[4];
386 p[5] = SHA->SHA_IODATAR[5];
387 p[6] = SHA->SHA_IODATAR[6];
388 p[7] = SHA->SHA_IODATAR[7];
389 p[8] = SHA->SHA_IODATAR[8];
390 p[9] = SHA->SHA_IODATAR[9];
391 p[10] = SHA->SHA_IODATAR[10];
392 p[11] = SHA->SHA_IODATAR[11];
402 #if (SHA512_SUPPORT == ENABLED)
422 SHA->SHA_CR = SHA_CR_SWRST;
424 SHA->SHA_MR = SHA_MR_ALGO_SHA512 | SHA_MR_SMOD_MANUAL_START;
426 SHA->SHA_CR = SHA_CR_FIRST;
458 p = (uint32_t *) digest;
459 p[0] = SHA->SHA_IODATAR[0];
460 p[1] = SHA->SHA_IODATAR[1];
461 p[2] = SHA->SHA_IODATAR[2];
462 p[3] = SHA->SHA_IODATAR[3];
463 p[4] = SHA->SHA_IODATAR[4];
464 p[5] = SHA->SHA_IODATAR[5];
465 p[6] = SHA->SHA_IODATAR[6];
466 p[7] = SHA->SHA_IODATAR[7];
467 p[8] = SHA->SHA_IODATAR[8];
468 p[9] = SHA->SHA_IODATAR[9];
469 p[10] = SHA->SHA_IODATAR[10];
470 p[11] = SHA->SHA_IODATAR[11];
471 p[12] = SHA->SHA_IODATAR[12];
472 p[13] = SHA->SHA_IODATAR[13];
473 p[14] = SHA->SHA_IODATAR[14];
474 p[15] = SHA->SHA_IODATAR[15];