aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorNeil Horman <nhorman@tuxdriver.com>2012-12-14 10:22:01 -0500
committerDavid S. Miller <davem@davemloft.net>2012-12-15 20:14:38 -0500
commit0d0863b02002c25140a1b9e113b81211bcc780e8 (patch)
tree4f8c3c05432537f4048c05bfb337c7a0bd7965e8 /net
parent999a7c5776a0ed2133645fa7e008bec05bda9254 (diff)
sctp: Change defaults on cookie hmac selection
Recently I posted commit 3c68198e75 which made selection of the cookie hmac algorithm selectable. This is all well and good, but Linus noted that it changes the default config: http://marc.info/?l=linux-netdev&m=135536629004808&w=2 I've modified the sctp Kconfig file to reflect the recommended way of making this choice, using the thermal driver example specified, and brought the defaults back into line with the way they were prior to my origional patch Also, on Linus' suggestion, re-adding ability to select default 'none' hmac algorithm, so we don't needlessly bloat the kernel by forcing a non-none default. This also led me to note that we won't honor the default none condition properly because of how sctp_net_init is encoded. Fix that up as well. Tested by myself (allbeit fairly quickly). All configuration combinations seems to work soundly. Signed-off-by: Neil Horman <nhorman@tuxdriver.com> CC: David Miller <davem@davemloft.net> CC: Linus Torvalds <torvalds@linux-foundation.org> CC: Vlad Yasevich <vyasevich@gmail.com> CC: linux-sctp@vger.kernel.org Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/sctp/Kconfig27
-rw-r--r--net/sctp/protocol.c4
2 files changed, 27 insertions, 4 deletions
diff --git a/net/sctp/Kconfig b/net/sctp/Kconfig
index a9edd2e205f4..c26210618e14 100644
--- a/net/sctp/Kconfig
+++ b/net/sctp/Kconfig
@@ -66,12 +66,36 @@ config SCTP_DBG_OBJCNT
66 'cat /proc/net/sctp/sctp_dbg_objcnt' 66 'cat /proc/net/sctp/sctp_dbg_objcnt'
67 67
68 If unsure, say N 68 If unsure, say N
69choice
70 prompt "Default SCTP cookie HMAC encoding"
71 default SCTP_COOKIE_HMAC_MD5
72 help
73 This option sets the default sctp cookie hmac algorithm
74 when in doubt select 'md5'
75
76config SCTP_DEFAULT_COOKIE_HMAC_MD5
77 bool "Enable optional MD5 hmac cookie generation"
78 help
79 Enable optional MD5 hmac based SCTP cookie generation
80 select SCTP_COOKIE_HMAC_MD5
81
82config SCTP_DEFAULT_COOKIE_HMAC_SHA1
83 bool "Enable optional SHA1 hmac cookie generation"
84 help
85 Enable optional SHA1 hmac based SCTP cookie generation
86 select SCTP_COOKIE_HMAC_SHA1
87
88config SCTP_DEFAULT_COOKIE_HMAC_NONE
89 bool "Use no hmac alg in SCTP cookie generation"
90 help
91 Use no hmac algorithm in SCTP cookie generation
92
93endchoice
69 94
70config SCTP_COOKIE_HMAC_MD5 95config SCTP_COOKIE_HMAC_MD5
71 bool "Enable optional MD5 hmac cookie generation" 96 bool "Enable optional MD5 hmac cookie generation"
72 help 97 help
73 Enable optional MD5 hmac based SCTP cookie generation 98 Enable optional MD5 hmac based SCTP cookie generation
74 default y
75 select CRYPTO_HMAC if SCTP_COOKIE_HMAC_MD5 99 select CRYPTO_HMAC if SCTP_COOKIE_HMAC_MD5
76 select CRYPTO_MD5 if SCTP_COOKIE_HMAC_MD5 100 select CRYPTO_MD5 if SCTP_COOKIE_HMAC_MD5
77 101
@@ -79,7 +103,6 @@ config SCTP_COOKIE_HMAC_SHA1
79 bool "Enable optional SHA1 hmac cookie generation" 103 bool "Enable optional SHA1 hmac cookie generation"
80 help 104 help
81 Enable optional SHA1 hmac based SCTP cookie generation 105 Enable optional SHA1 hmac based SCTP cookie generation
82 default y
83 select CRYPTO_HMAC if SCTP_COOKIE_HMAC_SHA1 106 select CRYPTO_HMAC if SCTP_COOKIE_HMAC_SHA1
84 select CRYPTO_SHA1 if SCTP_COOKIE_HMAC_SHA1 107 select CRYPTO_SHA1 if SCTP_COOKIE_HMAC_SHA1
85 108
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 2c7785bacf74..f898b1c58bd2 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -1191,9 +1191,9 @@ static int __net_init sctp_net_init(struct net *net)
1191 net->sctp.cookie_preserve_enable = 1; 1191 net->sctp.cookie_preserve_enable = 1;
1192 1192
1193 /* Default sctp sockets to use md5 as their hmac alg */ 1193 /* Default sctp sockets to use md5 as their hmac alg */
1194#if defined (CONFIG_CRYPTO_MD5) 1194#if defined (CONFIG_SCTP_DEFAULT_COOKIE_HMAC_MD5)
1195 net->sctp.sctp_hmac_alg = "md5"; 1195 net->sctp.sctp_hmac_alg = "md5";
1196#elif defined (CONFIG_CRYPTO_SHA1) 1196#elif defined (CONFIG_SCTP_DEFAULT_COOKIE_HMAC_SHA1)
1197 net->sctp.sctp_hmac_alg = "sha1"; 1197 net->sctp.sctp_hmac_alg = "sha1";
1198#else 1198#else
1199 net->sctp.sctp_hmac_alg = NULL; 1199 net->sctp.sctp_hmac_alg = NULL;