From ad0f9349ae74976f054fc0aba35c0ec82c2837c8 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Wed, 13 Jun 2018 08:17:40 +0000 Subject: Added more conditionals to CRY driver. Removed conditionals from high level functions, those functions are not meant to be excluded. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12092 110e8d01-0319-4d1e-a829-52ad28d1bb01 --- os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.c | 98 +++++++++++++++++++++++++- os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.h | 32 +++++++-- 2 files changed, 122 insertions(+), 8 deletions(-) (limited to 'os/hal/ports') diff --git a/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.c b/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.c index 6978ecd6f..b32596814 100644 --- a/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.c +++ b/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.c @@ -120,6 +120,7 @@ cryerror_t cry_lld_loadkey(CRYDriver *cryp, return CRY_NOERROR; } +#if (CRY_LLD_SUPPORTS_AES == TRUE) || defined(__DOXYGEN__) /** * @brief Encryption of a single block using AES. * @note The implementation of this function must guarantee that it can @@ -138,6 +139,8 @@ cryerror_t cry_lld_loadkey(CRYDriver *cryp, * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation. * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid * or refers to an empty key slot. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -172,6 +175,8 @@ cryerror_t cry_lld_encrypt_AES(CRYDriver *cryp, * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation. * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid * or refers to an empty key slot. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -187,7 +192,9 @@ cryerror_t cry_lld_decrypt_AES(CRYDriver *cryp, return CRY_ERR_INV_ALGO; } +#endif +#if (CRY_LLD_SUPPORTS_AES_ECB == TRUE) || defined(__DOXYGEN__) /** * @brief Encryption operation using AES-ECB. * @note The function operates on data buffers whose lenght is a multiple @@ -209,6 +216,8 @@ cryerror_t cry_lld_decrypt_AES(CRYDriver *cryp, * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation. * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid * or refers to an empty key slot. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -248,6 +257,8 @@ cryerror_t cry_lld_encrypt_AES_ECB(CRYDriver *cryp, * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation. * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid * or refers to an empty key slot. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -265,7 +276,9 @@ cryerror_t cry_lld_decrypt_AES_ECB(CRYDriver *cryp, return CRY_ERR_INV_ALGO; } +#endif +#if (CRY_LLD_SUPPORTS_AES_CBC == TRUE) || defined(__DOXYGEN__) /** * @brief Encryption operation using AES-CBC. * @note The function operates on data buffers whose lenght is a multiple @@ -288,6 +301,8 @@ cryerror_t cry_lld_decrypt_AES_ECB(CRYDriver *cryp, * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation. * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid * or refers to an empty key slot. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -330,6 +345,8 @@ cryerror_t cry_lld_encrypt_AES_CBC(CRYDriver *cryp, * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation. * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid * or refers to an empty key slot. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -349,7 +366,9 @@ cryerror_t cry_lld_decrypt_AES_CBC(CRYDriver *cryp, return CRY_ERR_INV_ALGO; } +#endif +#if (CRY_LLD_SUPPORTS_AES_CFB == TRUE) || defined(__DOXYGEN__) /** * @brief Encryption operation using AES-CFB. * @note The function operates on data buffers whose lenght is a multiple @@ -372,6 +391,8 @@ cryerror_t cry_lld_decrypt_AES_CBC(CRYDriver *cryp, * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation. * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid * or refers to an empty key slot. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -414,6 +435,8 @@ cryerror_t cry_lld_encrypt_AES_CFB(CRYDriver *cryp, * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation. * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid * or refers to an empty key slot. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -433,7 +456,9 @@ cryerror_t cry_lld_decrypt_AES_CFB(CRYDriver *cryp, return CRY_ERR_INV_ALGO; } +#endif +#if (CRY_LLD_SUPPORTS_AES_CTR == TRUE) || defined(__DOXYGEN__) /** * @brief Encryption operation using AES-CTR. * @note The function operates on data buffers whose lenght is a multiple @@ -457,6 +482,8 @@ cryerror_t cry_lld_decrypt_AES_CFB(CRYDriver *cryp, * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation. * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid * or refers to an empty key slot. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -500,6 +527,8 @@ cryerror_t cry_lld_encrypt_AES_CTR(CRYDriver *cryp, * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation. * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid * or refers to an empty key slot. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -519,7 +548,9 @@ cryerror_t cry_lld_decrypt_AES_CTR(CRYDriver *cryp, return CRY_ERR_INV_ALGO; } +#endif +#if (CRY_LLD_SUPPORTS_AES_GCM == TRUE) || defined(__DOXYGEN__) /** * @brief Encryption operation using AES-GCM. * @note The function operates on data buffers whose lenght is a multiple @@ -548,6 +579,8 @@ cryerror_t cry_lld_decrypt_AES_CTR(CRYDriver *cryp, * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation. * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid * or refers to an empty key slot. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -602,6 +635,8 @@ cryerror_t cry_lld_encrypt_AES_GCM(CRYDriver *cryp, * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation. * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid * or refers to an empty key slot. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -627,7 +662,9 @@ cryerror_t cry_lld_decrypt_AES_GCM(CRYDriver *cryp, return CRY_ERR_INV_ALGO; } +#endif +#if (CRY_LLD_SUPPORTS_DES == TRUE) || defined(__DOXYGEN__) /** * @brief Encryption of a single block using (T)DES. * @note The implementation of this function must guarantee that it can @@ -646,6 +683,8 @@ cryerror_t cry_lld_decrypt_AES_GCM(CRYDriver *cryp, * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation. * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid * or refers to an empty key slot. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -681,6 +720,8 @@ cryerror_t cry_lld_encrypt_DES(CRYDriver *cryp, * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation. * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid * or refers to an empty key slot. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -696,7 +737,9 @@ cryerror_t cry_lld_decrypt_DES(CRYDriver *cryp, return CRY_ERR_INV_ALGO; } +#endif +#if (CRY_LLD_SUPPORTS_DES_ECB == TRUE) || defined(__DOXYGEN__) /** * @brief Encryption operation using (T)DES-ECB. * @note The function operates on data buffers whose length is a multiple @@ -718,6 +761,8 @@ cryerror_t cry_lld_decrypt_DES(CRYDriver *cryp, * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation. * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid * or refers to an empty key slot. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -757,6 +802,8 @@ cryerror_t cry_lld_encrypt_DES_ECB(CRYDriver *cryp, * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation. * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid * or refers to an empty key slot. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -774,7 +821,9 @@ cryerror_t cry_lld_decrypt_DES_ECB(CRYDriver *cryp, return CRY_ERR_INV_ALGO; } +#endif +#if (CRY_LLD_SUPPORTS_DES_CBC == TRUE) || defined(__DOXYGEN__) /** * @brief Encryption operation using (T)DES-CBC. * @note The function operates on data buffers whose length is a multiple @@ -797,6 +846,8 @@ cryerror_t cry_lld_decrypt_DES_ECB(CRYDriver *cryp, * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation. * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid * or refers to an empty key slot. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -839,6 +890,8 @@ cryerror_t cry_lld_encrypt_DES_CBC(CRYDriver *cryp, * @retval CRY_ERR_INV_KEY_TYPE the selected key is invalid for this operation. * @retval CRY_ERR_INV_KEY_ID if the specified key identifier is invalid * or refers to an empty key slot. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -858,7 +911,9 @@ cryerror_t cry_lld_decrypt_DES_CBC(CRYDriver *cryp, return CRY_ERR_INV_ALGO; } +#endif +#if (CRY_LLD_SUPPORTS_SHA1 == TRUE) || defined(__DOXYGEN__) /** * @brief Hash initialization using SHA1. * @note Use of this algorithm is not recommended because proven weak. @@ -868,6 +923,8 @@ cryerror_t cry_lld_decrypt_DES_CBC(CRYDriver *cryp, * @retval CRY_NOERROR if the operation succeeded. * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this * device instance. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -891,6 +948,8 @@ cryerror_t cry_lld_SHA1_init(CRYDriver *cryp, SHA1Context *sha1ctxp) { * @retval CRY_NOERROR if the operation succeeded. * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this * device instance. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -916,6 +975,8 @@ cryerror_t cry_lld_SHA1_update(CRYDriver *cryp, SHA1Context *sha1ctxp, * @retval CRY_NOERROR if the operation succeeded. * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this * device instance. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -928,7 +989,9 @@ cryerror_t cry_lld_SHA1_final(CRYDriver *cryp, SHA1Context *sha1ctxp, return CRY_ERR_INV_ALGO; } +#endif +#if (CRY_LLD_SUPPORTS_SHA256 == TRUE) || defined(__DOXYGEN__) /** * @brief Hash initialization using SHA256. * @@ -937,6 +1000,8 @@ cryerror_t cry_lld_SHA1_final(CRYDriver *cryp, SHA1Context *sha1ctxp, * @retval CRY_NOERROR if the operation succeeded. * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this * device instance. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -959,6 +1024,8 @@ cryerror_t cry_lld_SHA256_init(CRYDriver *cryp, SHA256Context *sha256ctxp) { * @retval CRY_NOERROR if the operation succeeded. * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this * device instance. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -983,6 +1050,8 @@ cryerror_t cry_lld_SHA256_update(CRYDriver *cryp, SHA256Context *sha256ctxp, * @retval CRY_NOERROR if the operation succeeded. * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this * device instance. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -995,7 +1064,9 @@ cryerror_t cry_lld_SHA256_final(CRYDriver *cryp, SHA256Context *sha256ctxp, return CRY_ERR_INV_ALGO; } +#endif +#if (CRY_LLD_SUPPORTS_SHA512 == TRUE) || defined(__DOXYGEN__) /** * @brief Hash initialization using SHA512. * @@ -1004,6 +1075,8 @@ cryerror_t cry_lld_SHA256_final(CRYDriver *cryp, SHA256Context *sha256ctxp, * @retval CRY_NOERROR if the operation succeeded. * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this * device instance. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -1026,6 +1099,8 @@ cryerror_t cry_lld_SHA512_init(CRYDriver *cryp, SHA512Context *sha512ctxp) { * @retval CRY_NOERROR if the operation succeeded. * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this * device instance. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -1050,6 +1125,8 @@ cryerror_t cry_lld_SHA512_update(CRYDriver *cryp, SHA512Context *sha512ctxp, * @retval CRY_NOERROR if the operation succeeded. * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this * device instance. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -1062,6 +1139,7 @@ cryerror_t cry_lld_SHA512_final(CRYDriver *cryp, SHA512Context *sha512ctxp, return CRY_ERR_INV_ALGO; } +#endif #if (CRY_LLD_SUPPORTS_HMAC_SHA256 == TRUE) || defined(__DOXYGEN__) /** @@ -1075,6 +1153,8 @@ cryerror_t cry_lld_SHA512_final(CRYDriver *cryp, SHA512Context *sha512ctxp, * @retval CRY_NOERROR if the operation succeeded. * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this * device instance. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -1099,6 +1179,8 @@ cryerror_t cry_lld_HMACSHA256_init(CRYDriver *cryp, * @retval CRY_NOERROR if the operation succeeded. * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this * device instance. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -1126,6 +1208,8 @@ cryerror_t cry_lld_HMACSHA256_update(CRYDriver *cryp, * @retval CRY_NOERROR if the operation succeeded. * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this * device instance. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -1139,7 +1223,7 @@ cryerror_t cry_lld_HMACSHA256_final(CRYDriver *cryp, return CRY_ERR_INV_ALGO; } -#endif /* CRY_LLD_SUPPORTS_HMAC_SHA256 */ +#endif #if (CRY_LLD_SUPPORTS_HMAC_SHA512 == TRUE) || defined(__DOXYGEN__) /** @@ -1153,6 +1237,8 @@ cryerror_t cry_lld_HMACSHA256_final(CRYDriver *cryp, * @retval CRY_NOERROR if the operation succeeded. * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this * device instance. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -1177,6 +1263,8 @@ cryerror_t cry_lld_HMACSHA512_init(CRYDriver *cryp, * @retval CRY_NOERROR if the operation succeeded. * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this * device instance. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -1204,6 +1292,8 @@ cryerror_t cry_lld_HMACSHA512_update(CRYDriver *cryp, * @retval CRY_NOERROR if the operation succeeded. * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this * device instance. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -1217,8 +1307,9 @@ cryerror_t cry_lld_HMACSHA512_final(CRYDriver *cryp, return CRY_ERR_INV_ALGO; } -#endif /* CRY_LLD_SUPPORTS_HMAC_SHA512 */ +#endif +#if (CRY_LLD_SUPPORTS_TRNG == TRUE) || defined(__DOXYGEN__) /** * @brief True random numbers generator. * @@ -1228,6 +1319,8 @@ cryerror_t cry_lld_HMACSHA512_final(CRYDriver *cryp, * @retval CRY_NOERROR if the operation succeeded. * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this * device instance. + * @retval CRY_ERR_OP_FAILURE if the operation failed, implementation + * dependent. * * @notapi */ @@ -1238,6 +1331,7 @@ cryerror_t cry_lld_TRNG(CRYDriver *cryp, uint8_t *out) { return CRY_ERR_INV_ALGO; } +#endif #endif /* HAL_USE_CRY == TRUE */ diff --git a/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.h b/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.h index eba045390..641e3913a 100644 --- a/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.h +++ b/os/hal/ports/STM32/LLD/CRYPv1/hal_crypto_lld.h @@ -50,7 +50,7 @@ #define CRY_LLD_SUPPORTS_HMAC_SHA256 TRUE #define CRY_LLD_SUPPORTS_HMAC_SHA512 TRUE #define CRY_LLD_SUPPORTS_TRNG TRUE -/** @{ */ +/** @} */ /*===========================================================================*/ /* Driver pre-compile time settings. */ @@ -195,6 +195,7 @@ extern "C" { cryalgorithm_t algorithm, size_t size, const uint8_t *keyp); +#if (CRY_LLD_SUPPORTS_AES == TRUE) || defined(__DOXYGEN__) cryerror_t cry_lld_encrypt_AES(CRYDriver *cryp, crykey_t key_id, const uint8_t *in, @@ -203,6 +204,8 @@ extern "C" { crykey_t key_id, const uint8_t *in, uint8_t *out); +#endif +#if (CRY_LLD_SUPPORTS_AES_ECB == TRUE) || defined(__DOXYGEN__) cryerror_t cry_lld_encrypt_AES_ECB(CRYDriver *cryp, crykey_t key_id, size_t size, @@ -213,6 +216,8 @@ extern "C" { size_t size, const uint8_t *in, uint8_t *out); +#endif +#if (CRY_LLD_SUPPORTS_AES_CBC == TRUE) || defined(__DOXYGEN__) cryerror_t cry_lld_encrypt_AES_CBC(CRYDriver *cryp, crykey_t key_id, size_t size, @@ -225,6 +230,8 @@ extern "C" { const uint8_t *in, uint8_t *out, const uint8_t *iv); +#endif +#if (CRY_LLD_SUPPORTS_AES_CFB == TRUE) || defined(__DOXYGEN__) cryerror_t cry_lld_encrypt_AES_CFB(CRYDriver *cryp, crykey_t key_id, size_t size, @@ -237,6 +244,8 @@ extern "C" { const uint8_t *in, uint8_t *out, const uint8_t *iv); +#endif +#if (CRY_LLD_SUPPORTS_AES_CTR == TRUE) || defined(__DOXYGEN__) cryerror_t cry_lld_encrypt_AES_CTR(CRYDriver *cryp, crykey_t key_id, size_t size, @@ -249,6 +258,8 @@ extern "C" { const uint8_t *in, uint8_t *out, const uint8_t *iv); +#endif +#if (CRY_LLD_SUPPORTS_AES_GCM == TRUE) || defined(__DOXYGEN__) cryerror_t cry_lld_encrypt_AES_GCM(CRYDriver *cryp, crykey_t key_id, size_t size, @@ -267,6 +278,8 @@ extern "C" { size_t aadsize, const uint8_t *aad, uint8_t *authtag); +#endif +#if (CRY_LLD_SUPPORTS_DES == TRUE) || defined(__DOXYGEN__) cryerror_t cry_lld_encrypt_DES(CRYDriver *cryp, crykey_t key_id, const uint8_t *in, @@ -275,6 +288,8 @@ extern "C" { crykey_t key_id, const uint8_t *in, uint8_t *out); +#endif +#if (CRY_LLD_SUPPORTS_DES_ECB == TRUE) || defined(__DOXYGEN__) cryerror_t cry_lld_encrypt_DES_ECB(CRYDriver *cryp, crykey_t key_id, size_t size, @@ -285,6 +300,8 @@ extern "C" { size_t size, const uint8_t *in, uint8_t *out); +#endif +#if (CRY_LLD_SUPPORTS_DES_CBC == TRUE) || defined(__DOXYGEN__) cryerror_t cry_lld_encrypt_DES_CBC(CRYDriver *cryp, crykey_t key_id, size_t size, @@ -297,27 +314,28 @@ extern "C" { const uint8_t *in, uint8_t *out, const uint8_t *iv); +#endif #if (CRY_LLD_SUPPORTS_SHA1 == TRUE) || defined(__DOXYGEN__) cryerror_t cry_lld_SHA1_init(CRYDriver *cryp, SHA1Context *sha1ctxp); cryerror_t cry_lld_SHA1_update(CRYDriver *cryp, SHA1Context *sha1ctxp, size_t size, const uint8_t *in); cryerror_t cry_lld_SHA1_final(CRYDriver *cryp, SHA1Context *sha1ctxp, uint8_t *out); -#endif /* CRY_LLD_SUPPORTS_SHA1 */ +#endif #if (CRY_LLD_SUPPORTS_SHA256 == TRUE) || defined(__DOXYGEN__) cryerror_t cry_lld_SHA256_init(CRYDriver *cryp, SHA256Context *sha256ctxp); cryerror_t cry_lld_SHA256_update(CRYDriver *cryp, SHA256Context *sha256ctxp, size_t size, const uint8_t *in); cryerror_t cry_lld_SHA256_final(CRYDriver *cryp, SHA256Context *sha256ctxp, uint8_t *out); -#endif /* CRY_LLD_SUPPORTS_SHA256 */ +#endif #if (CRY_LLD_SUPPORTS_SHA512 == TRUE) || defined(__DOXYGEN__) cryerror_t cry_lld_SHA512_init(CRYDriver *cryp, SHA512Context *sha512ctxp); cryerror_t cry_lld_SHA512_update(CRYDriver *cryp, SHA512Context *sha512ctxp, size_t size, const uint8_t *in); cryerror_t cry_lld_SHA512_final(CRYDriver *cryp, SHA512Context *sha512ctxp, uint8_t *out); -#endif /* CRY_LLD_SUPPORTS_SHA512 */ +#endif #if (CRY_LLD_SUPPORTS_HMAC_SHA256 == TRUE) || defined(__DOXYGEN__) cryerror_t cry_lld_HMACSHA256_init(CRYDriver *cryp, HMACSHA256Context *hmacsha256ctxp); @@ -327,7 +345,7 @@ extern "C" { cryerror_t cry_lld_HMACSHA256_final(CRYDriver *cryp, HMACSHA256Context *hmacsha256ctxp, uint8_t *out); -#endif /* CRY_LLD_SUPPORTS_HMAC_SHA256 */ +#endif #if (CRY_LLD_SUPPORTS_HMAC_SHA512 == TRUE) || defined(__DOXYGEN__) cryerror_t cry_lld_HMACSHA512_init(CRYDriver *cryp, HMACSHA512Context *hmacsha512ctxp); @@ -337,8 +355,10 @@ extern "C" { cryerror_t cry_lld_HMACSHA512_final(CRYDriver *cryp, HMACSHA512Context *hmacsha512ctxp, uint8_t *out); -#endif /* CRY_LLD_SUPPORTS_HMAC_SHA512 */ +#endif +#if (CRY_LLD_SUPPORTS_TRNG == TRUE) || defined(__DOXYGEN__) cryerror_t cry_lld_TRNG(CRYDriver *cryp, uint8_t *out); +#endif #ifdef __cplusplus } #endif -- cgit v1.2.3