Linus Torvalds | c38138c | 2005-06-26 20:27:56 -0700 | [diff] [blame] | 1 | #ifndef CSUM_FILE_H |
| 2 | #define CSUM_FILE_H |
| 3 | |
| 4 | /* A SHA1-protected file */ |
| 5 | struct sha1file { |
| 6 | int fd, error; |
Linus Torvalds | e180884 | 2005-06-26 22:01:46 -0700 | [diff] [blame] | 7 | unsigned int offset, namelen; |
Linus Torvalds | c38138c | 2005-06-26 20:27:56 -0700 | [diff] [blame] | 8 | SHA_CTX ctx; |
Linus Torvalds | e180884 | 2005-06-26 22:01:46 -0700 | [diff] [blame] | 9 | char name[PATH_MAX]; |
Nicolas Pitre | 78d1e84 | 2007-04-09 01:06:31 -0400 | [diff] [blame] | 10 | int do_crc; |
| 11 | uint32_t crc32; |
Linus Torvalds | c38138c | 2005-06-26 20:27:56 -0700 | [diff] [blame] | 12 | unsigned char buffer[8192]; |
| 13 | }; |
| 14 | |
Linus Torvalds | 4397f01 | 2005-06-28 11:10:06 -0700 | [diff] [blame] | 15 | extern struct sha1file *sha1fd(int fd, const char *name); |
Timo Sirainen | 4ec99bf | 2005-08-09 18:30:22 +0300 | [diff] [blame] | 16 | extern struct sha1file *sha1create(const char *fmt, ...) __attribute__((format (printf, 1, 2))); |
Linus Torvalds | e180884 | 2005-06-26 22:01:46 -0700 | [diff] [blame] | 17 | extern int sha1close(struct sha1file *, unsigned char *, int); |
Linus Torvalds | c38138c | 2005-06-26 20:27:56 -0700 | [diff] [blame] | 18 | extern int sha1write(struct sha1file *, void *, unsigned int); |
| 19 | extern int sha1write_compressed(struct sha1file *, void *, unsigned int); |
Nicolas Pitre | 78d1e84 | 2007-04-09 01:06:31 -0400 | [diff] [blame] | 20 | extern void crc32_begin(struct sha1file *); |
| 21 | extern uint32_t crc32_end(struct sha1file *); |
Linus Torvalds | c38138c | 2005-06-26 20:27:56 -0700 | [diff] [blame] | 22 | |
| 23 | #endif |