SCTP: Fix build issues with SCTP AUTH.
authorVlad Yasevich <vladislav.yasevich@hp.com>
Thu, 29 Nov 2007 14:53:52 +0000 (09:53 -0500)
committerVlad Yasevich <vladislav.yasevich@hp.com>
Thu, 29 Nov 2007 15:17:42 +0000 (10:17 -0500)
SCTP-AUTH requires selection of CRYPTO, HMAC and SHA1 since
SHA1 is a MUST requirement for AUTH.  We also support SHA256,
but that's optional, so fix the code to treat it as such.

Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
include/net/sctp/constants.h
net/sctp/Kconfig
net/sctp/auth.c

index f30b537d69525168e078a2eb8a0c39a51ef6bdc1..05f22a6afbcdc4cceeefd4431696db74c384f044 100644 (file)
@@ -441,11 +441,14 @@ enum {
        SCTP_AUTH_HMAC_ID_RESERVED_0,
        SCTP_AUTH_HMAC_ID_SHA1,
        SCTP_AUTH_HMAC_ID_RESERVED_2,
-       SCTP_AUTH_HMAC_ID_SHA256
+#if defined (CONFIG_CRYPTO_SHA256) || defined (CONFIG_CRYPTO_SHA256_MODULE)
+       SCTP_AUTH_HMAC_ID_SHA256,
+#endif
+       __SCTP_AUTH_HMAC_MAX
 };
 
-#define SCTP_AUTH_HMAC_ID_MAX  SCTP_AUTH_HMAC_ID_SHA256
-#define SCTP_AUTH_NUM_HMACS (SCTP_AUTH_HMAC_ID_SHA256 + 1)
+#define SCTP_AUTH_HMAC_ID_MAX  __SCTP_AUTH_HMAC_MAX - 1
+#define SCTP_AUTH_NUM_HMACS    __SCTP_AUTH_HMAC_MAX
 #define SCTP_SHA1_SIG_SIZE 20
 #define SCTP_SHA256_SIG_SIZE 32
 
index 8210f549c4929914f29fe07f4d81809bbdb41a24..5390bc792159c7a4fdc190308f74a0c2fe9add62 100644 (file)
@@ -6,9 +6,9 @@ menuconfig IP_SCTP
        tristate "The SCTP Protocol (EXPERIMENTAL)"
        depends on INET && EXPERIMENTAL
        depends on IPV6 || IPV6=n
-       select CRYPTO if SCTP_HMAC_SHA1 || SCTP_HMAC_MD5
-       select CRYPTO_HMAC if SCTP_HMAC_SHA1 || SCTP_HMAC_MD5
-       select CRYPTO_SHA1 if SCTP_HMAC_SHA1
+       select CRYPTO
+       select CRYPTO_HMAC
+       select CRYPTO_SHA1
        select CRYPTO_MD5 if SCTP_HMAC_MD5
        ---help---
          Stream Control Transmission Protocol
index 6d89e35307aa94393dbbae4a5032865b574e7cdf..97e6ebd145001e9b642fcf59d882714fa814e53e 100644 (file)
@@ -54,11 +54,13 @@ static struct sctp_hmac sctp_hmac_list[SCTP_AUTH_NUM_HMACS] = {
                /* id 2 is reserved as well */
                .hmac_id = SCTP_AUTH_HMAC_ID_RESERVED_2,
        },
+#if defined (CONFIG_CRYPTO_SHA256) || defined (CONFIG_CRYPTO_SHA256_MODULE)
        {
                .hmac_id = SCTP_AUTH_HMAC_ID_SHA256,
                .hmac_name="hmac(sha256)",
                .hmac_len = SCTP_SHA256_SIG_SIZE,
        }
+#endif
 };