aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/templates/hal_crypto_lld.c
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2018-03-09 11:37:12 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2018-03-09 11:37:12 +0000
commit0b1cba4c2e057efcbd652a4026c6bc10527cac41 (patch)
tree26adb24e16f71eb33a51b549ec0b23d1563d68b0 /os/hal/templates/hal_crypto_lld.c
parentd8333bc79881f47a9bbc9b77903038bbf3433e1b (diff)
downloadChibiOS-0b1cba4c2e057efcbd652a4026c6bc10527cac41.tar.gz
ChibiOS-0b1cba4c2e057efcbd652a4026c6bc10527cac41.tar.bz2
ChibiOS-0b1cba4c2e057efcbd652a4026c6bc10527cac41.zip
Crypto SHA reworked.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11663 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os/hal/templates/hal_crypto_lld.c')
-rw-r--r--os/hal/templates/hal_crypto_lld.c558
1 files changed, 344 insertions, 214 deletions
diff --git a/os/hal/templates/hal_crypto_lld.c b/os/hal/templates/hal_crypto_lld.c
index abaaf1d78..e2f8af18a 100644
--- a/os/hal/templates/hal_crypto_lld.c
+++ b/os/hal/templates/hal_crypto_lld.c
@@ -67,7 +67,7 @@ void cry_lld_init(void) {
/**
* @brief Configures and activates the crypto peripheral.
*
- * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] cryp pointer to the @p CRYDriver object
*
* @notapi
*/
@@ -81,7 +81,7 @@ void cry_lld_start(CRYDriver *cryp) {
/**
* @brief Deactivates the crypto peripheral.
*
- * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] cryp pointer to the @p CRYDriver object
*
* @notapi
*/
@@ -95,11 +95,11 @@ void cry_lld_stop(CRYDriver *cryp) {
/**
* @brief Initializes the transient key for a specific algorithm.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] algorithm the algorithm identifier
- * @param[in] size key size in bytes
- * @param[in] keyp pointer to the key data
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] algorithm the algorithm identifier
+ * @param[in] size key size in bytes
+ * @param[in] keyp pointer to the key data
+ * @return The operation status.
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the specified algorithm is unknown or
* unsupported.
@@ -125,13 +125,13 @@ cryerror_t cry_lld_loadkey(CRYDriver *cryp,
* @note The implementation of this function must guarantee that it can
* be called from any context.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] key_id the key to be used for the operation, zero is the
- * transient key, other values are keys stored in an
- * unspecified way
- * @param[in] in buffer containing the input plaintext
- * @param[out] out buffer for the output cyphertext
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] key_id the key to be used for the operation, zero is
+ * the transient key, other values are keys stored
+ * in an unspecified way
+ * @param[in] in buffer containing the input plaintext
+ * @param[out] out buffer for the output cyphertext
+ * @return The operation status.
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
@@ -159,13 +159,13 @@ cryerror_t cry_lld_encrypt_AES(CRYDriver *cryp,
* @note The implementation of this function must guarantee that it can
* be called from any context.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] key_id the key to be used for the operation, zero is the
- * transient key, other values are keys stored in an
- * unspecified way
- * @param[in] in buffer containing the input cyphertext
- * @param[out] out buffer for the output plaintext
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] key_id the key to be used for the operation, zero is
+ * the transient key, other values are keys stored
+ * in an unspecified way
+ * @param[in] in buffer containing the input cyphertext
+ * @param[out] out buffer for the output plaintext
+ * @return The operation status.
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
@@ -194,15 +194,15 @@ cryerror_t cry_lld_decrypt_AES(CRYDriver *cryp,
* of an AES block, this means that padding must be done by the
* caller.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] key_id the key to be used for the operation, zero is the
- * transient key, other values are keys stored in an
- * unspecified way
- * @param[in] size size of the plaintext buffer, this number must be a
- * multiple of the selected key size
- * @param[in] in buffer containing the input plaintext
- * @param[out] out buffer for the output cyphertext
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] key_id the key to be used for the operation, zero is
+ * the transient key, other values are keys stored
+ * in an unspecified way
+ * @param[in] size size of the plaintext buffer, this number must
+ * be a multiple of the selected key size
+ * @param[in] in buffer containing the input plaintext
+ * @param[out] out buffer for the output cyphertext
+ * @return The operation status.
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
@@ -233,15 +233,15 @@ cryerror_t cry_lld_encrypt_AES_ECB(CRYDriver *cryp,
* of an AES block, this means that padding must be done by the
* caller.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] key_id the key to be used for the operation, zero is the
- * transient key, other values are keys stored in an
- * unspecified way
- * @param[in] size size of the plaintext buffer, this number must be a
- * multiple of the selected key size
- * @param[in] in buffer containing the input plaintext
- * @param[out] out buffer for the output cyphertext
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] key_id the key to be used for the operation, zero is
+ * the transient key, other values are keys stored
+ * in an unspecified way
+ * @param[in] size size of the plaintext buffer, this number must
+ * be a multiple of the selected key size
+ * @param[in] in buffer containing the input plaintext
+ * @param[out] out buffer for the output cyphertext
+ * @return The operation status.
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
@@ -272,16 +272,16 @@ cryerror_t cry_lld_decrypt_AES_ECB(CRYDriver *cryp,
* of an AES block, this means that padding must be done by the
* caller.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] key_id the key to be used for the operation, zero is the
- * transient key, other values are keys stored in an
- * unspecified way
- * @param[in] size size of the plaintext buffer, this number must be a
- * multiple of the selected key size
- * @param[in] in buffer containing the input plaintext
- * @param[out] out buffer for the output cyphertext
- * @param[in] iv 128 bits initial vector
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] key_id the key to be used for the operation, zero is
+ * the transient key, other values are keys stored
+ * in an unspecified way
+ * @param[in] size size of the plaintext buffer, this number must
+ * be a multiple of the selected key size
+ * @param[in] in buffer containing the input plaintext
+ * @param[out] out buffer for the output cyphertext
+ * @param[in] iv 128 bits initial vector
+ * @return The operation status.
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
@@ -314,16 +314,16 @@ cryerror_t cry_lld_encrypt_AES_CBC(CRYDriver *cryp,
* of an AES block, this means that padding must be done by the
* caller.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] key_id the key to be used for the operation, zero is the
- * transient key, other values are keys stored in an
- * unspecified way
- * @param[in] size size of the plaintext buffer, this number must be a
- * multiple of the selected key size
- * @param[in] in buffer containing the input plaintext
- * @param[out] out buffer for the output cyphertext
- * @param[in] iv 128 bits initial vector
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] key_id the key to be used for the operation, zero is
+ * the transient key, other values are keys stored
+ * in an unspecified way
+ * @param[in] size size of the plaintext buffer, this number must
+ * be a multiple of the selected key size
+ * @param[in] in buffer containing the input plaintext
+ * @param[out] out buffer for the output cyphertext
+ * @param[in] iv 128 bits initial vector
+ * @return The operation status.
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
@@ -356,16 +356,16 @@ cryerror_t cry_lld_decrypt_AES_CBC(CRYDriver *cryp,
* of an AES block, this means that padding must be done by the
* caller.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] key_id the key to be used for the operation, zero is the
- * transient key, other values are keys stored in an
- * unspecified way
- * @param[in] size size of the plaintext buffer, this number must be a
- * multiple of the selected key size
- * @param[in] in buffer containing the input plaintext
- * @param[out] out buffer for the output cyphertext
- * @param[in] iv 128 bits initial vector
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] key_id the key to be used for the operation, zero is
+ * the transient key, other values are keys stored
+ * in an unspecified way
+ * @param[in] size size of the plaintext buffer, this number must
+ * be a multiple of the selected key size
+ * @param[in] in buffer containing the input plaintext
+ * @param[out] out buffer for the output cyphertext
+ * @param[in] iv 128 bits initial vector
+ * @return The operation status.
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
@@ -398,16 +398,16 @@ cryerror_t cry_lld_encrypt_AES_CFB(CRYDriver *cryp,
* of an AES block, this means that padding must be done by the
* caller.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] key_id the key to be used for the operation, zero is the
- * transient key, other values are keys stored in an
- * unspecified way
- * @param[in] size size of the plaintext buffer, this number must be a
- * multiple of the selected key size
- * @param[in] in buffer containing the input plaintext
- * @param[out] out buffer for the output cyphertext
- * @param[in] iv 128 bits initial vector
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] key_id the key to be used for the operation, zero is
+ * the transient key, other values are keys stored
+ * in an unspecified way
+ * @param[in] size size of the plaintext buffer, this number must
+ * be a multiple of the selected key size
+ * @param[in] in buffer containing the input plaintext
+ * @param[out] out buffer for the output cyphertext
+ * @param[in] iv 128 bits initial vector
+ * @return The operation status.
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
@@ -440,17 +440,17 @@ cryerror_t cry_lld_decrypt_AES_CFB(CRYDriver *cryp,
* of an AES block, this means that padding must be done by the
* caller.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] key_id the key to be used for the operation, zero is the
- * transient key, other values are keys stored in an
- * unspecified way
- * @param[in] size size of the plaintext buffer, this number must be a
- * multiple of 16
- * @param[in] in buffer containing the input plaintext
- * @param[out] out buffer for the output cyphertext
- * @param[in] iv 128 bits initial vector + counter, it contains
- * a 96 bits IV and a 32 bits counter
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] key_id the key to be used for the operation, zero is
+ * the transient key, other values are keys stored
+ * in an unspecified way
+ * @param[in] size size of the plaintext buffer, this number must
+ * be a multiple of 16
+ * @param[in] in buffer containing the input plaintext
+ * @param[out] out buffer for the output cyphertext
+ * @param[in] iv 128 bits initial vector + counter, it contains
+ * a 96 bits IV and a 32 bits counter
+ * @return The operation status.
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
@@ -483,17 +483,17 @@ cryerror_t cry_lld_encrypt_AES_CTR(CRYDriver *cryp,
* of an AES block, this means that padding must be done by the
* caller.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] key_id the key to be used for the operation, zero is the
- * transient key, other values are keys stored in an
- * unspecified way
- * @param[in] size size of the plaintext buffer, this number must be a
- * multiple of 16
- * @param[in] in buffer containing the input cyphertext
- * @param[out] out buffer for the output plaintext
- * @param[in] iv 128 bits initial vector + counter, it contains
- * a 96 bits IV and a 32 bits counter
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] key_id the key to be used for the operation, zero is
+ * the transient key, other values are keys stored
+ * in an unspecified way
+ * @param[in] size size of the plaintext buffer, this number must
+ * be a multiple of 16
+ * @param[in] in buffer containing the input cyphertext
+ * @param[out] out buffer for the output plaintext
+ * @param[in] iv 128 bits initial vector + counter, it contains
+ * a 96 bits IV and a 32 bits counter
+ * @return The operation status.
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
@@ -526,21 +526,22 @@ cryerror_t cry_lld_decrypt_AES_CTR(CRYDriver *cryp,
* of an AES block, this means that padding must be done by the
* caller.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] key_id the key to be used for the operation, zero is the
- * transient key, other values are keys stored in an
- * unspecified way
- * @param[in] size size of the text buffers, this number must be a
- * multiple of 16
- * @param[in] in buffer containing the input plaintext
- * @param[out] out buffer for the output cyphertext
- * @param[in] iv 128 bits initial vector + counter, it contains
- * a 96 bits IV and a 32 bits counter
- * @param[in] aadsize size of the authentication data, this number must be a
- * multiple of 16
- * @param[in] aad buffer containing the authentication data
- * @param[in] authtag 128 bits buffer for the generated authentication tag
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] key_id the key to be used for the operation, zero is
+ * the transient key, other values are keys stored
+ * in an unspecified way
+ * @param[in] size size of the text buffers, this number must be a
+ * multiple of 16
+ * @param[in] in buffer containing the input plaintext
+ * @param[out] out buffer for the output cyphertext
+ * @param[in] iv 128 bits initial vector + counter, it contains
+ * a 96 bits IV and a 32 bits counter
+ * @param[in] aadsize size of the authentication data, this number
+ * must be a multiple of 16
+ * @param[in] aad buffer containing the authentication data
+ * @param[in] authtag 128 bits buffer for the generated authentication
+ * tag
+ * @return The operation status.
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
@@ -579,21 +580,22 @@ cryerror_t cry_lld_encrypt_AES_GCM(CRYDriver *cryp,
* of an AES block, this means that padding must be done by the
* caller.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] key_id the key to be used for the operation, zero is the
- * transient key, other values are keys stored in an
- * unspecified way
- * @param[in] size size of the text buffers, this number must be a
- * multiple of 16
- * @param[in] in buffer for the output cyphertext
- * @param[out] out buffer containing the input plaintext
- * @param[in] iv 128 bits initial vector + counter, it contains
- * a 96 bits IV and a 32 bits counter
- * @param[in] aadsize size of the authentication data, this number must be a
- * multiple of 16
- * @param[in] aad buffer containing the authentication data
- * @param[in] authtag 128 bits buffer for the generated authentication tag
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] key_id the key to be used for the operation, zero is
+ * the transient key, other values are keys stored
+ * in an unspecified way
+ * @param[in] size size of the text buffers, this number must be a
+ * multiple of 16
+ * @param[in] in buffer for the output cyphertext
+ * @param[out] out buffer containing the input plaintext
+ * @param[in] iv 128 bits initial vector + counter, it contains
+ * a 96 bits IV and a 32 bits counter
+ * @param[in] aadsize size of the authentication data, this number
+ * must be a multiple of 16
+ * @param[in] aad buffer containing the authentication data
+ * @param[in] authtag 128 bits buffer for the generated authentication
+ * tag
+ * @return The operation status.
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
@@ -631,13 +633,13 @@ cryerror_t cry_lld_decrypt_AES_GCM(CRYDriver *cryp,
* @note The implementation of this function must guarantee that it can
* be called from any context.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] key_id the key to be used for the operation, zero is the
- * transient key, other values are keys stored in an
- * unspecified way
- * @param[in] in buffer containing the input plaintext
- * @param[out] out buffer for the output cyphertext
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] key_id the key to be used for the operation, zero is
+ * the transient key, other values are keys stored
+ * in an unspecified way
+ * @param[in] in buffer containing the input plaintext
+ * @param[out] out buffer for the output cyphertext
+ * @return The operation status.
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
@@ -666,13 +668,13 @@ cryerror_t cry_lld_encrypt_DES(CRYDriver *cryp,
* be called from any context.
*
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] key_id the key to be used for the operation, zero is the
- * transient key, other values are keys stored in an
- * unspecified way
- * @param[in] in buffer containing the input cyphertext
- * @param[out] out buffer for the output plaintext
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] key_id the key to be used for the operation, zero is
+ * the transient key, other values are keys stored
+ * in an unspecified way
+ * @param[in] in buffer containing the input cyphertext
+ * @param[out] out buffer for the output plaintext
+ * @return The operation status.
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
@@ -701,15 +703,15 @@ cryerror_t cry_lld_decrypt_DES(CRYDriver *cryp,
* of an DES block, this means that padding must be done by the
* caller.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] key_id the key to be used for the operation, zero is the
- * transient key, other values are keys stored in an
- * unspecified way
- * @param[in] size size of the plaintext buffer, this number must be a
- * multiple of 8
- * @param[in] in buffer containing the input plaintext
- * @param[out] out buffer for the output cyphertext
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] key_id the key to be used for the operation, zero is
+ * the transient key, other values are keys stored
+ * in an unspecified way
+ * @param[in] size size of the plaintext buffer, this number must
+ * be a multiple of 8
+ * @param[in] in buffer containing the input plaintext
+ * @param[out] out buffer for the output cyphertext
+ * @return The operation status.
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
@@ -740,15 +742,15 @@ cryerror_t cry_lld_encrypt_DES_ECB(CRYDriver *cryp,
* of an DES block, this means that padding must be done by the
* caller.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] key_id the key to be used for the operation, zero is the
- * transient key, other values are keys stored in an
- * unspecified way
- * @param[in] size size of the plaintext buffer, this number must be a
- * multiple of 8
- * @param[in] in buffer containing the input cyphertext
- * @param[out] out buffer for the output plaintext
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] key_id the key to be used for the operation, zero is
+ * the transient key, other values are keys stored
+ * in an unspecified way
+ * @param[in] size size of the plaintext buffer, this number must
+ * be a multiple of 8
+ * @param[in] in buffer containing the input cyphertext
+ * @param[out] out buffer for the output plaintext
+ * @return T he operation status.
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
@@ -779,16 +781,16 @@ cryerror_t cry_lld_decrypt_DES_ECB(CRYDriver *cryp,
* of an DES block, this means that padding must be done by the
* caller.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] key_id the key to be used for the operation, zero is the
- * transient key, other values are keys stored in an
- * unspecified way
- * @param[in] size size of the plaintext buffer, this number must be a
- * multiple of 8
- * @param[in] in buffer containing the input plaintext
- * @param[out] out buffer for the output cyphertext
- * @param[in] iv 64 bits input vector
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] key_id the key to be used for the operation, zero is
+ * the transient key, other values are keys stored
+ * in an unspecified way
+ * @param[in] size size of the plaintext buffer, this number must
+ * be a multiple of 8
+ * @param[in] in buffer containing the input plaintext
+ * @param[out] out buffer for the output cyphertext
+ * @param[in] iv 64 bits input vector
+ * @return The operation status.
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
@@ -821,16 +823,16 @@ cryerror_t cry_lld_encrypt_DES_CBC(CRYDriver *cryp,
* of an DES block, this means that padding must be done by the
* caller.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] key_id the key to be used for the operation, zero is the
- * transient key, other values are keys stored in an
- * unspecified way
- * @param[in] size size of the plaintext buffer, this number must be a
- * multiple of 8
- * @param[in] in buffer containing the input cyphertext
- * @param[out] out buffer for the output plaintext
- * @param[in] iv 64 bits input vector
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] key_id the key to be used for the operation, zero is
+ * the transient key, other values are keys stored
+ * in an unspecified way
+ * @param[in] size size of the plaintext buffer, this number must
+ * be a multiple of 8
+ * @param[in] in buffer containing the input cyphertext
+ * @param[out] out buffer for the output plaintext
+ * @param[in] iv 64 bits input vector
+ * @return The operation status.
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
@@ -858,76 +860,204 @@ cryerror_t cry_lld_decrypt_DES_CBC(CRYDriver *cryp,
}
/**
- * @brief Hash using SHA1.
+ * @brief Hash initialization using SHA1.
* @note Use of this algorithm is not recommended because proven weak.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] size size of input buffer
- * @param[in] in buffer containing the input text
- * @param[out] out 160 bits output buffer
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[out] sha1ctxp pointer to a SHA1 context to be initialized
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
*
- * @api
+ * @notapi
*/
-cryerror_t cry_lld_SHA1(CRYDriver *cryp, size_t size,
- const uint8_t *in, uint8_t *out) {
+cryerror_t cry_lld_SHA1_init(CRYDriver *cryp, SHA1Context *sha1ctxp) {
(void)cryp;
+ (void)sha1ctxp;
+
+ return CRY_ERR_INV_ALGO;
+}
+
+/**
+ * @brief Hash update using SHA1.
+ * @note Use of this algorithm is not recommended because proven weak.
+ *
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] sha1ctxp pointer to a SHA1 context
+ * @param[in] size size of input buffer
+ * @param[in] in buffer containing the input text
+ * @return The operation status.
+ * @retval CRY_NOERROR if the operation succeeded.
+ * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
+ * device instance.
+ *
+ * @notapi
+ */
+cryerror_t cry_lld_SHA1_update(CRYDriver *cryp, SHA1Context *sha1ctxp,
+ size_t size, const uint8_t *in) {
+
+ (void)cryp;
+ (void)sha1ctxp;
(void)size;
(void)in;
+
+ return CRY_ERR_INV_ALGO;
+}
+
+/**
+ * @brief Hash finalization using SHA1.
+ * @note Use of this algorithm is not recommended because proven weak.
+ *
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] sha1ctxp pointer to a SHA1 context
+ * @param[out] out 160 bits output buffer
+ * @return The operation status.
+ * @retval CRY_NOERROR if the operation succeeded.
+ * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
+ * device instance.
+ *
+ * @notapi
+ */
+cryerror_t cry_lld_SHA1_final(CRYDriver *cryp, SHA1Context *sha1ctxp,
+ uint8_t *out) {
+
+ (void)cryp;
+ (void)sha1ctxp;
(void)out;
return CRY_ERR_INV_ALGO;
}
/**
- * @brief Hash using SHA256.
+ * @brief Hash initialization using SHA256.
+ *
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[out] sha256ctxp pointer to a SHA256 context to be initialized
+ * @retval CRY_NOERROR if the operation succeeded.
+ * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
+ * device instance.
+ *
+ * @notapi
+ */
+cryerror_t cry_lld_SHA256_init(CRYDriver *cryp, SHA256Context *sha256ctxp) {
+
+ (void)cryp;
+ (void)sha256ctxp;
+
+ return CRY_ERR_INV_ALGO;
+}
+
+/**
+ * @brief Hash update using SHA256.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] size size of input buffer
- * @param[in] in buffer containing the input text
- * @param[out] out 256 bits output buffer
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] sha256ctxp pointer to a SHA256 context
+ * @param[in] size size of input buffer
+ * @param[in] in buffer containing the input text
+ * @return The operation status.
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
*
- * @api
+ * @notapi
*/
-cryerror_t cry_lld_SHA256(CRYDriver *cryp, size_t size,
- const uint8_t *in, uint8_t *out) {
+cryerror_t cry_lld_SHA256_update(CRYDriver *cryp, SHA256Context *sha256ctxp,
+ size_t size, const uint8_t *in) {
(void)cryp;
+ (void)sha256ctxp;
(void)size;
(void)in;
+
+ return CRY_ERR_INV_ALGO;
+}
+
+/**
+ * @brief Hash finalization using SHA256.
+ *
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] sha256ctxp pointer to a SHA256 context
+ * @param[out] out 256 bits output buffer
+ * @return The operation status.
+ * @retval CRY_NOERROR if the operation succeeded.
+ * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
+ * device instance.
+ *
+ * @notapi
+ */
+cryerror_t cry_lld_SHA256_final(CRYDriver *cryp, SHA256Context *sha256ctxp,
+ uint8_t *out) {
+
+ (void)cryp;
+ (void)sha256ctxp;
(void)out;
return CRY_ERR_INV_ALGO;
}
/**
- * @brief Hash using SHA512.
+ * @brief Hash initialization using SHA512.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[in] size size of input buffer
- * @param[in] in buffer containing the input text
- * @param[out] out 512 bits output buffer
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[out] sha512ctxp pointer to a SHA512 context to be initialized
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
*
- * @api
+ * @notapi
*/
-cryerror_t cry_lld_SHA512(CRYDriver *cryp, size_t size,
- const uint8_t *in, uint8_t *out) {
+cryerror_t cry_lld_SHA512_init(CRYDriver *cryp, SHA512Context *sha512ctxp) {
(void)cryp;
+ (void)sha512ctxp;
+
+ return CRY_ERR_INV_ALGO;
+}
+
+/**
+ * @brief Hash update using SHA512.
+ *
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] sha512ctxp pointer to a SHA512 context
+ * @param[in] size size of input buffer
+ * @param[in] in buffer containing the input text
+ * @return The operation status.
+ * @retval CRY_NOERROR if the operation succeeded.
+ * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
+ * device instance.
+ *
+ * @notapi
+ */
+cryerror_t cry_lld_SHA512_update(CRYDriver *cryp, SHA512Context *sha512ctxp,
+ size_t size, const uint8_t *in) {
+
+ (void)cryp;
+ (void)sha512ctxp;
(void)size;
(void)in;
+
+ return CRY_ERR_INV_ALGO;
+}
+
+/**
+ * @brief Hash finalization using SHA512.
+ *
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[in] sha512ctxp pointer to a SHA512 context
+ * @param[out] out 512 bits output buffer
+ * @return The operation status.
+ * @retval CRY_NOERROR if the operation succeeded.
+ * @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
+ * device instance.
+ *
+ * @notapi
+ */
+cryerror_t cry_lld_SHA512_final(CRYDriver *cryp, SHA512Context *sha512ctxp,
+ uint8_t *out) {
+
+ (void)cryp;
+ (void)sha512ctxp;
(void)out;
return CRY_ERR_INV_ALGO;
@@ -936,14 +1066,14 @@ cryerror_t cry_lld_SHA512(CRYDriver *cryp, size_t size,
/**
* @brief True random numbers generator.
*
- * @param[in] cryp pointer to the @p CRYDriver object
- * @param[out] out 128 bits output buffer
- * @return The operation status.
+ * @param[in] cryp pointer to the @p CRYDriver object
+ * @param[out] out 128 bits output buffer
+ * @return The operation status.
* @retval CRY_NOERROR if the operation succeeded.
* @retval CRY_ERR_INV_ALGO if the operation is unsupported on this
* device instance.
*
- * @api
+ * @notapi
*/
cryerror_t cry_lld_TRNG(CRYDriver *cryp, uint8_t *out) {