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