Return to xof.c CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / strongswan / src / libstrongswan / crypto / xofs |
1.1 misho 1: /* 2: * Copyright (C) 2017 Tobias Brunner 3: * Copyright (C) 2016 Andreas Steffen 4: * HSR Hochschule fuer Technik Rapperswil 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 "xof.h" 18: 19: ENUM(ext_out_function_names, XOF_UNDEFINED, XOF_CHACHA20, 20: "XOF_UNDEFINED", 21: "XOF_MGF1_SHA1", 22: "XOF_MGF1_SHA224", 23: "XOF_MGF1_SHA256", 24: "XOF_MGF1_SHA384", 25: "XOF_MGF1_SHA512", 26: "XOF_SHAKE128", 27: "XOF_SHAKE256", 28: "XOF_CHACHA20" 29: ); 30: 31: /* 32: * Described in header 33: */ 34: ext_out_function_t xof_mgf1_from_hash_algorithm(hash_algorithm_t alg) 35: { 36: switch (alg) 37: { 38: case HASH_SHA1: 39: return XOF_MGF1_SHA1; 40: case HASH_SHA224: 41: return XOF_MGF1_SHA224; 42: case HASH_SHA256: 43: return XOF_MGF1_SHA256; 44: case HASH_SHA384: 45: return XOF_MGF1_SHA384; 46: case HASH_SHA512: 47: return XOF_MGF1_SHA512; 48: case HASH_IDENTITY: 49: case HASH_UNKNOWN: 50: case HASH_MD2: 51: case HASH_MD4: 52: case HASH_MD5: 53: case HASH_SHA3_224: 54: case HASH_SHA3_256: 55: case HASH_SHA3_384: 56: case HASH_SHA3_512: 57: break; 58: } 59: return XOF_UNDEFINED; 60: }