Coverage Report

Created: 2024-02-29 06:05

/src/strongswan/src/libstrongswan/crypto/transform.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (C) 2006-2009 Martin Willi
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 <crypto/transform.h>
18
#include <crypto/hashers/hasher.h>
19
#include <crypto/rngs/rng.h>
20
#include <crypto/kdfs/kdf.h>
21
22
ENUM_BEGIN(transform_type_names, ENCRYPTION_ALGORITHM, EXTENDED_SEQUENCE_NUMBERS,
23
  "ENCRYPTION_ALGORITHM",
24
  "PSEUDO_RANDOM_FUNCTION",
25
  "INTEGRITY_ALGORITHM",
26
  "KEY_EXCHANGE_METHOD",
27
  "EXTENDED_SEQUENCE_NUMBERS");
28
ENUM_NEXT(transform_type_names, HASH_ALGORITHM, KEY_DERIVATION_FUNCTION,
29
      EXTENDED_SEQUENCE_NUMBERS,
30
  "HASH_ALGORITHM",
31
  "RANDOM_NUMBER_GENERATOR",
32
  "AEAD_ALGORITHM",
33
  "COMPRESSION_ALGORITHM",
34
  "EXTENDED OUTPUT FUNCTION",
35
  "DETERMINISTIC RANDOM BIT GENERATOR",
36
  "KEY_DERIVATION_FUNCTION");
37
ENUM_END(transform_type_names, KEY_DERIVATION_FUNCTION);
38
39
ENUM(extended_sequence_numbers_names, NO_EXT_SEQ_NUMBERS, EXT_SEQ_NUMBERS,
40
  "NO_EXT_SEQ",
41
  "EXT_SEQ",
42
);
43
44
/**
45
 * See header
46
 */
47
enum_name_t* transform_get_enum_names(transform_type_t type)
48
0
{
49
0
  switch (type)
50
0
  {
51
0
    case HASH_ALGORITHM:
52
0
      return hash_algorithm_names;
53
0
    case RANDOM_NUMBER_GENERATOR:
54
0
      return rng_quality_names;
55
0
    case AEAD_ALGORITHM:
56
0
    case ENCRYPTION_ALGORITHM:
57
0
      return encryption_algorithm_names;
58
0
    case PSEUDO_RANDOM_FUNCTION:
59
0
      return pseudo_random_function_names;
60
0
    case INTEGRITY_ALGORITHM:
61
0
      return integrity_algorithm_names;
62
0
    case KEY_EXCHANGE_METHOD:
63
0
      return key_exchange_method_names;
64
0
    case EXTENDED_SEQUENCE_NUMBERS:
65
0
      return extended_sequence_numbers_names;
66
0
    case EXTENDED_OUTPUT_FUNCTION:
67
0
      return ext_out_function_names;
68
0
    case DETERMINISTIC_RANDOM_BIT_GENERATOR:
69
0
      return drbg_type_names;
70
0
    case KEY_DERIVATION_FUNCTION:
71
0
      return key_derivation_function_names;
72
0
    case COMPRESSION_ALGORITHM:
73
0
      break;
74
0
  }
75
0
  return NULL;
76
0
}