1 /* $MirOS: src/include/tiger.h,v 1.2 2013/10/31 20:06:09 tg Exp $ */
2 
3 #ifndef _TIGER_H
4 #define _TIGER_H
5 
6 #define TIGER_BLOCK_LENGTH		64
7 #define TIGER_DIGEST_LENGTH		24
8 #define TIGER_DIGEST_STRING_LENGTH	(TIGER_DIGEST_LENGTH * 2 + 1)
9 
10 typedef struct {
11 	uint64_t digest[3];
12 	uint64_t count;
13 	uint8_t buffer[TIGER_BLOCK_LENGTH];
14 } TIGER_CTX;
15 
16 #include <sys/cdefs.h>
17 
18 __BEGIN_DECLS
19 void TIGERInit(TIGER_CTX *);
20 void TIGERPad(TIGER_CTX *);
21 void TIGERTransform(uint64_t *, const uint8_t *)
22 	__attribute__((__bounded__(__minbytes__, 1, 24)))
23 	__attribute__((__bounded__(__minbytes__, 2, TIGER_BLOCK_LENGTH)));
24 void TIGERUpdate(TIGER_CTX *, const uint8_t *, size_t)
25 	__attribute__((__bounded__(__string__, 2, 3)));
26 void TIGERFinal(uint8_t *, TIGER_CTX *)
27 	__attribute__((__bounded__(__minbytes__, 1, TIGER_DIGEST_LENGTH)));
28 char *TIGEREnd(TIGER_CTX *, char *)
29 	__attribute__((__bounded__(__minbytes__, 2, TIGER_DIGEST_STRING_LENGTH)));
30 char *TIGERFile(const char *, char *)
31 	__attribute__((__bounded__(__minbytes__, 2, TIGER_DIGEST_STRING_LENGTH)));
32 char *TIGERFileChunk(const char *, char *, off_t, off_t)
33 	__attribute__((__bounded__(__minbytes__, 2, TIGER_DIGEST_STRING_LENGTH)));
34 char *TIGERData(const uint8_t *, size_t, char *)
35 	__attribute__((__bounded__(__string__, 1, 2)))
36 	__attribute__((__bounded__(__minbytes__, 3, TIGER_DIGEST_STRING_LENGTH)));
37 __END_DECLS
38 
39 #endif
40