1/*-
2 * Copyright (c) 2012-2020 Alistair Crooks <agc@NetBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25#ifndef NETPGP_VERIFY_H_
26#define NETPGP_VERIFY_H_	20201101
27
28#define NETPGPVERIFY_VERSION	"netpgpverify portable 20201101"
29
30#include <sys/types.h>
31
32#include <inttypes.h>
33
34struct pgpv_t;
35typedef struct pgpv_t	pgpv_t;
36
37struct pgpv_cursor_t;
38typedef struct pgpv_cursor_t	pgpv_cursor_t;
39
40#ifndef __BEGIN_DECLS
41#  if defined(__cplusplus)
42#  define __BEGIN_DECLS           extern "C" {
43#  define __END_DECLS             }
44#  else
45#  define __BEGIN_DECLS
46#  define __END_DECLS
47#  endif
48#endif
49
50__BEGIN_DECLS
51
52pgpv_t *pgpv_new(void);
53pgpv_cursor_t *pgpv_new_cursor(void);
54
55int pgpv_read_pubring(pgpv_t */*pgp*/, const void */*keyringfile/mem*/, ssize_t /*size*/);
56int pgpv_read_ssh_pubkeys(pgpv_t */*pgp*/, const void */*keyring*/, ssize_t /*size*/);
57
58size_t pgpv_verify(pgpv_cursor_t */*cursor*/, pgpv_t */*pgp*/, const void */*mem/file*/, ssize_t /*size*/);
59size_t pgpv_get_verified(pgpv_cursor_t */*cursor*/, size_t /*cookie*/, char **/*ret*/);
60size_t pgpv_dump(pgpv_t */*pgp*/, char **/*data*/);
61
62size_t pgpv_get_entry(pgpv_t */*pgp*/, unsigned /*ent*/, char **/*ret*/, const char */*modifiers*/);
63
64int64_t pgpv_get_cursor_num(pgpv_cursor_t */*cursor*/, const char */*field*/);
65char *pgpv_get_cursor_str(pgpv_cursor_t */*cursor*/, const char */*field*/);
66int pgpv_get_cursor_element(pgpv_cursor_t */*cursor*/, size_t /*element*/);
67
68int pgpv_close(pgpv_t */*pgp*/);
69int pgpv_cursor_close(pgpv_cursor_t */*cursor*/);
70
71__END_DECLS
72
73#endif
74