Coverage Report

Created: 2026-08-14 06:46

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/strongswan/src/libstrongswan/plugins/sha1/sha1_plugin.c
Line
Count
Source
1
/*
2
 * Copyright (C) 2008 Martin Willi
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 "sha1_plugin.h"
16
17
#include <library.h>
18
#include "sha1_hasher.h"
19
#include "sha1_prf.h"
20
21
typedef struct private_sha1_plugin_t private_sha1_plugin_t;
22
23
/**
24
 * private data of sha1_plugin
25
 */
26
struct private_sha1_plugin_t {
27
28
  /**
29
   * public functions
30
   */
31
  sha1_plugin_t public;
32
};
33
34
METHOD(plugin_t, get_name, char*,
35
  private_sha1_plugin_t *this)
36
96.6k
{
37
96.6k
  return "sha1";
38
96.6k
}
39
40
METHOD(plugin_t, get_features, int,
41
  private_sha1_plugin_t *this, plugin_feature_t *features[])
42
12.0k
{
43
12.0k
  static plugin_feature_t f[] = {
44
12.0k
    PLUGIN_REGISTER(HASHER, sha1_hasher_create),
45
12.0k
      PLUGIN_PROVIDE(HASHER, HASH_SHA1),
46
12.0k
    PLUGIN_REGISTER(PRF, sha1_prf_create),
47
12.0k
      PLUGIN_PROVIDE(PRF, PRF_KEYED_SHA1),
48
12.0k
  };
49
12.0k
  *features = f;
50
12.0k
  return countof(f);
51
12.0k
}
52
53
METHOD(plugin_t, destroy, void,
54
  private_sha1_plugin_t *this)
55
12.0k
{
56
12.0k
  free(this);
57
12.0k
}
58
59
/*
60
 * see header file
61
 */
62
PLUGIN_DEFINE(sha1)
63
12.0k
{
64
12.0k
  private_sha1_plugin_t *this;
65
66
12.0k
  INIT(this,
67
12.0k
    .public = {
68
12.0k
      .plugin = {
69
12.0k
        .get_name = _get_name,
70
12.0k
        .get_features = _get_features,
71
12.0k
        .destroy = _destroy,
72
12.0k
      },
73
12.0k
    },
74
12.0k
  );
75
76
12.0k
  return &this->public.plugin;
77
12.0k
}
78