Annotation of embedaddon/strongswan/src/libstrongswan/crypto/prfs/prf.c, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2018 Tobias Brunner
3: * Copyright (C) 2005-2006 Martin Willi
4: * Copyright (C) 2005 Jan Hutter
5: * HSR Hochschule fuer Technik Rapperswil
6: *
7: * This program is free software; you can redistribute it and/or modify it
8: * under the terms of the GNU General Public License as published by the
9: * Free Software Foundation; either version 2 of the License, or (at your
10: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11: *
12: * This program is distributed in the hope that it will be useful, but
13: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15: * for more details.
16: */
17:
18: #include "prf.h"
19:
20: #include <asn1/oid.h>
21:
22: ENUM_BEGIN(pseudo_random_function_names, PRF_UNDEFINED, PRF_CAMELLIA128_XCBC,
23: "PRF_UNDEFINED",
24: "PRF_FIPS_SHA1_160",
25: "PRF_FIPS_DES",
26: "PRF_KEYED_SHA1",
27: "PRF_CAMELLIA128_XCBC");
28: ENUM_NEXT(pseudo_random_function_names, PRF_HMAC_MD5, PRF_AES128_CMAC, PRF_CAMELLIA128_XCBC,
29: "PRF_HMAC_MD5",
30: "PRF_HMAC_SHA1",
31: "PRF_HMAC_TIGER",
32: "PRF_AES128_XCBC",
33: "PRF_HMAC_SHA2_256",
34: "PRF_HMAC_SHA2_384",
35: "PRF_HMAC_SHA2_512",
36: "PRF_AES128_CMAC");
37: ENUM_END(pseudo_random_function_names, PRF_AES128_CMAC);
38:
39: /*
40: * Described in header.
41: */
42: pseudo_random_function_t pseudo_random_function_from_oid(int oid)
43: {
44: switch (oid)
45: {
46: case OID_HMAC_SHA1:
47: return PRF_HMAC_SHA1;
48: case OID_HMAC_SHA256:
49: return PRF_HMAC_SHA2_256;
50: case OID_HMAC_SHA384:
51: return PRF_HMAC_SHA2_384;
52: case OID_HMAC_SHA512:
53: return PRF_HMAC_SHA2_512;
54: case OID_HMAC_SHA224:
55: case OID_HMAC_SHA512_224:
56: case OID_HMAC_SHA512_256:
57: default:
58: return PRF_UNDEFINED;
59: }
60: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>