signature.h 2.25 KB
Newer Older
Bernhard Link's avatar
Bernhard Link committed
1 2
#ifndef REPREPRO_SIGNATURE_H
#define REPREPRO_SIGNATURE_H
3

Bernhard Link's avatar
Bernhard Link committed
4
#ifndef REPREPRO_ERROR_H
5 6 7 8
#include "error.h"
#warning "What's hapening here?"
#endif

9
/* does not need to be called if allowpassphrase if false,
10
 * argument will only take effect if called the first time */
11
retvalue signature_init(bool allowpassphrase);
12

13 14 15 16 17
struct signature_requirement;
void signature_requirements_free(/*@only@*/struct signature_requirement *);
retvalue signature_requirement_add(struct signature_requirement **, const char *);
void free_known_keys(void);

18
retvalue signature_check(const struct signature_requirement *, const char *, const char *, const char *, size_t);
19
retvalue signature_check_inline(const struct signature_requirement *, const char *, /*@out@*/char **);
20

21

22 23 24 25 26 27 28 29 30
struct signatures {
	int count, validcount;
	struct signature {
		char *keyid;
		char *primary_keyid;
		/* valid is only true if none of the others is true,
		   all may be false due to non-signing keys used for
		   signing or things like that */
		enum signature_state {
31 32 33 34 35 36 37 38 39 40 41 42 43
			/* internal error: */
			sist_error=0,
			/* key missing, can not be checked: */
			sist_missing,
			/* broken signature, content may be corrupt: */
			sist_bad,
			/* good signature, but may not sign or al: */
			sist_invalid,
			/* good signature, but check expire bits: */
			sist_mostly,
			/* good signature, no objections: */
			sist_valid
		} state;
44 45 46 47 48 49 50 51 52
		/* subkey or primary key are expired */
		bool expired_key;
		/* signature is expired */
		bool expired_signature;
		/* key or primary key revoced */
		bool revoced_key;
	} signatures[];
};
void signatures_free(/*@null@*//*@only@*/struct signatures *);
53
/* Read a single chunk from a file, that may be signed. */
54
retvalue signature_readsignedchunk(const char *filename, const char *filenametoshow, char **chunkread, /*@null@*/ /*@out@*/struct signatures **signatures, bool *brokensignature);
55

56
struct signedfile;
57
struct strlist;
58

59
retvalue signature_startsignedfile(/*@out@*/struct signedfile **);
60 61
void signedfile_write(struct signedfile *, const void *, size_t);
/* generate signature in temporary file */
62 63
retvalue signedfile_create(struct signedfile *, const char *, char **, char **, const struct strlist *, bool /*willcleanup*/);
void signedfile_free(/*@only@*/struct signedfile *);
64

65
void signatures_done(void);
66
#endif