]> git.ipfire.org Git - people/ms/strongswan.git/commitdiff
stroke: Make 96-bit truncation for SHA-256 configurable
authorTobias Brunner <tobias@strongswan.org>
Wed, 10 May 2017 17:32:53 +0000 (19:32 +0200)
committerTobias Brunner <tobias@strongswan.org>
Fri, 26 May 2017 09:22:28 +0000 (11:22 +0200)
man/ipsec.conf.5.in
src/libcharon/plugins/stroke/stroke_config.c
src/libcharon/plugins/stroke/stroke_socket.c
src/starter/args.c
src/starter/confread.h
src/starter/keywords.h
src/starter/keywords.txt
src/starter/starterstroke.c
src/stroke/stroke_msg.h

index ee7d860895e91210040233af4302e8da6f15efb4..fef44ae21255e8812285ad25a1ec73eedb1d72d9 100644 (file)
@@ -1141,6 +1141,13 @@ a value of 0 disables IPsec replay protection.
 .BR reqid " = <number>"
 sets the reqid for a given connection to a pre-configured fixed value.
 .TP
+.BR sha256_96 " = " no " | yes"
+HMAC-SHA-256 is used with 128-bit truncation with IPsec. For compatibility
+with implementations that incorrectly use 96-bit truncation this option may be
+enabled to configure the shorter truncation length in the kernel.  This is not
+negotiated, so this only works with peers that use the incorrect truncation
+length (or have this option enabled).
+.TP
 .BR tfc " = <value>"
 number of bytes to pad ESP payload data to. Traffic Flow Confidentiality
 is currently supported in IKEv2 and applies to outgoing packets only. The
index a9d073684d971703c26d500d04afa1c5405e5296..d47787d72e9c77ece25888ffe58d74dac1e8bf8d 100644 (file)
@@ -1074,7 +1074,8 @@ static child_cfg_t *build_child_cfg(private_stroke_config_t *this,
                .options = (msg->add_conn.proxy_mode ? OPT_PROXY_MODE : 0) |
                                   (msg->add_conn.ipcomp ? OPT_IPCOMP : 0) |
                                   (msg->add_conn.me.hostaccess ? OPT_HOSTACCESS : 0) |
-                                  (msg->add_conn.install_policy ? 0 : OPT_NO_POLICIES),
+                                  (msg->add_conn.install_policy ? 0 : OPT_NO_POLICIES) |
+                                  (msg->add_conn.sha256_96 ? OPT_SHA256_96 : 0),
                .tfc = msg->add_conn.tfc,
                .inactivity = msg->add_conn.inactivity,
                .dpd_action = map_action(msg->add_conn.dpd.action),
index 46de90ca65820d9402af4a2576e75f3f56a8fca3..65d345db3997df29eb9d41ecf6f5e4ac517b1935 100644 (file)
@@ -216,6 +216,7 @@ static void stroke_add_conn(private_stroke_socket_t *this, stroke_msg_t *msg)
        DBG_OPT("  dpdtimeout=%d", msg->add_conn.dpd.timeout);
        DBG_OPT("  dpdaction=%d", msg->add_conn.dpd.action);
        DBG_OPT("  closeaction=%d", msg->add_conn.close_action);
+       DBG_OPT("  sha256_96=%s", msg->add_conn.sha256_96 ? "yes" : "no");
        DBG_OPT("  mediation=%s", msg->add_conn.ikeme.mediation ? "yes" : "no");
        DBG_OPT("  mediated_by=%s", msg->add_conn.ikeme.mediated_by);
        DBG_OPT("  me_peerid=%s", msg->add_conn.ikeme.peerid);
index 7f010d3503b64a4e69825b777f620e3593181903..477a52082d851e1c50f6aca684e41ab91c55eb83 100644 (file)
@@ -165,6 +165,7 @@ static const token_info_t token_info[] =
        { ARG_TIME, offsetof(starter_conn_t, dpd_timeout), NULL                        },
        { ARG_ENUM, offsetof(starter_conn_t, dpd_action), LST_dpd_action               },
        { ARG_ENUM, offsetof(starter_conn_t, close_action), LST_dpd_action             },
+       { ARG_ENUM, offsetof(starter_conn_t, sha256_96), LST_bool                      },
        { ARG_TIME, offsetof(starter_conn_t, inactivity), NULL                         },
        { ARG_MISC, 0, NULL  /* KW_MODECONFIG */                                       },
        { ARG_MISC, 0, NULL  /* KW_XAUTH */                                            },
index 2b974d1bca6e97f2de69738f6d8ecb27b821e39b..8ee730daa0780ad9e69d51f23d37a790ec0fb24f 100644 (file)
@@ -162,6 +162,8 @@ struct starter_conn {
 
                dpd_action_t    close_action;
 
+               bool            sha256_96;
+
                time_t          inactivity;
 
                bool            me_mediation;
index 94af493f8fee66cf9418b5f8e85d5badbea9f958..0cb46a7401c9e5d0179a236f58466e2fe501c0b0 100644 (file)
@@ -64,6 +64,7 @@ enum kw_token_t {
        KW_DPDTIMEOUT,
        KW_DPDACTION,
        KW_CLOSEACTION,
+       KW_SHA256_96,
        KW_INACTIVITY,
        KW_MODECONFIG,
        KW_XAUTH,
index ee0bd31e1e54b275be64938eb591bb26aca80cef..3f92dc83f50fc5e264116b612804a567d834817e 100644 (file)
@@ -61,6 +61,7 @@ dpddelay,          KW_DPDDELAY
 dpdtimeout,        KW_DPDTIMEOUT
 dpdaction,         KW_DPDACTION
 closeaction,       KW_CLOSEACTION
+sha256_96,         KW_SHA256_96
 inactivity,        KW_INACTIVITY
 modeconfig,        KW_MODECONFIG
 xauth,             KW_XAUTH
index b92c00c873f9538bc3336242bd23f9b8226a0d37..90af9372ac063c21116df8aaf4f9b1704bb3ca8b 100644 (file)
@@ -220,6 +220,7 @@ int starter_stroke_add_conn(starter_config_t *cfg, starter_conn_t *conn)
        msg->add_conn.dpd.timeout = conn->dpd_timeout;
        msg->add_conn.dpd.action = conn->dpd_action;
        msg->add_conn.close_action = conn->close_action;
+       msg->add_conn.sha256_96 = conn->sha256_96;
        msg->add_conn.inactivity = conn->inactivity;
        msg->add_conn.ikeme.mediation = conn->me_mediation;
        push_string(&msg, add_conn.ikeme.mediated_by, conn->me_mediated_by);
index a3b911d0f9e945489a8ae388e0086d1ece79d974..60ea0028d8b9f37891d8e9fbafcaff86a977779d 100644 (file)
@@ -302,6 +302,7 @@ struct stroke_msg_t {
                        } mark_in, mark_out;
                        stroke_end_t me, other;
                        uint32_t replay_window;
+                       bool sha256_96;
                } add_conn;
 
                /* data for STR_ADD_CA */