summaryrefslogtreecommitdiff
path: root/src/util/mesa-sha1.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/mesa-sha1.h')
-rw-r--r--src/util/mesa-sha1.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/util/mesa-sha1.h b/src/util/mesa-sha1.h
index 9842bbb1e2d..c264927d572 100644
--- a/src/util/mesa-sha1.h
+++ b/src/util/mesa-sha1.h
@@ -24,7 +24,8 @@
#define MESA_SHA1_H
#include <stdlib.h>
-#include "c99_compat.h"
+#include <stdio.h>
+#include <stdbool.h>
#include "sha1/sha1.h"
#ifdef __cplusplus
@@ -32,6 +33,7 @@ extern "C" {
#endif
#define mesa_sha1 _SHA1_CTX
+#define SHA1_DIGEST_LENGTH32 (SHA1_DIGEST_LENGTH / 4)
static inline void
_mesa_sha1_init(struct mesa_sha1 *ctx)
@@ -42,7 +44,8 @@ _mesa_sha1_init(struct mesa_sha1 *ctx)
static inline void
_mesa_sha1_update(struct mesa_sha1 *ctx, const void *data, size_t size)
{
- SHA1Update(ctx, (const unsigned char *)data, size);
+ if (size)
+ SHA1Update(ctx, (const unsigned char *)data, size);
}
static inline void
@@ -60,6 +63,13 @@ _mesa_sha1_hex_to_sha1(unsigned char *buf, const char *hex);
void
_mesa_sha1_compute(const void *data, size_t size, unsigned char result[20]);
+void
+_mesa_sha1_print(FILE *f, const uint8_t sha1[SHA1_DIGEST_LENGTH]);
+
+bool
+_mesa_printed_sha1_equal(const uint8_t sha1[SHA1_DIGEST_LENGTH],
+ const uint32_t printed_sha1[SHA1_DIGEST_LENGTH32]);
+
#ifdef __cplusplus
} /* extern C */
#endif