sys/hashes: inline functions in sha224/sha256
This commit is contained in:
parent
454d1fe4cf
commit
f9c67e18b6
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user