aboutsummaryrefslogtreecommitdiff
path: root/src/lib/crypto/builtin/yhash.h
diff options
context:
space:
mode:
authorZhanna Tsitkov <tsitkova@mit.edu>2009-09-30 22:33:41 +0000
committerZhanna Tsitkov <tsitkova@mit.edu>2009-09-30 22:33:41 +0000
commitcb1fe7f9bbab7c09c483bac964f4d045b91aec66 (patch)
tree836dab3fde0e3202cf6bc8c7eaba2f18c9bbde49 /src/lib/crypto/builtin/yhash.h
parente9c2e78bdd51ea150e46c9297f7abf5f5590522a (diff)
downloadkrb5-cb1fe7f9bbab7c09c483bac964f4d045b91aec66.zip
krb5-cb1fe7f9bbab7c09c483bac964f4d045b91aec66.tar.gz
krb5-cb1fe7f9bbab7c09c483bac964f4d045b91aec66.tar.bz2
Crypto modularity proj: SHS_INFO structure is defined differently for crypto impl's. Files hash_sha1.c and yhash.h are affected by this difference. Move hash_provider into the backend
The following bigredbutton is used to suppress svn complains about the trailing spaces in the moved/copied dirs. bigredbutton: whitespace git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22815 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/crypto/builtin/yhash.h')
-rw-r--r--src/lib/crypto/builtin/yhash.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/lib/crypto/builtin/yhash.h b/src/lib/crypto/builtin/yhash.h
new file mode 100644
index 0000000..ee4f03e
--- /dev/null
+++ b/src/lib/crypto/builtin/yhash.h
@@ -0,0 +1,29 @@
+/* -*- Mode: C; c-file-style: "bsd" -*- */
+
+#ifndef YHASH_H
+#define YHASH_H
+
+/* hash function interface */
+
+/* default to SHA1 for yarrow 160 */
+
+#include "shs.h"
+
+
+
+#define HASH_CTX SHS_INFO
+#define HASH_Init(x) shsInit(x)
+#define HASH_Update(x, buf, sz) shsUpdate(x, (const void*)buf, sz)
+#define HASH_Final(x, tdigest) do { \
+ int loopvar; \
+ unsigned char *out2 = (void *)(tdigest); \
+ HASH_CTX *ctx = (x); \
+ shsFinal(ctx); \
+ for (loopvar=0; loopvar<(sizeof(ctx->digest)/sizeof(ctx->digest[0])); loopvar++) \
+ store_32_be(ctx->digest[loopvar], &out2[loopvar*4]); \
+ } while(0)
+
+
+#define HASH_DIGEST_SIZE SHS_DIGESTSIZE
+
+#endif /* YHASH_H */