ChibiOS  21.6.0
hal_crypto_lld.c
Go to the documentation of this file.
1 /*
2  ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 
17 /**
18  * @file hal_crypto_lld.c
19  * @brief PLATFORM cryptographic subsystem low level driver source.
20  *
21  * @addtogroup CRYPTO
22  * @{
23  */
24 
25 #include "hal.h"
26 
27 #if (HAL_USE_CRY == TRUE) || defined(__DOXYGEN__)
28 
29 /*===========================================================================*/
30 /* Driver local definitions. */
31 /*===========================================================================*/
32 
33 /*===========================================================================*/
34 /* Driver exported variables. */
35 /*===========================================================================*/
36 
37 /** @brief CRY1 driver identifier.*/
38 #if PLATFORM_CRY_USE_CRY1 || defined(__DOXYGEN__)
40 #endif
41 
42 /*===========================================================================*/
43 /* Driver local variables and types. */
44 /*===========================================================================*/
45 
46 /*===========================================================================*/
47 /* Driver local functions. */
48 /*===========================================================================*/
49 
50 /*===========================================================================*/
51 /* Driver interrupt handlers. */
52 /*===========================================================================*/
53 
54 /*===========================================================================*/
55 /* Driver exported functions. */
56 /*===========================================================================*/
57 
58 /**
59  * @brief Low level crypto driver initialization.
60  *
61  * @notapi
62  */
63 void cry_lld_init(void) {
64 
65 }
66 
67 /**
68  * @brief Configures and activates the crypto peripheral.
69  *
70  * @param[in] cryp pointer to the @p CRYDriver object
71  *
72  * @notapi
73  */
74 void cry_lld_start(CRYDriver *cryp) {
75 
76  if (cryp->state == CRY_STOP) {
77 
78  }
79 }
80 
81 /**
82  * @brief Deactivates the crypto peripheral.
83  *
84  * @param[in] cryp pointer to the @p CRYDriver object
85  *
86  * @notapi
87  */
88 void cry_lld_stop(CRYDriver *cryp) {
89 
90  if (cryp->state == CRY_READY) {
91 
92  }
93 }
94 
95 #if (CRY_LLD_SUPPORTS_AES == TRUE) || defined(__DOXYGEN__)
96 /**
97  * @brief Initializes the AES transient key.
98  * @note It is the underlying implementation to decide which key sizes are
99  * allowable.
100  *
101  * @param[in] cryp pointer to the @p CRYDriver object
102  * @param[in] size key size in bytes
103  * @param[in] keyp pointer to the key data
104  * @return The operation status.
105  * @retval CRY_NOERROR if the operation succeeded.
106  * @retval CRY_ERR_INV_ALGO if the algorithm is unsupported.
107  * @retval CRY_ERR_INV_KEY_SIZE if the specified key size is invalid for
108  * the specified algorithm.
109  *
110  * @notapi
111  */
113  size_t size,
114  const uint8_t *keyp) {
115 
116  (void)cryp;
117  (void)size;
118  (void)keyp;
119 
120  return CRY_ERR_INV_ALGO;
121 }
122 
123 /**
124  * @brief Encryption of a single block using AES.
125  * @note The implementation of this function must guarantee that it can
126  * be called from any context.
127  *
128  * @param[in] cryp pointer to the @p CRYDriver object
129  * @param[in] key_id the key to be used for the operation, zero is
130  * the transient key, other values are keys stored
131  * in an unspecified way
132  * @param[in] in buffer containing the input plaintext
133  * @param[out] out buffer for the output ciphertext
134  * @return The operation status.
135  * @retval CRY_NOERROR if the operation succeeded.
136  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
137  * device instance.
138  * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation.
139  * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid
140  * or refers to an empty key slot.
141  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
142  * dependent.
143  *
144  * @notapi
145  */
147  crykey_t key_id,
148  const uint8_t *in,
149  uint8_t *out) {
150 
151  (void)cryp;
152  (void)key_id;
153  (void)in;
154  (void)out;
155 
156  return CRY_ERR_INV_ALGO;
157 }
158 
159 /**
160  * @brief Decryption of a single block using AES.
161  * @note The implementation of this function must guarantee that it can
162  * be called from any context.
163  *
164  * @param[in] cryp pointer to the @p CRYDriver object
165  * @param[in] key_id the key to be used for the operation, zero is
166  * the transient key, other values are keys stored
167  * in an unspecified way
168  * @param[in] in buffer containing the input ciphertext
169  * @param[out] out buffer for the output plaintext
170  * @return The operation status.
171  * @retval CRY_NOERROR if the operation succeeded.
172  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
173  * device instance.
174  * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation.
175  * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid
176  * or refers to an empty key slot.
177  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
178  * dependent.
179  *
180  * @notapi
181  */
183  crykey_t key_id,
184  const uint8_t *in,
185  uint8_t *out) {
186 
187  (void)cryp;
188  (void)key_id;
189  (void)in;
190  (void)out;
191 
192  return CRY_ERR_INV_ALGO;
193 }
194 #endif
195 
196 #if (CRY_LLD_SUPPORTS_AES_ECB == TRUE) || defined(__DOXYGEN__)
197 /**
198  * @brief Encryption operation using AES-ECB.
199  * @note The function operates on data buffers whose length is a multiple
200  * of an AES block, this means that padding must be done by the
201  * caller.
202  *
203  * @param[in] cryp pointer to the @p CRYDriver object
204  * @param[in] key_id the key to be used for the operation, zero is
205  * the transient key, other values are keys stored
206  * in an unspecified way
207  * @param[in] size size of both buffers, this number must be a
208  * multiple of 16
209  * @param[in] in buffer containing the input plaintext
210  * @param[out] out buffer for the output ciphertext
211  * @return The operation status.
212  * @retval CRY_NOERROR if the operation succeeded.
213  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
214  * device instance.
215  * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation.
216  * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid
217  * or refers to an empty key slot.
218  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
219  * dependent.
220  *
221  * @notapi
222  */
224  crykey_t key_id,
225  size_t size,
226  const uint8_t *in,
227  uint8_t *out) {
228 
229  (void)cryp;
230  (void)key_id;
231  (void)size;
232  (void)in;
233  (void)out;
234 
235  return CRY_ERR_INV_ALGO;
236 }
237 
238 /**
239  * @brief Decryption operation using AES-ECB.
240  * @note The function operates on data buffers whose length is a multiple
241  * of an AES block, this means that padding must be done by the
242  * caller.
243  *
244  * @param[in] cryp pointer to the @p CRYDriver object
245  * @param[in] key_id the key to be used for the operation, zero is
246  * the transient key, other values are keys stored
247  * in an unspecified way
248  * @param[in] size size of both buffers, this number must be a
249  * multiple of 16
250  * @param[in] in buffer containing the input plaintext
251  * @param[out] out buffer for the output ciphertext
252  * @return The operation status.
253  * @retval CRY_NOERROR if the operation succeeded.
254  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
255  * device instance.
256  * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation.
257  * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid
258  * or refers to an empty key slot.
259  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
260  * dependent.
261  *
262  * @notapi
263  */
265  crykey_t key_id,
266  size_t size,
267  const uint8_t *in,
268  uint8_t *out) {
269 
270  (void)cryp;
271  (void)key_id;
272  (void)size;
273  (void)in;
274  (void)out;
275 
276  return CRY_ERR_INV_ALGO;
277 }
278 #endif
279 
280 #if (CRY_LLD_SUPPORTS_AES_CBC == TRUE) || defined(__DOXYGEN__)
281 /**
282  * @brief Encryption operation using AES-CBC.
283  * @note The function operates on data buffers whose length is a multiple
284  * of an AES block, this means that padding must be done by the
285  * caller.
286  *
287  * @param[in] cryp pointer to the @p CRYDriver object
288  * @param[in] key_id the key to be used for the operation, zero is
289  * the transient key, other values are keys stored
290  * in an unspecified way
291  * @param[in] size size of both buffers, this number must be a
292  * multiple of 16
293  * @param[in] in buffer containing the input plaintext
294  * @param[out] out buffer for the output ciphertext
295  * @param[in] iv 128 bits initial vector
296  * @return The operation status.
297  * @retval CRY_NOERROR if the operation succeeded.
298  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
299  * device instance.
300  * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation.
301  * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid
302  * or refers to an empty key slot.
303  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
304  * dependent.
305  *
306  * @notapi
307  */
309  crykey_t key_id,
310  size_t size,
311  const uint8_t *in,
312  uint8_t *out,
313  const uint8_t *iv) {
314 
315  (void)cryp;
316  (void)key_id;
317  (void)size;
318  (void)in;
319  (void)out;
320  (void)iv;
321 
322  return CRY_ERR_INV_ALGO;
323 }
324 
325 /**
326  * @brief Decryption operation using AES-CBC.
327  * @note The function operates on data buffers whose length is a multiple
328  * of an AES block, this means that padding must be done by the
329  * caller.
330  *
331  * @param[in] cryp pointer to the @p CRYDriver object
332  * @param[in] key_id the key to be used for the operation, zero is
333  * the transient key, other values are keys stored
334  * in an unspecified way
335  * @param[in] size size of both buffers, this number must be a
336  * multiple of 16
337  * @param[in] in buffer containing the input plaintext
338  * @param[out] out buffer for the output ciphertext
339  * @param[in] iv 128 bits initial vector
340  * @return The operation status.
341  * @retval CRY_NOERROR if the operation succeeded.
342  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
343  * device instance.
344  * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation.
345  * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid
346  * or refers to an empty key slot.
347  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
348  * dependent.
349  *
350  * @notapi
351  */
353  crykey_t key_id,
354  size_t size,
355  const uint8_t *in,
356  uint8_t *out,
357  const uint8_t *iv) {
358 
359  (void)cryp;
360  (void)key_id;
361  (void)size;
362  (void)in;
363  (void)out;
364  (void)iv;
365 
366  return CRY_ERR_INV_ALGO;
367 }
368 #endif
369 
370 #if (CRY_LLD_SUPPORTS_AES_CFB == TRUE) || defined(__DOXYGEN__)
371 /**
372  * @brief Encryption operation using AES-CFB.
373  * @note This is a stream cipher, there are no size restrictions.
374  *
375  * @param[in] cryp pointer to the @p CRYDriver object
376  * @param[in] key_id the key to be used for the operation, zero is
377  * the transient key, other values are keys stored
378  * in an unspecified way
379  * @param[in] size size of both buffers
380  * @param[in] in buffer containing the input plaintext
381  * @param[out] out buffer for the output ciphertext
382  * @param[in] iv 128 bits initial vector
383  * @return The operation status.
384  * @retval CRY_NOERROR if the operation succeeded.
385  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
386  * device instance.
387  * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation.
388  * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid
389  * or refers to an empty key slot.
390  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
391  * dependent.
392  *
393  * @notapi
394  */
396  crykey_t key_id,
397  size_t size,
398  const uint8_t *in,
399  uint8_t *out,
400  const uint8_t *iv) {
401 
402  (void)cryp;
403  (void)key_id;
404  (void)size;
405  (void)in;
406  (void)out;
407  (void)iv;
408 
409  return CRY_ERR_INV_ALGO;
410 }
411 
412 /**
413  * @brief Decryption operation using AES-CFB.
414  * @note This is a stream cipher, there are no size restrictions.
415  *
416  * @param[in] cryp pointer to the @p CRYDriver object
417  * @param[in] key_id the key to be used for the operation, zero is
418  * the transient key, other values are keys stored
419  * in an unspecified way
420  * @param[in] size size of both buffers
421  * @param[in] in buffer containing the input plaintext
422  * @param[out] out buffer for the output ciphertext
423  * @param[in] iv 128 bits initial vector
424  * @return The operation status.
425  * @retval CRY_NOERROR if the operation succeeded.
426  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
427  * device instance.
428  * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation.
429  * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid
430  * or refers to an empty key slot.
431  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
432  * dependent.
433  *
434  * @notapi
435  */
437  crykey_t key_id,
438  size_t size,
439  const uint8_t *in,
440  uint8_t *out,
441  const uint8_t *iv) {
442 
443  (void)cryp;
444  (void)key_id;
445  (void)size;
446  (void)in;
447  (void)out;
448  (void)iv;
449 
450  return CRY_ERR_INV_ALGO;
451 }
452 #endif
453 
454 #if (CRY_LLD_SUPPORTS_AES_CTR == TRUE) || defined(__DOXYGEN__)
455 /**
456  * @brief Encryption operation using AES-CTR.
457  * @note This is a stream cipher, there are no size restrictions.
458  *
459  * @param[in] cryp pointer to the @p CRYDriver object
460  * @param[in] key_id the key to be used for the operation, zero is
461  * the transient key, other values are keys stored
462  * in an unspecified way
463  * @param[in] size size of both buffers
464  * @param[in] in buffer containing the input plaintext
465  * @param[out] out buffer for the output ciphertext
466  * @param[in] iv 128 bits initial vector + counter, it contains
467  * a 96 bits IV and a 32 bits counter
468  * @return The operation status.
469  * @retval CRY_NOERROR if the operation succeeded.
470  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
471  * device instance.
472  * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation.
473  * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid
474  * or refers to an empty key slot.
475  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
476  * dependent.
477  *
478  * @notapi
479  */
481  crykey_t key_id,
482  size_t size,
483  const uint8_t *in,
484  uint8_t *out,
485  const uint8_t *iv) {
486 
487  (void)cryp;
488  (void)key_id;
489  (void)size;
490  (void)in;
491  (void)out;
492  (void)iv;
493 
494  return CRY_ERR_INV_ALGO;
495 }
496 
497 /**
498  * @brief Decryption operation using AES-CTR.
499  * @note This is a stream cipher, there are no size restrictions.
500  *
501  * @param[in] cryp pointer to the @p CRYDriver object
502  * @param[in] key_id the key to be used for the operation, zero is
503  * the transient key, other values are keys stored
504  * in an unspecified way
505  * @param[in] size size of both buffers
506  * @param[in] in buffer containing the input ciphertext
507  * @param[out] out buffer for the output plaintext
508  * @param[in] iv 128 bits initial vector + counter, it contains
509  * a 96 bits IV and a 32 bits counter
510  * @return The operation status.
511  * @retval CRY_NOERROR if the operation succeeded.
512  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
513  * device instance.
514  * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation.
515  * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid
516  * or refers to an empty key slot.
517  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
518  * dependent.
519  *
520  * @notapi
521  */
523  crykey_t key_id,
524  size_t size,
525  const uint8_t *in,
526  uint8_t *out,
527  const uint8_t *iv) {
528 
529  (void)cryp;
530  (void)key_id;
531  (void)size;
532  (void)in;
533  (void)out;
534  (void)iv;
535 
536  return CRY_ERR_INV_ALGO;
537 }
538 #endif
539 
540 #if (CRY_LLD_SUPPORTS_AES_GCM == TRUE) || defined(__DOXYGEN__)
541 /**
542  * @brief Encryption operation using AES-GCM.
543  * @note This is a stream cipher, there are no size restrictions.
544  *
545  * @param[in] cryp pointer to the @p CRYDriver object
546  * @param[in] key_id the key to be used for the operation, zero is
547  * the transient key, other values are keys stored
548  * in an unspecified way
549  * @param[in] auth_size size of the data buffer to be authenticated
550  * @param[in] auth_in buffer containing the data to be authenticated
551  * @param[in] text_size size of the text buffer
552  * @param[in] text_in buffer containing the input plaintext
553  * @param[out] text_out buffer for the output ciphertext
554  * @param[in] iv 128 bits input vector
555  * @param[in] tag_size size of the authentication tag, this number
556  * must be between 1 and 16
557  * @param[out] tag_out buffer for the generated authentication tag
558  * @return The operation status.
559  * @retval CRY_NOERROR if the operation succeeded.
560  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
561  * device instance.
562  * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation.
563  * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid
564  * or refers to an empty key slot.
565  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
566  * dependent.
567  *
568  * @notapi
569  */
571  crykey_t key_id,
572  size_t auth_size,
573  const uint8_t *auth_in,
574  size_t text_size,
575  const uint8_t *text_in,
576  uint8_t *text_out,
577  const uint8_t *iv,
578  size_t tag_size,
579  uint8_t *tag_out) {
580 
581  (void)cryp;
582  (void)key_id;
583  (void)auth_size;
584  (void)auth_in;
585  (void)text_size;
586  (void)text_in;
587  (void)text_out;
588  (void)iv;
589  (void)tag_size;
590  (void)tag_out;
591 
592  return CRY_ERR_INV_ALGO;
593 }
594 
595 /**
596  * @brief Decryption operation using AES-GCM.
597  * @note This is a stream cipher, there are no size restrictions.
598  *
599  * @param[in] cryp pointer to the @p CRYDriver object
600  * @param[in] key_id the key to be used for the operation, zero is
601  * the transient key, other values are keys stored
602  * in an unspecified way
603  * @param[in] auth_size size of the data buffer to be authenticated
604  * @param[in] auth_in buffer containing the data to be authenticated
605  * @param[in] text_size size of the text buffer
606  * @param[in] text_in buffer containing the input plaintext
607  * @param[out] text_out buffer for the output ciphertext
608  * @param[in] iv 128 bits input vector
609  * @param[in] tag_size size of the authentication tag, this number
610  * must be between 1 and 16
611  * @param[in] tag_in buffer for the generated authentication tag
612  * @return The operation status.
613  * @retval CRY_NOERROR if the operation succeeded.
614  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
615  * device instance.
616  * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation.
617  * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid
618  * or refers to an empty key slot.
619  * @retval CRY_ERR_AUTH_FAILED authentication failed
620  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
621  * dependent.
622  *
623  * @notapi
624  */
626  crykey_t key_id,
627  size_t auth_size,
628  const uint8_t *auth_in,
629  size_t text_size,
630  const uint8_t *text_in,
631  uint8_t *text_out,
632  const uint8_t *iv,
633  size_t tag_size,
634  const uint8_t *tag_in) {
635 
636  (void)cryp;
637  (void)key_id;
638  (void)auth_size;
639  (void)auth_in;
640  (void)text_size;
641  (void)text_in;
642  (void)text_out;
643  (void)iv;
644  (void)tag_size;
645  (void)tag_in;
646 
647  return CRY_ERR_INV_ALGO;
648 }
649 #endif
650 
651 #if (CRY_LLD_SUPPORTS_DES == TRUE) || defined(__DOXYGEN__)
652 /**
653  * @brief Initializes the DES transient key.
654  * @note It is the underlying implementation to decide which key sizes are
655  * allowable.
656  *
657  * @param[in] cryp pointer to the @p CRYDriver object
658  * @param[in] size key size in bytes
659  * @param[in] keyp pointer to the key data
660  * @return The operation status.
661  * @retval CRY_NOERROR if the operation succeeded.
662  * @retval CRY_ERR_INV_ALGO if the algorithm is unsupported.
663  * @retval CRY_ERR_INV_KEY_SIZE if the specified key size is invalid for
664  * the specified algorithm.
665  *
666  * @notapi
667  */
669  size_t size,
670  const uint8_t *keyp) {
671 
672  (void)cryp;
673  (void)size;
674  (void)keyp;
675 
676  return CRY_ERR_INV_ALGO;
677 }
678 
679 /**
680  * @brief Encryption of a single block using (T)DES.
681  * @note The implementation of this function must guarantee that it can
682  * be called from any context.
683  *
684  * @param[in] cryp pointer to the @p CRYDriver object
685  * @param[in] key_id the key to be used for the operation, zero is
686  * the transient key, other values are keys stored
687  * in an unspecified way
688  * @param[in] in buffer containing the input plaintext
689  * @param[out] out buffer for the output ciphertext
690  * @return The operation status.
691  * @retval CRY_NOERROR if the operation succeeded.
692  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
693  * device instance.
694  * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation.
695  * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid
696  * or refers to an empty key slot.
697  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
698  * dependent.
699  *
700  * @notapi
701  */
703  crykey_t key_id,
704  const uint8_t *in,
705  uint8_t *out) {
706 
707  (void)cryp;
708  (void)key_id;
709  (void)in;
710  (void)out;
711 
712  return CRY_ERR_INV_ALGO;
713 }
714 
715 /**
716  * @brief Decryption of a single block using (T)DES.
717  * @note The implementation of this function must guarantee that it can
718  * be called from any context.
719  *
720  *
721  * @param[in] cryp pointer to the @p CRYDriver object
722  * @param[in] key_id the key to be used for the operation, zero is
723  * the transient key, other values are keys stored
724  * in an unspecified way
725  * @param[in] in buffer containing the input ciphertext
726  * @param[out] out buffer for the output plaintext
727  * @return The operation status.
728  * @retval CRY_NOERROR if the operation succeeded.
729  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
730  * device instance.
731  * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation.
732  * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid
733  * or refers to an empty key slot.
734  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
735  * dependent.
736  *
737  * @notapi
738  */
740  crykey_t key_id,
741  const uint8_t *in,
742  uint8_t *out) {
743 
744  (void)cryp;
745  (void)key_id;
746  (void)in;
747  (void)out;
748 
749  return CRY_ERR_INV_ALGO;
750 }
751 #endif
752 
753 #if (CRY_LLD_SUPPORTS_DES_ECB == TRUE) || defined(__DOXYGEN__)
754 /**
755  * @brief Encryption operation using (T)DES-ECB.
756  * @note The function operates on data buffers whose length is a multiple
757  * of an DES block, this means that padding must be done by the
758  * caller.
759  *
760  * @param[in] cryp pointer to the @p CRYDriver object
761  * @param[in] key_id the key to be used for the operation, zero is
762  * the transient key, other values are keys stored
763  * in an unspecified way
764  * @param[in] size size of the plaintext buffer, this number must
765  * be a multiple of 8
766  * @param[in] in buffer containing the input plaintext
767  * @param[out] out buffer for the output ciphertext
768  * @return The operation status.
769  * @retval CRY_NOERROR if the operation succeeded.
770  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
771  * device instance.
772  * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation.
773  * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid
774  * or refers to an empty key slot.
775  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
776  * dependent.
777  *
778  * @notapi
779  */
781  crykey_t key_id,
782  size_t size,
783  const uint8_t *in,
784  uint8_t *out) {
785 
786  (void)cryp;
787  (void)key_id;
788  (void)size;
789  (void)in;
790  (void)out;
791 
792  return CRY_ERR_INV_ALGO;
793 }
794 
795 /**
796  * @brief Decryption operation using (T)DES-ECB.
797  * @note The function operates on data buffers whose length is a multiple
798  * of an DES block, this means that padding must be done by the
799  * caller.
800  *
801  * @param[in] cryp pointer to the @p CRYDriver object
802  * @param[in] key_id the key to be used for the operation, zero is
803  * the transient key, other values are keys stored
804  * in an unspecified way
805  * @param[in] size size of the plaintext buffer, this number must
806  * be a multiple of 8
807  * @param[in] in buffer containing the input ciphertext
808  * @param[out] out buffer for the output plaintext
809  * @return T he operation status.
810  * @retval CRY_NOERROR if the operation succeeded.
811  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
812  * device instance.
813  * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation.
814  * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid
815  * or refers to an empty key slot.
816  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
817  * dependent.
818  *
819  * @notapi
820  */
822  crykey_t key_id,
823  size_t size,
824  const uint8_t *in,
825  uint8_t *out) {
826 
827  (void)cryp;
828  (void)key_id;
829  (void)size;
830  (void)in;
831  (void)out;
832 
833  return CRY_ERR_INV_ALGO;
834 }
835 #endif
836 
837 #if (CRY_LLD_SUPPORTS_DES_CBC == TRUE) || defined(__DOXYGEN__)
838 /**
839  * @brief Encryption operation using (T)DES-CBC.
840  * @note The function operates on data buffers whose length is a multiple
841  * of an DES block, this means that padding must be done by the
842  * caller.
843  *
844  * @param[in] cryp pointer to the @p CRYDriver object
845  * @param[in] key_id the key to be used for the operation, zero is
846  * the transient key, other values are keys stored
847  * in an unspecified way
848  * @param[in] size size of the plaintext buffer, this number must
849  * be a multiple of 8
850  * @param[in] in buffer containing the input plaintext
851  * @param[out] out buffer for the output ciphertext
852  * @param[in] iv 64 bits input vector
853  * @return The operation status.
854  * @retval CRY_NOERROR if the operation succeeded.
855  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
856  * device instance.
857  * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation.
858  * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid
859  * or refers to an empty key slot.
860  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
861  * dependent.
862  *
863  * @notapi
864  */
866  crykey_t key_id,
867  size_t size,
868  const uint8_t *in,
869  uint8_t *out,
870  const uint8_t *iv) {
871 
872  (void)cryp;
873  (void)key_id;
874  (void)size;
875  (void)in;
876  (void)out;
877  (void)iv;
878 
879  return CRY_ERR_INV_ALGO;
880 }
881 
882 /**
883  * @brief Decryption operation using (T)DES-CBC.
884  * @note The function operates on data buffers whose length is a multiple
885  * of an DES block, this means that padding must be done by the
886  * caller.
887  *
888  * @param[in] cryp pointer to the @p CRYDriver object
889  * @param[in] key_id the key to be used for the operation, zero is
890  * the transient key, other values are keys stored
891  * in an unspecified way
892  * @param[in] size size of the plaintext buffer, this number must
893  * be a multiple of 8
894  * @param[in] in buffer containing the input ciphertext
895  * @param[out] out buffer for the output plaintext
896  * @param[in] iv 64 bits input vector
897  * @return The operation status.
898  * @retval CRY_NOERROR if the operation succeeded.
899  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
900  * device instance.
901  * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation.
902  * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid
903  * or refers to an empty key slot.
904  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
905  * dependent.
906  *
907  * @notapi
908  */
910  crykey_t key_id,
911  size_t size,
912  const uint8_t *in,
913  uint8_t *out,
914  const uint8_t *iv) {
915 
916  (void)cryp;
917  (void)key_id;
918  (void)size;
919  (void)in;
920  (void)out;
921  (void)iv;
922 
923  return CRY_ERR_INV_ALGO;
924 }
925 #endif
926 
927 #if (CRY_LLD_SUPPORTS_SHA1 == TRUE) || defined(__DOXYGEN__)
928 /**
929  * @brief Hash initialization using SHA1.
930  * @note Use of this algorithm is not recommended because proven weak.
931  *
932  * @param[in] cryp pointer to the @p CRYDriver object
933  * @param[out] sha1ctxp pointer to a SHA1 context to be initialized
934  * @retval CRY_NOERROR if the operation succeeded.
935  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
936  * device instance.
937  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
938  * dependent.
939  *
940  * @notapi
941  */
943 
944  (void)cryp;
945  (void)sha1ctxp;
946 
947  return CRY_ERR_INV_ALGO;
948 }
949 
950 /**
951  * @brief Hash update using SHA1.
952  * @note Use of this algorithm is not recommended because proven weak.
953  *
954  * @param[in] cryp pointer to the @p CRYDriver object
955  * @param[in] sha1ctxp pointer to a SHA1 context
956  * @param[in] size size of input buffer
957  * @param[in] in buffer containing the input text
958  * @return The operation status.
959  * @retval CRY_NOERROR if the operation succeeded.
960  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
961  * device instance.
962  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
963  * dependent.
964  *
965  * @notapi
966  */
968  size_t size, const uint8_t *in) {
969 
970  (void)cryp;
971  (void)sha1ctxp;
972  (void)size;
973  (void)in;
974 
975  return CRY_ERR_INV_ALGO;
976 }
977 
978 /**
979  * @brief Hash finalization using SHA1.
980  * @note Use of this algorithm is not recommended because proven weak.
981  *
982  * @param[in] cryp pointer to the @p CRYDriver object
983  * @param[in] sha1ctxp pointer to a SHA1 context
984  * @param[out] out 160 bits output buffer
985  * @return The operation status.
986  * @retval CRY_NOERROR if the operation succeeded.
987  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
988  * device instance.
989  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
990  * dependent.
991  *
992  * @notapi
993  */
995  uint8_t *out) {
996 
997  (void)cryp;
998  (void)sha1ctxp;
999  (void)out;
1000 
1001  return CRY_ERR_INV_ALGO;
1002 }
1003 #endif
1004 
1005 #if (CRY_LLD_SUPPORTS_SHA256 == TRUE) || defined(__DOXYGEN__)
1006 /**
1007  * @brief Hash initialization using SHA256.
1008  *
1009  * @param[in] cryp pointer to the @p CRYDriver object
1010  * @param[out] sha256ctxp pointer to a SHA256 context to be initialized
1011  * @retval CRY_NOERROR if the operation succeeded.
1012  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
1013  * device instance.
1014  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
1015  * dependent.
1016  *
1017  * @notapi
1018  */
1020 
1021  (void)cryp;
1022  (void)sha256ctxp;
1023 
1024  return CRY_ERR_INV_ALGO;
1025 }
1026 
1027 /**
1028  * @brief Hash update using SHA256.
1029  *
1030  * @param[in] cryp pointer to the @p CRYDriver object
1031  * @param[in] sha256ctxp pointer to a SHA256 context
1032  * @param[in] size size of input buffer
1033  * @param[in] in buffer containing the input text
1034  * @return The operation status.
1035  * @retval CRY_NOERROR if the operation succeeded.
1036  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
1037  * device instance.
1038  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
1039  * dependent.
1040  *
1041  * @notapi
1042  */
1044  size_t size, const uint8_t *in) {
1045 
1046  (void)cryp;
1047  (void)sha256ctxp;
1048  (void)size;
1049  (void)in;
1050 
1051  return CRY_ERR_INV_ALGO;
1052 }
1053 
1054 /**
1055  * @brief Hash finalization using SHA256.
1056  *
1057  * @param[in] cryp pointer to the @p CRYDriver object
1058  * @param[in] sha256ctxp pointer to a SHA256 context
1059  * @param[out] out 256 bits output buffer
1060  * @return The operation status.
1061  * @retval CRY_NOERROR if the operation succeeded.
1062  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
1063  * device instance.
1064  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
1065  * dependent.
1066  *
1067  * @notapi
1068  */
1070  uint8_t *out) {
1071 
1072  (void)cryp;
1073  (void)sha256ctxp;
1074  (void)out;
1075 
1076  return CRY_ERR_INV_ALGO;
1077 }
1078 #endif
1079 
1080 #if (CRY_LLD_SUPPORTS_SHA512 == TRUE) || defined(__DOXYGEN__)
1081 /**
1082  * @brief Hash initialization using SHA512.
1083  *
1084  * @param[in] cryp pointer to the @p CRYDriver object
1085  * @param[out] sha512ctxp pointer to a SHA512 context to be initialized
1086  * @retval CRY_NOERROR if the operation succeeded.
1087  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
1088  * device instance.
1089  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
1090  * dependent.
1091  *
1092  * @notapi
1093  */
1095 
1096  (void)cryp;
1097  (void)sha512ctxp;
1098 
1099  return CRY_ERR_INV_ALGO;
1100 }
1101 
1102 /**
1103  * @brief Hash update using SHA512.
1104  *
1105  * @param[in] cryp pointer to the @p CRYDriver object
1106  * @param[in] sha512ctxp pointer to a SHA512 context
1107  * @param[in] size size of input buffer
1108  * @param[in] in buffer containing the input text
1109  * @return The operation status.
1110  * @retval CRY_NOERROR if the operation succeeded.
1111  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
1112  * device instance.
1113  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
1114  * dependent.
1115  *
1116  * @notapi
1117  */
1119  size_t size, const uint8_t *in) {
1120 
1121  (void)cryp;
1122  (void)sha512ctxp;
1123  (void)size;
1124  (void)in;
1125 
1126  return CRY_ERR_INV_ALGO;
1127 }
1128 
1129 /**
1130  * @brief Hash finalization using SHA512.
1131  *
1132  * @param[in] cryp pointer to the @p CRYDriver object
1133  * @param[in] sha512ctxp pointer to a SHA512 context
1134  * @param[out] out 512 bits output buffer
1135  * @return The operation status.
1136  * @retval CRY_NOERROR if the operation succeeded.
1137  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
1138  * device instance.
1139  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
1140  * dependent.
1141  *
1142  * @notapi
1143  */
1145  uint8_t *out) {
1146 
1147  (void)cryp;
1148  (void)sha512ctxp;
1149  (void)out;
1150 
1151  return CRY_ERR_INV_ALGO;
1152 }
1153 #endif
1154 
1155 #if (CRY_LLD_SUPPORTS_HMAC_SHA256 == TRUE) || defined(__DOXYGEN__)
1156 /**
1157  * @brief Initializes the HMAC transient key.
1158  * @note It is the underlying implementation to decide which key sizes are
1159  * allowable.
1160  *
1161  * @param[in] cryp pointer to the @p CRYDriver object
1162  * @param[in] size key size in bytes
1163  * @param[in] keyp pointer to the key data
1164  * @return The operation status.
1165  * @retval CRY_NOERROR if the operation succeeded.
1166  * @retval CRY_ERR_INV_ALGO if the algorithm is unsupported.
1167  * @retval CRY_ERR_INV_KEY_SIZE if the specified key size is invalid for
1168  * the specified algorithm.
1169  *
1170  * @notapi
1171  */
1173  size_t size,
1174  const uint8_t *keyp) {
1175 
1176  (void)cryp;
1177  (void)size;
1178  (void)keyp;
1179 
1180  return CRY_ERR_INV_ALGO;
1181 }
1182 
1183 /**
1184  * @brief Hash initialization using HMAC_SHA256.
1185  *
1186  * @param[in] cryp pointer to the @p CRYDriver object
1187  * @param[out] hmacsha256ctxp pointer to a HMAC_SHA256 context to be
1188  * initialized
1189  * @return The operation status.
1190  * @retval CRY_NOERROR if the operation succeeded.
1191  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
1192  * device instance.
1193  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
1194  * dependent.
1195  *
1196  * @notapi
1197  */
1199  HMACSHA256Context *hmacsha256ctxp) {
1200 
1201  (void)cryp;
1202  (void)hmacsha256ctxp;
1203 
1204  return CRY_ERR_INV_ALGO;
1205 }
1206 
1207 /**
1208  * @brief Hash update using HMAC.
1209  *
1210  * @param[in] cryp pointer to the @p CRYDriver object
1211  * @param[in] hmacsha256ctxp pointer to a HMAC_SHA256 context
1212  * @param[in] size size of input buffer
1213  * @param[in] in buffer containing the input text
1214  * @return The operation status.
1215  * @retval CRY_NOERROR if the operation succeeded.
1216  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
1217  * device instance.
1218  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
1219  * dependent.
1220  *
1221  * @notapi
1222  */
1224  HMACSHA256Context *hmacsha256ctxp,
1225  size_t size,
1226  const uint8_t *in) {
1227 
1228  (void)cryp;
1229  (void)hmacsha256ctxp;
1230  (void)size;
1231  (void)in;
1232 
1233  return CRY_ERR_INV_ALGO;
1234 }
1235 
1236 /**
1237  * @brief Hash finalization using HMAC.
1238  *
1239  * @param[in] cryp pointer to the @p CRYDriver object
1240  * @param[in] hmacsha256ctxp pointer to a HMAC_SHA256 context
1241  * @param[out] out 256 bits output buffer
1242  * @return The operation status.
1243  * @retval CRY_NOERROR if the operation succeeded.
1244  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
1245  * device instance.
1246  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
1247  * dependent.
1248  *
1249  * @notapi
1250  */
1252  HMACSHA256Context *hmacsha256ctxp,
1253  uint8_t *out) {
1254 
1255  (void)cryp;
1256  (void)hmacsha256ctxp;
1257  (void)out;
1258 
1259  return CRY_ERR_INV_ALGO;
1260 }
1261 #endif
1262 
1263 #if (CRY_LLD_SUPPORTS_HMAC_SHA512 == TRUE) || defined(__DOXYGEN__)
1264 /**
1265  * @brief Hash initialization using HMAC_SHA512.
1266  *
1267  * @param[in] cryp pointer to the @p CRYDriver object
1268  * @param[out] hmacsha512ctxp pointer to a HMAC_SHA512 context to be
1269  * initialized
1270  * @return The operation status.
1271  * @retval CRY_NOERROR if the operation succeeded.
1272  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
1273  * device instance.
1274  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
1275  * dependent.
1276  *
1277  * @notapi
1278  */
1280  HMACSHA512Context *hmacsha512ctxp) {
1281 
1282  (void)cryp;
1283  (void)hmacsha512ctxp;
1284 
1285  return CRY_ERR_INV_ALGO;
1286 }
1287 
1288 /**
1289  * @brief Hash update using HMAC.
1290  *
1291  * @param[in] cryp pointer to the @p CRYDriver object
1292  * @param[in] hmacsha512ctxp pointer to a HMAC_SHA512 context
1293  * @param[in] size size of input buffer
1294  * @param[in] in buffer containing the input text
1295  * @return The operation status.
1296  * @retval CRY_NOERROR if the operation succeeded.
1297  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
1298  * device instance.
1299  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
1300  * dependent.
1301  *
1302  * @notapi
1303  */
1305  HMACSHA512Context *hmacsha512ctxp,
1306  size_t size,
1307  const uint8_t *in) {
1308 
1309  (void)cryp;
1310  (void)hmacsha512ctxp;
1311  (void)size;
1312  (void)in;
1313 
1314  return CRY_ERR_INV_ALGO;
1315 }
1316 
1317 /**
1318  * @brief Hash finalization using HMAC.
1319  *
1320  * @param[in] cryp pointer to the @p CRYDriver object
1321  * @param[in] hmacsha512ctxp pointer to a HMAC_SHA512 context
1322  * @param[out] out 512 bits output buffer
1323  * @return The operation status.
1324  * @retval CRY_NOERROR if the operation succeeded.
1325  * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
1326  * device instance.
1327  * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation
1328  * dependent.
1329  *
1330  * @notapi
1331  */
1333  HMACSHA512Context *hmacsha512ctxp,
1334  uint8_t *out) {
1335 
1336  (void)cryp;
1337  (void)hmacsha512ctxp;
1338  (void)out;
1339 
1340  return CRY_ERR_INV_ALGO;
1341 }
1342 #endif
1343 
1344 #endif /* HAL_USE_CRY == TRUE */
1345 
1346 /** @} */
cry_lld_SHA1_init
cryerror_t cry_lld_SHA1_init(CRYDriver *cryp, SHA1Context *sha1ctxp)
Hash initialization using SHA1.
Definition: hal_crypto_lld.c:942
HMACSHA256Context
Type of a HMAC_SHA256 context.
Definition: hal_crypto.h:195
out
USBOutEndpointState out
OUT EP0 state.
Definition: hal_usb_lld.c:61
CRYD1
CRYDriver CRYD1
CRY1 driver identifier.
Definition: hal_crypto_lld.c:39
CRYDriver
Structure representing an CRY driver.
Definition: hal_crypto_lld.h:101
cry_lld_decrypt_DES_CBC
cryerror_t cry_lld_decrypt_DES_CBC(CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
Decryption operation using (T)DES-CBC.
Definition: hal_crypto_lld.c:909
cryerror_t
cryerror_t
Driver error codes.
Definition: hal_crypto.h:89
cry_lld_HMACSHA512_final
cryerror_t cry_lld_HMACSHA512_final(CRYDriver *cryp, HMACSHA512Context *hmacsha512ctxp, uint8_t *out)
Hash finalization using HMAC.
Definition: hal_crypto_lld.c:1332
hal.h
HAL subsystem header.
cry_lld_decrypt_DES_ECB
cryerror_t cry_lld_decrypt_DES_ECB(CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out)
Decryption operation using (T)DES-ECB.
Definition: hal_crypto_lld.c:821
cry_lld_HMACSHA256_update
cryerror_t cry_lld_HMACSHA256_update(CRYDriver *cryp, HMACSHA256Context *hmacsha256ctxp, size_t size, const uint8_t *in)
Hash update using HMAC.
Definition: hal_crypto_lld.c:1223
CRYDriver::state
crystate_t state
Driver state.
Definition: hal_crypto_lld.h:105
cry_lld_HMACSHA256_final
cryerror_t cry_lld_HMACSHA256_final(CRYDriver *cryp, HMACSHA256Context *hmacsha256ctxp, uint8_t *out)
Hash finalization using HMAC.
Definition: hal_crypto_lld.c:1251
cry_lld_hmac_loadkey
cryerror_t cry_lld_hmac_loadkey(CRYDriver *cryp, size_t size, const uint8_t *keyp)
Initializes the HMAC transient key.
Definition: hal_crypto_lld.c:1172
cry_lld_init
void cry_lld_init(void)
Low level crypto driver initialization.
Definition: hal_crypto_lld.c:63
cry_lld_HMACSHA512_update
cryerror_t cry_lld_HMACSHA512_update(CRYDriver *cryp, HMACSHA512Context *hmacsha512ctxp, size_t size, const uint8_t *in)
Hash update using HMAC.
Definition: hal_crypto_lld.c:1304
cry_lld_encrypt_DES_ECB
cryerror_t cry_lld_encrypt_DES_ECB(CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out)
Encryption operation using (T)DES-ECB.
Definition: hal_crypto_lld.c:780
cry_lld_stop
void cry_lld_stop(CRYDriver *cryp)
Deactivates the crypto peripheral.
Definition: hal_crypto_lld.c:88
SHA256Context
Type of a SHA256 context.
Definition: hal_crypto.h:179
cry_lld_SHA1_final
cryerror_t cry_lld_SHA1_final(CRYDriver *cryp, SHA1Context *sha1ctxp, uint8_t *out)
Hash finalization using SHA1.
Definition: hal_crypto_lld.c:994
cry_lld_encrypt_AES_CBC
cryerror_t cry_lld_encrypt_AES_CBC(CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
Encryption operation using AES-CBC.
Definition: hal_crypto_lld.c:308
cry_lld_decrypt_AES_CTR
cryerror_t cry_lld_decrypt_AES_CTR(CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
Decryption operation using AES-CTR.
Definition: hal_crypto_lld.c:522
cry_lld_encrypt_AES_ECB
cryerror_t cry_lld_encrypt_AES_ECB(CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out)
Encryption operation using AES-ECB.
Definition: hal_crypto_lld.c:223
cry_lld_decrypt_AES_CFB
cryerror_t cry_lld_decrypt_AES_CFB(CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
Decryption operation using AES-CFB.
Definition: hal_crypto_lld.c:436
cry_lld_decrypt_AES_CBC
cryerror_t cry_lld_decrypt_AES_CBC(CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
Decryption operation using AES-CBC.
Definition: hal_crypto_lld.c:352
cry_lld_SHA512_update
cryerror_t cry_lld_SHA512_update(CRYDriver *cryp, SHA512Context *sha512ctxp, size_t size, const uint8_t *in)
Hash update using SHA512.
Definition: hal_crypto_lld.c:1118
cry_lld_encrypt_AES_CTR
cryerror_t cry_lld_encrypt_AES_CTR(CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
Encryption operation using AES-CTR.
Definition: hal_crypto_lld.c:480
cry_lld_HMACSHA256_init
cryerror_t cry_lld_HMACSHA256_init(CRYDriver *cryp, HMACSHA256Context *hmacsha256ctxp)
Hash initialization using HMAC_SHA256.
Definition: hal_crypto_lld.c:1198
SHA512Context
Type of a SHA512 context.
Definition: hal_crypto.h:187
cry_lld_SHA512_final
cryerror_t cry_lld_SHA512_final(CRYDriver *cryp, SHA512Context *sha512ctxp, uint8_t *out)
Hash finalization using SHA512.
Definition: hal_crypto_lld.c:1144
crykey_t
uint32_t crykey_t
CRY key identifier type.
Definition: hal_crypto_lld.h:83
cry_lld_SHA1_update
cryerror_t cry_lld_SHA1_update(CRYDriver *cryp, SHA1Context *sha1ctxp, size_t size, const uint8_t *in)
Hash update using SHA1.
Definition: hal_crypto_lld.c:967
CRY_STOP
@ CRY_STOP
Definition: hal_crypto.h:82
cry_lld_SHA256_init
cryerror_t cry_lld_SHA256_init(CRYDriver *cryp, SHA256Context *sha256ctxp)
Hash initialization using SHA256.
Definition: hal_crypto_lld.c:1019
cry_lld_aes_loadkey
cryerror_t cry_lld_aes_loadkey(CRYDriver *cryp, size_t size, const uint8_t *keyp)
Initializes the AES transient key.
Definition: hal_crypto_lld.c:112
CRY_READY
@ CRY_READY
Definition: hal_crypto.h:83
cry_lld_decrypt_AES
cryerror_t cry_lld_decrypt_AES(CRYDriver *cryp, crykey_t key_id, const uint8_t *in, uint8_t *out)
Decryption of a single block using AES.
Definition: hal_crypto_lld.c:182
cry_lld_SHA512_init
cryerror_t cry_lld_SHA512_init(CRYDriver *cryp, SHA512Context *sha512ctxp)
Hash initialization using SHA512.
Definition: hal_crypto_lld.c:1094
cry_lld_encrypt_DES_CBC
cryerror_t cry_lld_encrypt_DES_CBC(CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
Encryption operation using (T)DES-CBC.
Definition: hal_crypto_lld.c:865
cry_lld_encrypt_AES_CFB
cryerror_t cry_lld_encrypt_AES_CFB(CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out, const uint8_t *iv)
Encryption operation using AES-CFB.
Definition: hal_crypto_lld.c:395
cry_lld_start
void cry_lld_start(CRYDriver *cryp)
Configures and activates the crypto peripheral.
Definition: hal_crypto_lld.c:74
cry_lld_encrypt_DES
cryerror_t cry_lld_encrypt_DES(CRYDriver *cryp, crykey_t key_id, const uint8_t *in, uint8_t *out)
Encryption of a single block using (T)DES.
Definition: hal_crypto_lld.c:702
cry_lld_encrypt_AES
cryerror_t cry_lld_encrypt_AES(CRYDriver *cryp, crykey_t key_id, const uint8_t *in, uint8_t *out)
Encryption of a single block using AES.
Definition: hal_crypto_lld.c:146
cry_lld_decrypt_DES
cryerror_t cry_lld_decrypt_DES(CRYDriver *cryp, crykey_t key_id, const uint8_t *in, uint8_t *out)
Decryption of a single block using (T)DES.
Definition: hal_crypto_lld.c:739
in
USBInEndpointState in
IN EP0 state.
Definition: hal_usb_lld.c:57
cry_lld_HMACSHA512_init
cryerror_t cry_lld_HMACSHA512_init(CRYDriver *cryp, HMACSHA512Context *hmacsha512ctxp)
Hash initialization using HMAC_SHA512.
Definition: hal_crypto_lld.c:1279
cry_lld_decrypt_AES_ECB
cryerror_t cry_lld_decrypt_AES_ECB(CRYDriver *cryp, crykey_t key_id, size_t size, const uint8_t *in, uint8_t *out)
Decryption operation using AES-ECB.
Definition: hal_crypto_lld.c:264
cry_lld_decrypt_AES_GCM
cryerror_t cry_lld_decrypt_AES_GCM(CRYDriver *cryp, crykey_t key_id, size_t auth_size, const uint8_t *auth_in, size_t text_size, const uint8_t *text_in, uint8_t *text_out, const uint8_t *iv, size_t tag_size, const uint8_t *tag_in)
Decryption operation using AES-GCM.
Definition: hal_crypto_lld.c:625
cry_lld_encrypt_AES_GCM
cryerror_t cry_lld_encrypt_AES_GCM(CRYDriver *cryp, crykey_t key_id, size_t auth_size, const uint8_t *auth_in, size_t text_size, const uint8_t *text_in, uint8_t *text_out, const uint8_t *iv, size_t tag_size, uint8_t *tag_out)
Encryption operation using AES-GCM.
Definition: hal_crypto_lld.c:570
cry_lld_SHA256_update
cryerror_t cry_lld_SHA256_update(CRYDriver *cryp, SHA256Context *sha256ctxp, size_t size, const uint8_t *in)
Hash update using SHA256.
Definition: hal_crypto_lld.c:1043
CRY_ERR_INV_ALGO
@ CRY_ERR_INV_ALGO
Definition: hal_crypto.h:91
SHA1Context
Type of a SHA1 context.
Definition: hal_crypto.h:171
cry_lld_des_loadkey
cryerror_t cry_lld_des_loadkey(CRYDriver *cryp, size_t size, const uint8_t *keyp)
Initializes the DES transient key.
Definition: hal_crypto_lld.c:668
HMACSHA512Context
Type of a HMAC_SHA512 context.
Definition: hal_crypto.h:203
cry_lld_SHA256_final
cryerror_t cry_lld_SHA256_final(CRYDriver *cryp, SHA256Context *sha256ctxp, uint8_t *out)
Hash finalization using SHA256.
Definition: hal_crypto_lld.c:1069