Skip to content

Commit 0d0863b

Browse files
nhormandavem330
authored andcommitted
sctp: Change defaults on cookie hmac selection
Recently I posted commit 3c68198 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>
1 parent 999a7c5 commit 0d0863b

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

net/sctp/Kconfig

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,43 @@ config SCTP_DBG_OBJCNT
6666
'cat /proc/net/sctp/sctp_dbg_objcnt'
6767

6868
If unsure, say N
69+
choice
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+
76+
config 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+
82+
config 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+
88+
config 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+
93+
endchoice
6994

7095
config SCTP_COOKIE_HMAC_MD5
7196
bool "Enable optional MD5 hmac cookie generation"
7297
help
7398
Enable optional MD5 hmac based SCTP cookie generation
74-
default y
7599
select CRYPTO_HMAC if SCTP_COOKIE_HMAC_MD5
76100
select CRYPTO_MD5 if SCTP_COOKIE_HMAC_MD5
77101

78102
config SCTP_COOKIE_HMAC_SHA1
79103
bool "Enable optional SHA1 hmac cookie generation"
80104
help
81105
Enable optional SHA1 hmac based SCTP cookie generation
82-
default y
83106
select CRYPTO_HMAC if SCTP_COOKIE_HMAC_SHA1
84107
select CRYPTO_SHA1 if SCTP_COOKIE_HMAC_SHA1
85108

net/sctp/protocol.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,9 +1191,9 @@ static int __net_init sctp_net_init(struct net *net)
11911191
net->sctp.cookie_preserve_enable = 1;
11921192

11931193
/* 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)
11951195
net->sctp.sctp_hmac_alg = "md5";
1196-
#elif defined (CONFIG_CRYPTO_SHA1)
1196+
#elif defined (CONFIG_SCTP_DEFAULT_COOKIE_HMAC_SHA1)
11971197
net->sctp.sctp_hmac_alg = "sha1";
11981198
#else
11991199
net->sctp.sctp_hmac_alg = NULL;

0 commit comments

Comments
 (0)