blob: 3ad1a992a758fc9339baa2cecc17ac14af359f1b [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];
Linus Torvaldsc38138c2005-06-26 20:27:56 -070010 unsigned char buffer[8192];
11};
12
Linus Torvalds4397f012005-06-28 11:10:06 -070013extern struct sha1file *sha1fd(int fd, const char *name);
Timo Sirainen4ec99bf2005-08-09 18:30:22 +030014extern struct sha1file *sha1create(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
Linus Torvaldse1808842005-06-26 22:01:46 -070015extern int sha1close(struct sha1file *, unsigned char *, int);
Linus Torvaldsc38138c2005-06-26 20:27:56 -070016extern int sha1write(struct sha1file *, void *, unsigned int);
17extern int sha1write_compressed(struct sha1file *, void *, unsigned int);
18
19#endif