File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / strongswan / src / libstrongswan / crypto / transform.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Jun 3 09:46:44 2020 UTC (4 years, 2 months ago) by misho
Branches: strongswan, MAIN
CVS tags: v5_9_2p0, v5_8_4p7, HEAD
Strongswan

    1: /*
    2:  * Copyright (C) 2006-2009 Martin Willi
    3:  * HSR Hochschule fuer Technik Rapperswil
    4:  *
    5:  * This program is free software; you can redistribute it and/or modify it
    6:  * under the terms of the GNU General Public License as published by the
    7:  * Free Software Foundation; either version 2 of the License, or (at your
    8:  * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
    9:  *
   10:  * This program is distributed in the hope that it will be useful, but
   11:  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   12:  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   13:  * for more details.
   14:  */
   15: 
   16: #include <crypto/transform.h>
   17: #include <crypto/hashers/hasher.h>
   18: #include <crypto/rngs/rng.h>
   19: 
   20: ENUM_BEGIN(transform_type_names, ENCRYPTION_ALGORITHM, EXTENDED_SEQUENCE_NUMBERS,
   21: 	"ENCRYPTION_ALGORITHM",
   22: 	"PSEUDO_RANDOM_FUNCTION",
   23: 	"INTEGRITY_ALGORITHM",
   24: 	"DIFFIE_HELLMAN_GROUP",
   25: 	"EXTENDED_SEQUENCE_NUMBERS");
   26: ENUM_NEXT(transform_type_names, HASH_ALGORITHM, DETERMINISTIC_RANDOM_BIT_GENERATOR,
   27: 		  EXTENDED_SEQUENCE_NUMBERS,
   28: 	"HASH_ALGORITHM",
   29: 	"RANDOM_NUMBER_GENERATOR",
   30: 	"AEAD_ALGORITHM",
   31: 	"COMPRESSION_ALGORITHM",
   32: 	"EXTENDED OUTPUT FUNCTION",
   33: 	"DETERMINISTIC RANDOM BIT GENERATOR");
   34: ENUM_END(transform_type_names, DETERMINISTIC_RANDOM_BIT_GENERATOR);
   35: 
   36: 
   37: ENUM(extended_sequence_numbers_names, NO_EXT_SEQ_NUMBERS, EXT_SEQ_NUMBERS,
   38: 	"NO_EXT_SEQ",
   39: 	"EXT_SEQ",
   40: );
   41: 
   42: /**
   43:  * See header
   44:  */
   45: enum_name_t* transform_get_enum_names(transform_type_t type)
   46: {
   47: 	switch (type)
   48: 	{
   49: 		case HASH_ALGORITHM:
   50: 			return hash_algorithm_names;
   51: 		case RANDOM_NUMBER_GENERATOR:
   52: 			return rng_quality_names;
   53: 		case AEAD_ALGORITHM:
   54: 		case ENCRYPTION_ALGORITHM:
   55: 			return encryption_algorithm_names;
   56: 		case PSEUDO_RANDOM_FUNCTION:
   57: 			return pseudo_random_function_names;
   58: 		case INTEGRITY_ALGORITHM:
   59: 			return integrity_algorithm_names;
   60: 		case DIFFIE_HELLMAN_GROUP:
   61: 			return diffie_hellman_group_names;
   62: 		case EXTENDED_SEQUENCE_NUMBERS:
   63: 			return extended_sequence_numbers_names;
   64: 		case EXTENDED_OUTPUT_FUNCTION:
   65: 			return ext_out_function_names;
   66: 		case DETERMINISTIC_RANDOM_BIT_GENERATOR:
   67: 			return drbg_type_names;
   68: 		case COMPRESSION_ALGORITHM:
   69: 			break;
   70: 	}
   71: 	return NULL;
   72: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>