blob: c3c792f1b56026b6a4d9d10b6ba63947c7f383cf [file] [log] [blame]
Linus Torvaldsc38138c2005-06-26 20:27:56 -07001#ifndef CSUM_FILE_H
2#define CSUM_FILE_H
3
4/* A SHA1-protected file */
5struct sha1file {
6 int fd, error;
Linus Torvaldse1808842005-06-26 22:01:46 -07007 unsigned int offset, namelen;
Linus Torvaldsc38138c2005-06-26 20:27:56 -07008 SHA_CTX ctx;
Linus Torvaldse1808842005-06-26 22:01:46 -07009 char name[PATH_MAX];
Nicolas Pitre78d1e842007-04-09 01:06:31 -040010 int do_crc;
11 uint32_t crc32;
Linus Torvaldsc38138c2005-06-26 20:27:56 -070012 unsigned char buffer[8192];
13};
14
Linus Torvalds4397f012005-06-28 11:10:06 -070015extern struct sha1file *sha1fd(int fd, const char *name);
Linus Torvaldse1808842005-06-26 22:01:46 -070016extern int sha1close(struct sha1file *, unsigned char *, int);
Linus Torvaldsc38138c2005-06-26 20:27:56 -070017extern int sha1write(struct sha1file *, void *, unsigned int);
Nicolas Pitre78d1e842007-04-09 01:06:31 -040018extern void crc32_begin(struct sha1file *);
19extern uint32_t crc32_end(struct sha1file *);
Linus Torvaldsc38138c2005-06-26 20:27:56 -070020
21#endif