mgf1: Add support for SHA-224/384 based MGF1
authorTobias Brunner <tobias@strongswan.org>
Mon, 25 Sep 2017 16:17:54 +0000 (18:17 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 8 Nov 2017 15:48:10 +0000 (16:48 +0100)
src/libstrongswan/plugins/mgf1/mgf1_plugin.c
src/libstrongswan/plugins/mgf1/mgf1_xof.c

index 8df3ac2..a78d2f2 100644 (file)
@@ -44,8 +44,12 @@ METHOD(plugin_t, get_features, int,
                PLUGIN_REGISTER(XOF, mgf1_xof_create),
                        PLUGIN_PROVIDE(XOF, XOF_MGF1_SHA1),
                                PLUGIN_DEPENDS(HASHER, HASH_SHA1),
+                       PLUGIN_PROVIDE(XOF, XOF_MGF1_SHA224),
+                               PLUGIN_DEPENDS(HASHER, HASH_SHA224),
                        PLUGIN_PROVIDE(XOF, XOF_MGF1_SHA256),
                                PLUGIN_DEPENDS(HASHER, HASH_SHA256),
+                       PLUGIN_PROVIDE(XOF, XOF_MGF1_SHA384),
+                               PLUGIN_DEPENDS(HASHER, HASH_SHA384),
                        PLUGIN_PROVIDE(XOF, XOF_MGF1_SHA512),
                                PLUGIN_DEPENDS(HASHER, HASH_SHA512),
        };
index 0f5fda9..8f5a18f 100644 (file)
@@ -244,9 +244,15 @@ mgf1_xof_t *mgf1_xof_create(ext_out_function_t algorithm)
                case XOF_MGF1_SHA1:
                        hash_alg = HASH_SHA1;
                        break;
+               case XOF_MGF1_SHA224:
+                       hash_alg = HASH_SHA224;
+                       break;
                case XOF_MGF1_SHA256:
                        hash_alg = HASH_SHA256;
                        break;
+               case XOF_MGF1_SHA384:
+                       hash_alg = HASH_SHA384;
+                       break;
                case XOF_MGF1_SHA512:
                        hash_alg = HASH_SHA512;
                        break;
@@ -261,7 +267,7 @@ mgf1_xof_t *mgf1_xof_create(ext_out_function_t algorithm)
                         hash_algorithm_names, hash_alg);
                return NULL;
        }
-       
+
        INIT(this,
                .public = {
                        .mgf1_interface = {