summaryrefslogtreecommitdiffstats
path: root/libmincrypt/includes/mincrypt/hash-internal.h
diff options
context:
space:
mode:
authorDees Troy <dees_troy@teamw.in>2013-11-02 21:25:14 +0100
committerDees Troy <dees_troy@teamw.in>2013-11-02 21:43:26 +0100
commitbb4c0cbc4bdbff65e3c997bc5bd0ad6d6afa19d6 (patch)
tree9c28e5243024d0755d15e981a21f2fbb35a41ead /libmincrypt/includes/mincrypt/hash-internal.h
parentUpdate licenses to all match (diff)
parentmerge in klp-release history after reset to klp-dev (diff)
downloadandroid_bootable_recovery-bb4c0cbc4bdbff65e3c997bc5bd0ad6d6afa19d6.tar
android_bootable_recovery-bb4c0cbc4bdbff65e3c997bc5bd0ad6d6afa19d6.tar.gz
android_bootable_recovery-bb4c0cbc4bdbff65e3c997bc5bd0ad6d6afa19d6.tar.bz2
android_bootable_recovery-bb4c0cbc4bdbff65e3c997bc5bd0ad6d6afa19d6.tar.lz
android_bootable_recovery-bb4c0cbc4bdbff65e3c997bc5bd0ad6d6afa19d6.tar.xz
android_bootable_recovery-bb4c0cbc4bdbff65e3c997bc5bd0ad6d6afa19d6.tar.zst
android_bootable_recovery-bb4c0cbc4bdbff65e3c997bc5bd0ad6d6afa19d6.zip
Diffstat (limited to 'libmincrypt/includes/mincrypt/hash-internal.h')
-rw-r--r--libmincrypt/includes/mincrypt/hash-internal.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/libmincrypt/includes/mincrypt/hash-internal.h b/libmincrypt/includes/mincrypt/hash-internal.h
new file mode 100644
index 000000000..96806f7c6
--- /dev/null
+++ b/libmincrypt/includes/mincrypt/hash-internal.h
@@ -0,0 +1,40 @@
+// Copyright 2007 Google Inc. All Rights Reserved.
+// Author: mschilder@google.com (Marius Schilder)
+
+#ifndef SECURITY_UTIL_LITE_HASH_INTERNAL_H__
+#define SECURITY_UTIL_LITE_HASH_INTERNAL_H__
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+struct HASH_CTX; // forward decl
+
+typedef struct HASH_VTAB {
+ void (* const init)(struct HASH_CTX*);
+ void (* const update)(struct HASH_CTX*, const void*, int);
+ const uint8_t* (* const final)(struct HASH_CTX*);
+ const uint8_t* (* const hash)(const void*, int, uint8_t*);
+ int size;
+} HASH_VTAB;
+
+typedef struct HASH_CTX {
+ const HASH_VTAB * f;
+ uint64_t count;
+ uint8_t buf[64];
+ uint32_t state[8]; // upto SHA2
+} HASH_CTX;
+
+#define HASH_init(ctx) (ctx)->f->init(ctx)
+#define HASH_update(ctx, data, len) (ctx)->f->update(ctx, data, len)
+#define HASH_final(ctx) (ctx)->f->final(ctx)
+#define HASH_hash(data, len, digest) (ctx)->f->hash(data, len, digest)
+#define HASH_size(ctx) (ctx)->f->size
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+#endif // SECURITY_UTIL_LITE_HASH_INTERNAL_H__