diff options
author | Yves-Alexis Perez <corsac@debian.org> | 2018-06-04 09:59:21 +0200 |
---|---|---|
committer | Yves-Alexis Perez <corsac@debian.org> | 2018-06-04 09:59:21 +0200 |
commit | 9207a0837c19c2f1bf9486d1621438693841039f (patch) | |
tree | c5b31310d6d5b8db2904a3309c5c4ee81e7584f2 /src/libstrongswan/crypto/prfs | |
parent | 3456101fa5dfd78d8b74c005b8dad281bb045398 (diff) | |
parent | 51a71ee15c1bcf0e82f363a16898f571e211f9c3 (diff) | |
download | vyos-strongswan-9207a0837c19c2f1bf9486d1621438693841039f.tar.gz vyos-strongswan-9207a0837c19c2f1bf9486d1621438693841039f.zip |
Update upstream source from tag 'upstream/5.6.3'
Update to upstream version '5.6.3'
with Debian dir d2b13199c1ca302286cbf83878342276cb01d710
Diffstat (limited to 'src/libstrongswan/crypto/prfs')
-rw-r--r-- | src/libstrongswan/crypto/prfs/mac_prf.c | 2 | ||||
-rw-r--r-- | src/libstrongswan/crypto/prfs/mac_prf.h | 2 | ||||
-rw-r--r-- | src/libstrongswan/crypto/prfs/prf.c | 27 | ||||
-rw-r--r-- | src/libstrongswan/crypto/prfs/prf.h | 11 |
4 files changed, 38 insertions, 4 deletions
diff --git a/src/libstrongswan/crypto/prfs/mac_prf.c b/src/libstrongswan/crypto/prfs/mac_prf.c index 3f8eb7e5c..8db21df36 100644 --- a/src/libstrongswan/crypto/prfs/mac_prf.c +++ b/src/libstrongswan/crypto/prfs/mac_prf.c @@ -2,7 +2,7 @@ * Copyright (C) 2012 Tobias Brunner * Copyright (C) 2005-2006 Martin Willi * Copyright (C) 2005 Jan Hutter - * Hochschule fuer Technik Rapperswil + * HSR Hochschule fuer Technik Rapperswil * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/src/libstrongswan/crypto/prfs/mac_prf.h b/src/libstrongswan/crypto/prfs/mac_prf.h index 4ff925b04..0c1dda6f5 100644 --- a/src/libstrongswan/crypto/prfs/mac_prf.h +++ b/src/libstrongswan/crypto/prfs/mac_prf.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2012 Tobias Brunner - * Hochschule fuer Technik Rapperswil + * HSR Hochschule fuer Technik Rapperswil * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the diff --git a/src/libstrongswan/crypto/prfs/prf.c b/src/libstrongswan/crypto/prfs/prf.c index 12e13ef57..eee09535d 100644 --- a/src/libstrongswan/crypto/prfs/prf.c +++ b/src/libstrongswan/crypto/prfs/prf.c @@ -1,7 +1,8 @@ /* + * Copyright (C) 2018 Tobias Brunner * Copyright (C) 2005-2006 Martin Willi * Copyright (C) 2005 Jan Hutter - * Hochschule fuer Technik Rapperswil + * HSR Hochschule fuer Technik Rapperswil * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -16,6 +17,8 @@ #include "prf.h" +#include <asn1/oid.h> + ENUM_BEGIN(pseudo_random_function_names, PRF_UNDEFINED, PRF_CAMELLIA128_XCBC, "PRF_UNDEFINED", "PRF_FIPS_SHA1_160", @@ -33,3 +36,25 @@ ENUM_NEXT(pseudo_random_function_names, PRF_HMAC_MD5, PRF_AES128_CMAC, PRF_CAMEL "PRF_AES128_CMAC"); ENUM_END(pseudo_random_function_names, PRF_AES128_CMAC); +/* + * Described in header. + */ +pseudo_random_function_t pseudo_random_function_from_oid(int oid) +{ + switch (oid) + { + case OID_HMAC_SHA1: + return PRF_HMAC_SHA1; + case OID_HMAC_SHA256: + return PRF_HMAC_SHA2_256; + case OID_HMAC_SHA384: + return PRF_HMAC_SHA2_384; + case OID_HMAC_SHA512: + return PRF_HMAC_SHA2_512; + case OID_HMAC_SHA224: + case OID_HMAC_SHA512_224: + case OID_HMAC_SHA512_256: + default: + return PRF_UNDEFINED; + } +} diff --git a/src/libstrongswan/crypto/prfs/prf.h b/src/libstrongswan/crypto/prfs/prf.h index fe9ffc2dd..a91de1ddc 100644 --- a/src/libstrongswan/crypto/prfs/prf.h +++ b/src/libstrongswan/crypto/prfs/prf.h @@ -1,7 +1,8 @@ /* + * Copyright (C) 2018 Tobias Brunner * Copyright (C) 2005-2006 Martin Willi * Copyright (C) 2005 Jan Hutter - * Hochschule fuer Technik Rapperswil + * HSR Hochschule fuer Technik Rapperswil * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -125,4 +126,12 @@ struct prf_t { void (*destroy)(prf_t *this); }; +/** + * Conversion of ASN.1 OID to PRF algorithm. + * + * @param oid ASN.1 OID + * @return encryption algorithm, PRF_UNDEFINED if OID unsupported + */ +pseudo_random_function_t pseudo_random_function_from_oid(int oid); + #endif /** PRF_H_ @}*/ |