1 /* $MirOS: src/include/sfv.h,v 1.2 2013/10/31 20:06:08 tg Exp $ */
2 
3 #ifndef _SFV_H
4 #define _SFV_H
5 
6 #define SFV_DIGEST_LENGTH		4
7 #define SFV_DIGEST_STRING_LENGTH	(SFV_DIGEST_LENGTH * 2 + 1)
8 
9 typedef struct {
10 	uint64_t len;
11 	uint32_t crc;
12 } SFV_CTX;
13 
14 #define SFV_DIGEST_UPPERCASE
15 
16 #include <sys/cdefs.h>
17 
18 __BEGIN_DECLS
19 void SFVInit(SFV_CTX *);
20 void SFVPad(SFV_CTX *);
21 void SFVUpdate(SFV_CTX *, const uint8_t *, size_t)
22 	__attribute__((__bounded__(__string__, 2, 3)));
23 void SFVFinal(uint8_t *, SFV_CTX *)
24 	__attribute__((__bounded__(__minbytes__, 1, SFV_DIGEST_LENGTH)));
25 char *SFVEnd(SFV_CTX *, char *)
26 	__attribute__((__bounded__(__minbytes__, 2, SFV_DIGEST_STRING_LENGTH)));
27 char *SFVFile(const char *, char *)
28 	__attribute__((__bounded__(__minbytes__, 2, SFV_DIGEST_STRING_LENGTH)));
29 char *SFVFileChunk(const char *, char *, off_t, off_t)
30 	__attribute__((__bounded__(__minbytes__, 2, SFV_DIGEST_STRING_LENGTH)));
31 char *SFVData(const uint8_t *, size_t, char *)
32 	__attribute__((__bounded__(__string__, 1, 2)))
33 	__attribute__((__bounded__(__minbytes__, 3, SFV_DIGEST_STRING_LENGTH)));
34 __END_DECLS
35 
36 #endif
37