hvf: use yacc & re2c to generate a system config parser
[hvf.git] / include / digest.h
blob980a57a297d960d854ec625a1d447ef8e98c5866
1 /*
2 * (C) Copyright 2007-2010 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
4 * This file is released under the GPLv2. See the COPYING file for more
5 * details.
6 */
8 #ifndef __DIGEST_H
9 #define __DIGEST_H
11 #define DIGEST_QUERY 0
12 #define DIGEST_SHA1 1
14 struct digest_ctx_sha1 {
15 u32 H[5];
16 u64 mbl;
17 u8 buflen;
18 u8 buf[64];
19 } __attribute__((packed,aligned(8)));
21 struct digest_ctx {
22 u8 type;
23 u8 __reserved[7];
24 union {
25 struct digest_ctx_sha1 sha1;
29 struct digest_info {
30 void (*init)(struct digest_ctx *);
31 void (*update)(struct digest_ctx *, u8 *, u64);
32 void (*finalize)(struct digest_ctx *, u8 *, u64);
35 extern int digest_init_ctx(int dt, struct digest_ctx *ctx);
36 extern void digest_update_ctx(struct digest_ctx *ctx, u8 *data, u64 len);
37 extern void digest_finalize_ctx(struct digest_ctx *ctx, u8 *data, u64 len);
39 #endif