1 /* $FreeBSD: src/usr.sbin/pkg_install/sign/extern.h,v 1.1.2.2 2001/05/17 12:33:39 sobomax Exp $ */
2 /* $DragonFly: src/usr.sbin/pkg_install/sign/Attic/extern.h,v 1.3 2003/11/03 19:31:39 eirikn Exp $ */
3 /* $OpenBSD: extern.h,v 1.3 1999/10/07 16:30:32 espie Exp $ */
5 * Copyright (c) 1999 Marc Espie.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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
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.
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
37 * - don't reopen from filename.
49 extern int read_header_and_diagnose(FILE *file, \
50 /*@out@*/struct mygzip_header *h, /*@null@*/struct signature **sign, \
51 const char *filename);
52 extern int reap(pid_t pid);
55 extern int sign(/*@observer@*/const char *filename, int type, \
56 /*@null@*/const char *userid, char *envp[]);
59 extern int check_signature(/*@dependent@*/FILE *file, \
60 /*@null@*/const char *userid, char *envp[], \
61 /*@observer@*/const char *filename);
65 #define PKG_UNSIGNED 2
67 #define PKG_SIGERROR 8
68 #define PKG_SIGUNKNOWN 16
70 typedef /*@observer@*/char *pchar;
74 #define SHA1_DB_NAME "/var/db/pkg/SHA1"
76 extern void *new_sha1_checker(struct mygzip_header *h, \
77 struct signature *sign, const char *userid, char *envp[], \
78 const char *filename);
80 extern void sha1_add(void *arg, const char *buffer, \
83 extern int sha1_sign_ok(void *arg);
85 extern int retrieve_sha1_marker(const char *filename, \
86 struct signature **sign, const char *userid);
89 #define X509_DB_NAME "/var/db/pkg/X509"
91 extern void *new_x509_checker(struct mygzip_header *h, \
92 struct signature *sign, const char *userid, char *envp[], \
93 const char *filename);
95 extern void x509_add(void *arg, const char *buffer, \
98 extern int x509_sign_ok(void *arg);
100 extern int retrieve_x509_marker(const char *filename, \
101 struct signature **sign, const char *userid);