1 /* $FreeBSD: src/usr.sbin/pkg_install/sign/extern.h,v 1.1.2.2 2001/05/17 12:33:39 sobomax Exp $ */
2 /* $OpenBSD: extern.h,v 1.3 1999/10/07 16:30:32 espie Exp $ */
4 * Copyright (c) 1999 Marc Espie.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by Marc Espie for the OpenBSD
19 * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBSD
23 * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 * Convention: all functions that operate on a FILE * also take a filename
34 * for diagnostic purposes. The file can be connected to a pipe, so
36 * - don't reopen from filename.
48 extern int read_header_and_diagnose __P((FILE *file, \
49 /*@out@*/struct mygzip_header *h, /*@null@*/struct signature **sign, \
50 const char *filename));
51 extern int reap __P((pid_t pid));
54 extern int sign __P((/*@observer@*/const char *filename, int type, \
55 /*@null@*/const char *userid, char *envp[]));
58 extern int check_signature __P((/*@dependent@*/FILE *file, \
59 /*@null@*/const char *userid, char *envp[], \
60 /*@observer@*/const char *filename));
64 #define PKG_UNSIGNED 2
66 #define PKG_SIGERROR 8
67 #define PKG_SIGUNKNOWN 16
69 typedef /*@observer@*/char *pchar;
73 #define SHA1_DB_NAME "/var/db/pkg/SHA1"
75 extern void *new_sha1_checker __P((struct mygzip_header *h, \
76 struct signature *sign, const char *userid, char *envp[], \
77 const char *filename));
79 extern void sha1_add __P((void *arg, const char *buffer, \
82 extern int sha1_sign_ok __P((void *arg));
84 extern int retrieve_sha1_marker __P((const char *filename, \
85 struct signature **sign, const char *userid));
88 #define X509_DB_NAME "/var/db/pkg/X509"
90 extern void *new_x509_checker __P((struct mygzip_header *h, \
91 struct signature *sign, const char *userid, char *envp[], \
92 const char *filename));
94 extern void x509_add __P((void *arg, const char *buffer, \
97 extern int x509_sign_ok __P((void *arg));
99 extern int retrieve_x509_marker __P((const char *filename, \
100 struct signature **sign, const char *userid));