summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util/sha1.c
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2015-06-07 17:37:34 +0200
committer Miodrag Milanovic <mmicko@gmail.com>2015-06-07 17:37:34 +0200
commitb6ce8ee991c7e14ca214a2931bfbc4e4a5a0dc0f (patch)
treeda1e239053b7bfd9e841a103bbb36aefb71c4e7f /src/lib/util/sha1.c
parentb6a4cf45ca6fdf842b319806d61d638cf2d8b2d2 (diff)
Licenses for Raphael Nabet (nw)
Diffstat (limited to 'src/lib/util/sha1.c')
-rw-r--r--src/lib/util/sha1.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/lib/util/sha1.c b/src/lib/util/sha1.c
index b8de519c7bc..732828d9ccf 100644
--- a/src/lib/util/sha1.c
+++ b/src/lib/util/sha1.c
@@ -121,6 +121,14 @@ static void WRITE_UINT32(unsigned char* data, UINT32 val)
/* Initialize the SHA values */
+/**
+ * @fn void sha1_init(struct sha1_ctx *ctx)
+ *
+ * @brief Sha 1 initialise.
+ *
+ * @param [in,out] ctx If non-null, the context.
+ */
+
void
sha1_init(struct sha1_ctx *ctx)
{
@@ -145,6 +153,15 @@ sha1_init(struct sha1_ctx *ctx)
Note that this function destroys the data area */
+/**
+ * @fn static void sha1_transform(UINT32 *state, UINT32 *data)
+ *
+ * @brief Sha 1 transform.
+ *
+ * @param [in,out] state If non-null, the state.
+ * @param [in,out] data If non-null, the data.
+ */
+
static void
sha1_transform(UINT32 *state, UINT32 *data)
{
@@ -250,6 +267,15 @@ sha1_transform(UINT32 *state, UINT32 *data)
state[4] += E;
}
+/**
+ * @fn static void sha1_block(struct sha1_ctx *ctx, const UINT8 *block)
+ *
+ * @brief Sha 1 block.
+ *
+ * @param [in,out] ctx If non-null, the context.
+ * @param block The block.
+ */
+
static void
sha1_block(struct sha1_ctx *ctx, const UINT8 *block)
{
@@ -267,6 +293,16 @@ sha1_block(struct sha1_ctx *ctx, const UINT8 *block)
sha1_transform(ctx->digest, data);
}
+/**
+ * @fn void sha1_update(struct sha1_ctx *ctx, unsigned length, const UINT8 *buffer)
+ *
+ * @brief Sha 1 update.
+ *
+ * @param [in,out] ctx If non-null, the context.
+ * @param length The length.
+ * @param buffer The buffer.
+ */
+
void
sha1_update(struct sha1_ctx *ctx,
unsigned length, const UINT8 *buffer)
@@ -303,6 +339,14 @@ sha1_update(struct sha1_ctx *ctx,
/* Final wrapup - pad to SHA1_DATA_SIZE-byte boundary with the bit pattern
1 0* (64-bit count of bits processed, MSB-first) */
+/**
+ * @fn void sha1_final(struct sha1_ctx *ctx)
+ *
+ * @brief Sha 1 final.
+ *
+ * @param [in,out] ctx If non-null, the context.
+ */
+
void
sha1_final(struct sha1_ctx *ctx)
{
@@ -346,6 +390,16 @@ sha1_final(struct sha1_ctx *ctx)
sha1_transform(ctx->digest, data);
}
+/**
+ * @fn void sha1_digest(const struct sha1_ctx *ctx, unsigned length, UINT8 *digest)
+ *
+ * @brief Sha 1 digest.
+ *
+ * @param ctx The context.
+ * @param length The length.
+ * @param [in,out] digest If non-null, the digest.
+ */
+
void
sha1_digest(const struct sha1_ctx *ctx,
unsigned length,