Remove __P macros from src/usr.bin and src/usr.sbin.
[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 $ */
2d8a3be7 2/* $DragonFly: src/usr.sbin/pkg_install/sign/Attic/extern.h,v 1.3 2003/11/03 19:31:39 eirikn 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 */
2d8a3be7 49extern int read_header_and_diagnose(FILE *file, \
984263bc 50 /*@out@*/struct mygzip_header *h, /*@null@*/struct signature **sign, \
2d8a3be7
EN
51 const char *filename);
52extern int reap(pid_t pid);
984263bc
MD
53
54/* sign.c */
2d8a3be7
EN
55extern int sign(/*@observer@*/const char *filename, int type, \
56 /*@null@*/const char *userid, char *envp[]);
984263bc
MD
57
58/* check.c */
2d8a3be7 59extern int check_signature(/*@dependent@*/FILE *file, \
984263bc 60 /*@null@*/const char *userid, char *envp[], \
2d8a3be7 61 /*@observer@*/const char *filename);
984263bc
MD
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
2d8a3be7 76extern void *new_sha1_checker(struct mygzip_header *h, \
984263bc 77 struct signature *sign, const char *userid, char *envp[], \
2d8a3be7 78 const char *filename);
984263bc 79
2d8a3be7
EN
80extern void sha1_add(void *arg, const char *buffer, \
81 size_t length);
984263bc 82
2d8a3be7 83extern int sha1_sign_ok(void *arg);
984263bc 84
2d8a3be7
EN
85extern int retrieve_sha1_marker(const char *filename, \
86 struct signature **sign, const char *userid);
984263bc
MD
87
88/* x509.c */
89#define X509_DB_NAME "/var/db/pkg/X509"
90
2d8a3be7 91extern void *new_x509_checker(struct mygzip_header *h, \
984263bc 92 struct signature *sign, const char *userid, char *envp[], \
2d8a3be7 93 const char *filename);
984263bc 94
2d8a3be7
EN
95extern void x509_add(void *arg, const char *buffer, \
96 size_t length);
984263bc 97
2d8a3be7 98extern int x509_sign_ok(void *arg);
984263bc 99
2d8a3be7
EN
100extern int retrieve_x509_marker(const char *filename, \
101 struct signature **sign, const char *userid);