Add some missing $DragonFly$ keywords.
[dragonfly.git] / usr.sbin / pkg_install / sign / extern.h
CommitLineData
984263bc 1/* $FreeBSD: src/usr.sbin/pkg_install/sign/extern.h,v 1.1.2.2 2001/05/17 12:33:39 sobomax Exp $ */
1de703da 2/* $DragonFly: src/usr.sbin/pkg_install/sign/Attic/extern.h,v 1.2 2003/06/17 04:29:59 dillon Exp $ */
984263bc
MD
3/* $OpenBSD: extern.h,v 1.3 1999/10/07 16:30:32 espie Exp $ */
4/*-
5 * Copyright (c) 1999 Marc Espie.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Marc Espie for the OpenBSD
18 * Project.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBSD
24 * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33/*
34 * Convention: all functions that operate on a FILE * also take a filename
35 * for diagnostic purposes. The file can be connected to a pipe, so
36 * - don't rewind
37 * - don't reopen from filename.
38 */
39
40struct mygzip_header;
41struct signature;
42
43/* main.c */
44extern int verbose;
45extern int quiet;
46extern char *userkey;
47
48/* common.c */
49extern int read_header_and_diagnose __P((FILE *file, \
50 /*@out@*/struct mygzip_header *h, /*@null@*/struct signature **sign, \
51 const char *filename));
52extern int reap __P((pid_t pid));
53
54/* sign.c */
55extern int sign __P((/*@observer@*/const char *filename, int type, \
56 /*@null@*/const char *userid, char *envp[]));
57
58/* check.c */
59extern int check_signature __P((/*@dependent@*/FILE *file, \
60 /*@null@*/const char *userid, char *envp[], \
61 /*@observer@*/const char *filename));
62
63#define PKG_BADSIG 0
64#define PKG_GOODSIG 1
65#define PKG_UNSIGNED 2
66#define PKG_SIGNED 4
67#define PKG_SIGERROR 8
68#define PKG_SIGUNKNOWN 16
69
70typedef /*@observer@*/char *pchar;
71
72#define MAXID 512
73/* sha1.c */
74#define SHA1_DB_NAME "/var/db/pkg/SHA1"
75
76extern void *new_sha1_checker __P((struct mygzip_header *h, \
77 struct signature *sign, const char *userid, char *envp[], \
78 const char *filename));
79
80extern void sha1_add __P((void *arg, const char *buffer, \
81 size_t length));
82
83extern int sha1_sign_ok __P((void *arg));
84
85extern int retrieve_sha1_marker __P((const char *filename, \
86 struct signature **sign, const char *userid));
87
88/* x509.c */
89#define X509_DB_NAME "/var/db/pkg/X509"
90
91extern void *new_x509_checker __P((struct mygzip_header *h, \
92 struct signature *sign, const char *userid, char *envp[], \
93 const char *filename));
94
95extern void x509_add __P((void *arg, const char *buffer, \
96 size_t length));
97
98extern int x509_sign_ok __P((void *arg));
99
100extern int retrieve_x509_marker __P((const char *filename, \
101 struct signature **sign, const char *userid));