Coverage Report

Created: 2026-08-31 06:58

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/strongswan/src/libstrongswan/plugins/sshkey/sshkey_plugin.c
Line
Count
Source
1
/*
2
 * Copyright (C) 2013-2014 Tobias Brunner
3
 *
4
 * Copyright (C) secunet Security Networks AG
5
 *
6
 * This program is free software; you can redistribute it and/or modify it
7
 * under the terms of the GNU General Public License as published by the
8
 * Free Software Foundation; either version 2 of the License, or (at your
9
 * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
10
 *
11
 * This program is distributed in the hope that it will be useful, but
12
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14
 * for more details.
15
 */
16
17
#include "sshkey_plugin.h"
18
19
#include <library.h>
20
#include "sshkey_builder.h"
21
#include "sshkey_encoder.h"
22
23
typedef struct private_sshkey_plugin_t private_sshkey_plugin_t;
24
25
/**
26
 * private data of sshkey_plugin
27
 */
28
struct private_sshkey_plugin_t {
29
30
  /**
31
   * public functions
32
   */
33
  sshkey_plugin_t public;
34
};
35
36
METHOD(plugin_t, get_name, char*,
37
  private_sshkey_plugin_t *this)
38
0
{
39
0
  return "sshkey";
40
0
}
41
42
METHOD(plugin_t, get_features, int,
43
  private_sshkey_plugin_t *this, plugin_feature_t *features[])
44
0
{
45
0
  static plugin_feature_t f[] = {
46
0
    PLUGIN_REGISTER(PUBKEY, sshkey_public_key_load, FALSE),
47
0
      PLUGIN_PROVIDE(PUBKEY, KEY_ANY),
48
0
    PLUGIN_REGISTER(CERT_DECODE, sshkey_certificate_load, FALSE),
49
0
      PLUGIN_PROVIDE(CERT_DECODE, CERT_TRUSTED_PUBKEY),
50
0
  };
51
0
  *features = f;
52
0
  return countof(f);
53
0
}
54
55
METHOD(plugin_t, destroy, void,
56
  private_sshkey_plugin_t *this)
57
0
{
58
0
  lib->encoding->remove_encoder(lib->encoding, sshkey_encoder_encode);
59
0
  free(this);
60
0
}
61
62
/*
63
 * see header file
64
 */
65
PLUGIN_DEFINE(sshkey)
66
0
{
67
0
  private_sshkey_plugin_t *this;
68
69
0
  INIT(this,
70
0
    .public = {
71
0
      .plugin = {
72
0
        .get_name = _get_name,
73
0
        .get_features = _get_features,
74
0
        .destroy = _destroy,
75
0
      },
76
0
    },
77
0
  );
78
0
  lib->encoding->add_encoder(lib->encoding, sshkey_encoder_encode);
79
80
0
  return &this->public.plugin;
81
0
}