1 /* $MirOS: src/include/adler32.h,v 1.2 2013/10/31 20:06:06 tg Exp $ */
2 
3 #ifndef _ADLER32_H
4 #define _ADLER32_H
5 
6 #define ADLER32_DIGEST_LENGTH		4
7 #define ADLER32_DIGEST_STRING_LENGTH	(ADLER32_DIGEST_LENGTH * 2 + 1)
8 
9 typedef uint32_t ADLER32_CTX;
10 
11 #define ADLER32_DIGEST_UPPERCASE
12 
13 #include <sys/cdefs.h>
14 
15 __BEGIN_DECLS
16 void ADLER32Init(ADLER32_CTX *);
17 void ADLER32Update(ADLER32_CTX *, const uint8_t *, size_t)
18 	__attribute__((__bounded__(__string__, 2, 3)));
19 void ADLER32Final(uint8_t *, ADLER32_CTX *)
20 	__attribute__((__bounded__(__minbytes__, 1, ADLER32_DIGEST_LENGTH)));
21 char *ADLER32End(ADLER32_CTX *, char *)
22 	__attribute__((__bounded__(__minbytes__, 2, ADLER32_DIGEST_STRING_LENGTH)));
23 char *ADLER32File(const char *, char *)
24 	__attribute__((__bounded__(__minbytes__, 2, ADLER32_DIGEST_STRING_LENGTH)));
25 char *ADLER32FileChunk(const char *, char *, off_t, off_t)
26 	__attribute__((__bounded__(__minbytes__, 2, ADLER32_DIGEST_STRING_LENGTH)));
27 char *ADLER32Data(const uint8_t *, size_t, char *)
28 	__attribute__((__bounded__(__string__, 1, 2)))
29 	__attribute__((__bounded__(__minbytes__, 3, ADLER32_DIGEST_STRING_LENGTH)));
30 __END_DECLS
31 
32 #endif
33