ks_null.c revision 178825
1218585Sjkim/*
2218585Sjkim * Copyright (c) 2005 - 2006 Kungliga Tekniska H�gskolan
3218585Sjkim * (Royal Institute of Technology, Stockholm, Sweden).
4218585Sjkim * All rights reserved.
5218585Sjkim *
6218585Sjkim * Redistribution and use in source and binary forms, with or without
7218585Sjkim * modification, are permitted provided that the following conditions
8278970Sjkim * are met:
9218585Sjkim *
10218585Sjkim * 1. Redistributions of source code must retain the above copyright
11218585Sjkim *    notice, this list of conditions and the following disclaimer.
12218585Sjkim *
13218585Sjkim * 2. Redistributions in binary form must reproduce the above copyright
14218585Sjkim *    notice, this list of conditions and the following disclaimer in the
15218585Sjkim *    documentation and/or other materials provided with the distribution.
16218585Sjkim *
17218585Sjkim * 3. Neither the name of the Institute nor the names of its contributors
18218585Sjkim *    may be used to endorse or promote products derived from this software
19218585Sjkim *    without specific prior written permission.
20218585Sjkim *
21218585Sjkim * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22218585Sjkim * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23218585Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24218585Sjkim * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25218585Sjkim * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26218585Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27218585Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28218585Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29218585Sjkim * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30218585Sjkim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31218585Sjkim * SUCH DAMAGE.
32218585Sjkim */
33218585Sjkim
34218585Sjkim#include "hx_locl.h"
35218585SjkimRCSID("$Id: ks_null.c 20901 2007-06-04 23:14:08Z lha $");
36218585Sjkim
37218585Sjkim
38218585Sjkimstatic int
39218585Sjkimnull_init(hx509_context context,
40218585Sjkim	  hx509_certs certs, void **data, int flags,
41218585Sjkim	  const char *residue, hx509_lock lock)
42218585Sjkim{
43218585Sjkim    *data = NULL;
44218590Sjkim    return 0;
45218590Sjkim}
46218590Sjkim
47218590Sjkimstatic int
48249112Sjkimnull_free(hx509_certs certs, void *data)
49218585Sjkim{
50218585Sjkim    assert(data == NULL);
51218585Sjkim    return 0;
52218585Sjkim}
53218585Sjkim
54218585Sjkimstatic int
55218585Sjkimnull_iter_start(hx509_context context,
56218585Sjkim		hx509_certs certs, void *data, void **cursor)
57218585Sjkim{
58218585Sjkim    *cursor = NULL;
59218585Sjkim    return 0;
60218585Sjkim}
61218585Sjkim
62218585Sjkimstatic int
63218585Sjkimnull_iter(hx509_context context,
64218585Sjkim	  hx509_certs certs, void *data, void *iter, hx509_cert *cert)
65218585Sjkim{
66218585Sjkim    *cert = NULL;
67218585Sjkim    return ENOENT;
68218585Sjkim}
69218585Sjkim
70218585Sjkimstatic int
71218585Sjkimnull_iter_end(hx509_context context,
72218585Sjkim	      hx509_certs certs,
73218585Sjkim	      void *data,
74218585Sjkim	      void *cursor)
75218585Sjkim{
76218585Sjkim    assert(cursor == NULL);
77218585Sjkim    return 0;
78218585Sjkim}
79287168Sjkim
80287168Sjkim
81287168Sjkimstruct hx509_keyset_ops keyset_null = {
82287168Sjkim    "NULL",
83287168Sjkim    0,
84287168Sjkim    null_init,
85287168Sjkim    NULL,
86218585Sjkim    null_free,
87218585Sjkim    NULL,
88218585Sjkim    NULL,
89218585Sjkim    null_iter_start,
90218585Sjkim    null_iter,
91218585Sjkim    null_iter_end
92218585Sjkim};
93218585Sjkim
94218585Sjkimvoid
95218585Sjkim_hx509_ks_null_register(hx509_context context)
96218585Sjkim{
97218585Sjkim    _hx509_ks_register(context, &keyset_null);
98218585Sjkim}
99218585Sjkim