fixed pts_probe_dh_groups warning
[strongswan.git] / src / libpts / libpts.c
1 /*
2 * Copyright (C) 2011 Andreas Steffen, HSR Hochschule fuer Technik Rapperswil
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 */
14
15 #include "libpts.h"
16 #include "tcg/tcg_attr.h"
17
18 #include <imcv.h>
19
20 #include <debug.h>
21
22 /**
23 * Reference count for IMC/IMV instances
24 */
25 static refcount_t libpts_ref = 0;
26
27 /**
28 * Described in header.
29 */
30 bool libpts_init(void)
31 {
32 if (libpts_ref == 0)
33 {
34 if (!imcv_pa_tnc_attributes)
35 {
36 return FALSE;
37 }
38 imcv_pa_tnc_attributes->add_vendor(imcv_pa_tnc_attributes, PEN_TCG,
39 tcg_attr_create_from_data, tcg_attr_names);
40 DBG1(DBG_LIB, "libpts initialized");
41 }
42 ref_get(&libpts_ref);
43
44 return TRUE;
45 }
46
47 /**
48 * Described in header.
49 */
50 void libpts_deinit(void)
51 {
52 if (ref_put(&libpts_ref))
53 {
54 if (!imcv_pa_tnc_attributes)
55 {
56 return;
57 }
58 imcv_pa_tnc_attributes->remove_vendor(imcv_pa_tnc_attributes, PEN_TCG);
59 DBG1(DBG_LIB, "libpts terminated");
60 }
61 }
62