diff --git a/sys/hashes/sha224.c b/sys/hashes/sha224.c index 0fdcf8c484..60429a6cce 100644 --- a/sys/hashes/sha224.c +++ b/sys/hashes/sha224.c @@ -41,21 +41,6 @@ void sha224_init(sha224_context_t *ctx) ctx->state[7] = 0xBEFA4FA4; } -/* Add bytes into the hash */ -void sha224_update(sha224_context_t *ctx, const void *data, size_t len) -{ - sha2xx_update(ctx, data, len); -} - -/* - * SHA-224 finalization. Pads the input data, exports the hash value, - * and clears the context state. - */ -void sha224_final(sha224_context_t *ctx, void *dst) -{ - sha2xx_final(ctx, dst, SHA224_DIGEST_LENGTH); -} - void *sha224(const void *data, size_t len, void *digest) { sha224_context_t c; diff --git a/sys/hashes/sha256.c b/sys/hashes/sha256.c index ac8e37c8a2..4109911bfe 100644 --- a/sys/hashes/sha256.c +++ b/sys/hashes/sha256.c @@ -69,21 +69,6 @@ void sha256_init(sha256_context_t *ctx) ctx->state[7] = 0x5BE0CD19; } -/* Add bytes into the hash */ -void sha256_update(sha256_context_t *ctx, const void *data, size_t len) -{ - sha2xx_update(ctx, data, len); -} - -/* - * SHA-256 finalization. Pads the input data, exports the hash value, - * and clears the context state. - */ -void sha256_final(sha256_context_t *ctx, void *dst) -{ - sha2xx_final(ctx, dst, SHA256_DIGEST_LENGTH); -} - void *sha256(const void *data, size_t len, void *digest) { sha256_context_t c; diff --git a/sys/include/hashes/sha224.h b/sys/include/hashes/sha224.h index f6794384e4..13d2692b40 100644 --- a/sys/include/hashes/sha224.h +++ b/sys/include/hashes/sha224.h @@ -88,7 +88,10 @@ void sha224_init(sha224_context_t *ctx); * @param[in] data Input data * @param[in] len Length of @p data */ -void sha224_update(sha224_context_t *ctx, const void *data, size_t len); +static inline void sha224_update(sha224_context_t *ctx, const void *data, size_t len) +{ + sha2xx_update(ctx, data, len); +} /** * @brief SHA-224 finalization. Pads the input data, exports the hash value, @@ -97,7 +100,10 @@ void sha224_update(sha224_context_t *ctx, const void *data, size_t len); * @param ctx sha224_context_t handle to use * @param digest resulting digest, this is the hash of all the bytes */ -void sha224_final(sha224_context_t *ctx, void *digest); +static inline void sha224_final(sha224_context_t *ctx, void *digest) +{ + sha2xx_final(ctx, digest, SHA224_DIGEST_LENGTH); +} /** * @brief A wrapper function to simplify the generation of a hash, this is diff --git a/sys/include/hashes/sha256.h b/sys/include/hashes/sha256.h index 4559871330..800fb8b0ce 100644 --- a/sys/include/hashes/sha256.h +++ b/sys/include/hashes/sha256.h @@ -106,7 +106,10 @@ void sha256_init(sha256_context_t *ctx); * @param[in] data Input data * @param[in] len Length of @p data */ -void sha256_update(sha256_context_t *ctx, const void *data, size_t len); +static inline void sha256_update(sha256_context_t *ctx, const void *data, size_t len) +{ + sha2xx_update(ctx, data, len); +} /** * @brief SHA-256 finalization. Pads the input data, exports the hash value, @@ -115,7 +118,10 @@ void sha256_update(sha256_context_t *ctx, const void *data, size_t len); * @param ctx sha256_context_t handle to use * @param digest resulting digest, this is the hash of all the bytes */ -void sha256_final(sha256_context_t *ctx, void *digest); +static inline void sha256_final(sha256_context_t *ctx, void *digest) +{ + sha2xx_final(ctx, digest, SHA256_DIGEST_LENGTH); +} /** * @brief A wrapper function to simplify the generation of a hash, this is