summaryrefslogtreecommitdiff
path: root/src/libstrongswan/crypto/xofs/xof.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@corsac.net>2017-11-21 10:22:31 +0100
committerYves-Alexis Perez <corsac@corsac.net>2017-11-21 10:22:31 +0100
commite1d78dc2faaa06e7c3f71ef674a71e4de2f0758e (patch)
treeae0c8b5f4cd8289d0797882ea18969f33ea59a1e /src/libstrongswan/crypto/xofs/xof.c
parent11d6b62db969bdd808d0f56706cb18f113927a31 (diff)
downloadvyos-strongswan-e1d78dc2faaa06e7c3f71ef674a71e4de2f0758e.tar.gz
vyos-strongswan-e1d78dc2faaa06e7c3f71ef674a71e4de2f0758e.zip
New upstream version 5.6.1
Diffstat (limited to 'src/libstrongswan/crypto/xofs/xof.c')
-rw-r--r--src/libstrongswan/crypto/xofs/xof.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/libstrongswan/crypto/xofs/xof.c b/src/libstrongswan/crypto/xofs/xof.c
index 1e9c2834b..2b866ae5b 100644
--- a/src/libstrongswan/crypto/xofs/xof.c
+++ b/src/libstrongswan/crypto/xofs/xof.c
@@ -1,4 +1,5 @@
/*
+ * Copyright (C) 2017 Tobias Brunner
* Copyright (C) 2016 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
@@ -18,10 +19,42 @@
ENUM(ext_out_function_names, XOF_UNDEFINED, XOF_CHACHA20,
"XOF_UNDEFINED",
"XOF_MGF1_SHA1",
+ "XOF_MGF1_SHA224",
"XOF_MGF1_SHA256",
+ "XOF_MGF1_SHA384",
"XOF_MGF1_SHA512",
"XOF_SHAKE128",
"XOF_SHAKE256",
"XOF_CHACHA20"
);
+/*
+ * Described in header
+ */
+ext_out_function_t xof_mgf1_from_hash_algorithm(hash_algorithm_t alg)
+{
+ switch (alg)
+ {
+ case HASH_SHA1:
+ return XOF_MGF1_SHA1;
+ case HASH_SHA224:
+ return XOF_MGF1_SHA224;
+ case HASH_SHA256:
+ return XOF_MGF1_SHA256;
+ case HASH_SHA384:
+ return XOF_MGF1_SHA384;
+ case HASH_SHA512:
+ return XOF_MGF1_SHA512;
+ case HASH_IDENTITY:
+ case HASH_UNKNOWN:
+ case HASH_MD2:
+ case HASH_MD4:
+ case HASH_MD5:
+ case HASH_SHA3_224:
+ case HASH_SHA3_256:
+ case HASH_SHA3_384:
+ case HASH_SHA3_512:
+ break;
+ }
+ return XOF_UNDEFINED;
+}