summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorldixon@google.com <ldixon@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-02 04:31:17 +0000
committerldixon@google.com <ldixon@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-02 04:31:17 +0000
commitf4fe908bde8f334f060195a23b61bb6cd46ca841 (patch)
tree7a4671e3c215bbedc36c3e28e2243996fcca1543
parent0b5e1d7bed7fd96645eb145496485362bbaac66e (diff)
downloadchromium_src-f4fe908bde8f334f060195a23b61bb6cd46ca841.zip
chromium_src-f4fe908bde8f334f060195a23b61bb6cd46ca841.tar.gz
chromium_src-f4fe908bde8f334f060195a23b61bb6cd46ca841.tar.bz2
This fixes bugs in windows that Lally got upstream in usrsctp. This now enables the HAVE_SCTP flag for windows.
BUG= Review URL: https://chromiumcodereview.appspot.com/19522005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215206 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--DEPS2
-rw-r--r--third_party/libjingle/libjingle.gyp8
-rw-r--r--third_party/usrsctp/README.chromium20
-rw-r--r--third_party/usrsctp/localchanges.patch197
-rw-r--r--third_party/usrsctp/overrides/usrsctplib/netinet/sctp_nss_sha1.c5
-rw-r--r--third_party/usrsctp/overrides/usrsctplib/netinet/sctp_nss_sha1.h4
-rw-r--r--third_party/usrsctp/overrides/usrsctplib/netinet/sctp_os_userspace.h24
-rw-r--r--third_party/usrsctp/overrides/usrsctplib/netinet/sctp_sha1.h29
-rw-r--r--third_party/usrsctp/usrsctp.gyp43
9 files changed, 219 insertions, 113 deletions
diff --git a/DEPS b/DEPS
index 0552d0c..ea79a29 100644
--- a/DEPS
+++ b/DEPS
@@ -176,7 +176,7 @@ deps = {
"src/third_party/usrsctp/usrsctplib":
(Var("googlecode_url") % "sctp-refimpl") +
- "/trunk/KERN/usrsctp/usrsctplib@8463",
+ "/trunk/KERN/usrsctp/usrsctplib@8554",
"src/third_party/libsrtp":
"/trunk/deps/third_party/libsrtp@214783",
diff --git a/third_party/libjingle/libjingle.gyp b/third_party/libjingle/libjingle.gyp
index 59e523d..e350e62 100644
--- a/third_party/libjingle/libjingle.gyp
+++ b/third_party/libjingle/libjingle.gyp
@@ -776,12 +776,8 @@
}],
# TODO(mallinath) - Enable SCTP for Android and iOS platforms.
['OS!="android" and OS!="ios"', {
- 'conditions': [
- ['OS!="win"', {
- 'defines': [
- 'HAVE_SCTP',
- ],
- }],
+ 'defines': [
+ 'HAVE_SCTP',
],
'sources': [
'<(libjingle_source)/talk/media/sctp/sctpdataengine.cc',
diff --git a/third_party/usrsctp/README.chromium b/third_party/usrsctp/README.chromium
index 087a03fc..a3224ea 100644
--- a/third_party/usrsctp/README.chromium
+++ b/third_party/usrsctp/README.chromium
@@ -2,13 +2,14 @@ Name: usrsctp
URL: http://sctp-refimpl.googlecode.com/svn/trunk/KERN/usrsctp
Version: 0
Date: 16 March 2013
-Revision: 8439
+Revision: 8554
License: New BSD License
License File: LICENSE
Security Critical: yes
Description:
-The usrsctplib provides implementation of SCTP protocol which fully supports RFC 2960
+The usrsctplib provides implementation of SCTP protocol which fully supports
+RFC 2960
as well as updates and enhancements from the following Internet Drafts:
draft-ietf-tsvwg-sctpcsum-05.txt
draft-ietf-tsvwg-sctpimpguide-05.txt
@@ -19,8 +20,13 @@ as well as updates and enhancements from the following Internet Drafts:
draft-iyengar-sctp-cacc-00.txt
Local Modifications:
-usrsctplib provides its own SHA1 implementations as part of the library. Since chrome
-already has the support of both NSS and OPENSSL which already has the implementation
-of SHA1, Chromium will not include the SHA1 from usrsctplib.
-Overrides folder has the necessary changes to strip existing SHA1 implementation in
-usrsctplib and use OPENSSL or NSS implementation based on the platform type.
+usrsctplib provides its own SHA1 implementations as part of the library. Since
+chrome already has the support of both NSS and OPENSSL which already
+implementats SHA1, Chromium will not include the SHA1 from usrsctplib.
+
+Overrides folder has the necessary changes to strip the existing SHA1
+implementation in usrsctplib and use OPENSSL or NSS implementation based on the
+platform type.
+
+To re-create the patch file run:
+diff -PcrB usrsctplib overrides/usrsctplib > localchanges.patch
diff --git a/third_party/usrsctp/localchanges.patch b/third_party/usrsctp/localchanges.patch
index b784a42..83029a8 100644
--- a/third_party/usrsctp/localchanges.patch
+++ b/third_party/usrsctp/localchanges.patch
@@ -1,6 +1,15 @@
-diff -NcrB usrsctplib/netinet/sctp_auth.h overrides/usrsctplib/netinet/sctp_auth.h
-*** usrsctplib/netinet/sctp_auth.h 2013-06-10 17:41:59.323347517 -0700
---- overrides/usrsctplib/netinet/sctp_auth.h 2013-06-10 17:44:55.584797436 -0700
+Binary files usrsctplib/.DS_Store and overrides/usrsctplib/.DS_Store differ
+Only in usrsctplib: .cvsignore
+Only in usrsctplib: .git
+Only in usrsctplib: Makefile.am
+Only in usrsctplib: Makefile.nmake
+Only in usrsctplib/netinet: sctp.h
+Only in usrsctplib/netinet: sctp_asconf.c
+Only in usrsctplib/netinet: sctp_asconf.h
+Only in usrsctplib/netinet: sctp_auth.c
+diff -PcrB usrsctplib/netinet/sctp_auth.h overrides/usrsctplib/netinet/sctp_auth.h
+*** usrsctplib/netinet/sctp_auth.h 2013-07-26 05:00:15.000000000 -0400
+--- overrides/usrsctplib/netinet/sctp_auth.h 2013-06-18 11:40:34.000000000 -0400
***************
*** 38,43 ****
--- 38,44 ----
@@ -11,12 +20,30 @@ diff -NcrB usrsctplib/netinet/sctp_auth.h overrides/usrsctplib/netinet/sctp_auth
/* digest lengths */
#define SCTP_AUTH_DIGEST_LEN_SHA1 20
-diff -NcrB usrsctplib/netinet/sctp_nss_sha1.c overrides/usrsctplib/netinet/sctp_nss_sha1.c
-*** usrsctplib/netinet/sctp_nss_sha1.c 1969-12-31 16:00:00.000000000 -0800
---- overrides/usrsctplib/netinet/sctp_nss_sha1.c 2013-06-10 17:41:29.603102743 -0700
+Only in usrsctplib/netinet: sctp_bsd_addr.c
+Only in usrsctplib/netinet: sctp_bsd_addr.h
+Only in usrsctplib/netinet: sctp_callout.c
+Only in usrsctplib/netinet: sctp_callout.h
+Only in usrsctplib/netinet: sctp_cc_functions.c
+Only in usrsctplib/netinet: sctp_constants.h
+Only in usrsctplib/netinet: sctp_crc32.c
+Only in usrsctplib/netinet: sctp_crc32.h
+Only in usrsctplib/netinet: sctp_dtrace_declare.h
+Only in usrsctplib/netinet: sctp_dtrace_define.h
+Only in usrsctplib/netinet: sctp_hashdriver.c
+Only in usrsctplib/netinet: sctp_hashdriver.h
+Only in usrsctplib/netinet: sctp_header.h
+Only in usrsctplib/netinet: sctp_indata.c
+Only in usrsctplib/netinet: sctp_indata.h
+Only in usrsctplib/netinet: sctp_input.c
+Only in usrsctplib/netinet: sctp_input.h
+Only in usrsctplib/netinet: sctp_lock_userspace.h
+diff -PcrB usrsctplib/netinet/sctp_nss_sha1.c overrides/usrsctplib/netinet/sctp_nss_sha1.c
+*** usrsctplib/netinet/sctp_nss_sha1.c 1969-12-31 19:00:00.000000000 -0500
+--- overrides/usrsctplib/netinet/sctp_nss_sha1.c 2013-07-29 21:32:35.000000000 -0400
***************
*** 0 ****
---- 1,61 ----
+--- 1,64 ----
+ /*-
+ * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.
+ * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
@@ -57,6 +84,9 @@ diff -NcrB usrsctplib/netinet/sctp_nss_sha1.c overrides/usrsctplib/netinet/sctp_
+ #ifdef SCTP_USE_NSS_SHA1
+ #include <netinet/sctp_nss_sha1.h>
+
++ /* A SHA-1 Digest is 160 bits, or 20 bytes */
++ #define SHA_DIGEST_LENGTH (20)
++
+ void
+ SCTP_NSS_SHA1_Init(struct sha1_context *ctx)
+ {
@@ -74,13 +104,13 @@ diff -NcrB usrsctplib/netinet/sctp_nss_sha1.c overrides/usrsctplib/netinet/sctp_
+ SCTP_NSS_SHA1_Final(unsigned char *digest, struct sha1_context *ctx)
+ {
+ unsigned int output_len = 0;
-+ PK11_DigestFinal(ctx->pk11_ctx, digest, &output_len, sizeof(digest));
++ PK11_DigestFinal(ctx->pk11_ctx, digest, &output_len, SHA_DIGEST_LENGTH);
+ PK11_DestroyContext(ctx->pk11_ctx, PR_TRUE);
+ }
+ #endif
-diff -NcrB usrsctplib/netinet/sctp_nss_sha1.h overrides/usrsctplib/netinet/sctp_nss_sha1.h
-*** usrsctplib/netinet/sctp_nss_sha1.h 1969-12-31 16:00:00.000000000 -0800
---- overrides/usrsctplib/netinet/sctp_nss_sha1.h 2013-06-10 17:41:29.603102743 -0700
+diff -PcrB usrsctplib/netinet/sctp_nss_sha1.h overrides/usrsctplib/netinet/sctp_nss_sha1.h
+*** usrsctplib/netinet/sctp_nss_sha1.h 1969-12-31 19:00:00.000000000 -0500
+--- overrides/usrsctplib/netinet/sctp_nss_sha1.h 2013-07-26 03:58:48.000000000 -0400
***************
*** 0 ****
--- 1,64 ----
@@ -146,11 +176,11 @@ diff -NcrB usrsctplib/netinet/sctp_nss_sha1.h overrides/usrsctplib/netinet/sctp_
+ #define SHA1_Update SCTP_NSS_SHA1_Update
+ #define SHA1_Final SCTP_NSS_SHA1_Final
+
-+ #endif /* _KERNEL */
-+ #endif
-diff -NcrB usrsctplib/netinet/sctp_openssl_sha1.h overrides/usrsctplib/netinet/sctp_openssl_sha1.h
-*** usrsctplib/netinet/sctp_openssl_sha1.h 1969-12-31 16:00:00.000000000 -0800
---- overrides/usrsctplib/netinet/sctp_openssl_sha1.h 2013-06-10 17:41:29.603102743 -0700
++ #endif /* _KERNEL */
++ #endif /* __SCTP_NSS_SHA1_h__ */
+diff -PcrB usrsctplib/netinet/sctp_openssl_sha1.h overrides/usrsctplib/netinet/sctp_openssl_sha1.h
+*** usrsctplib/netinet/sctp_openssl_sha1.h 1969-12-31 19:00:00.000000000 -0500
+--- overrides/usrsctplib/netinet/sctp_openssl_sha1.h 2013-06-18 11:40:34.000000000 -0400
***************
*** 0 ****
--- 1,48 ----
@@ -202,9 +232,9 @@ diff -NcrB usrsctplib/netinet/sctp_openssl_sha1.h overrides/usrsctplib/netinet/s
+ typedef SHA_CTX SHA1_CTX;
+
+ #endif
-diff -NcrB usrsctplib/netinet/sctp_os.h overrides/usrsctplib/netinet/sctp_os.h
-*** usrsctplib/netinet/sctp_os.h 2013-06-10 17:42:10.643440747 -0700
---- overrides/usrsctplib/netinet/sctp_os.h 2013-06-10 17:41:29.603102743 -0700
+diff -PcrB usrsctplib/netinet/sctp_os.h overrides/usrsctplib/netinet/sctp_os.h
+*** usrsctplib/netinet/sctp_os.h 2013-07-26 05:00:15.000000000 -0400
+--- overrides/usrsctplib/netinet/sctp_os.h 2013-06-18 11:40:34.000000000 -0400
***************
*** 73,79 ****
#endif
@@ -223,34 +253,48 @@ diff -NcrB usrsctplib/netinet/sctp_os.h overrides/usrsctplib/netinet/sctp_os.h
#endif
#if defined(__Panda__)
-diff -NcrB usrsctplib/netinet/sctp_os_userspace.h overrides/usrsctplib/netinet/sctp_os_userspace.h
-*** usrsctplib/netinet/sctp_os_userspace.h 2013-06-10 17:42:23.763548800 -0700
---- overrides/usrsctplib/netinet/sctp_os_userspace.h 2013-06-10 17:41:29.603102743 -0700
+diff -PcrB usrsctplib/netinet/sctp_os_userspace.h overrides/usrsctplib/netinet/sctp_os_userspace.h
+*** usrsctplib/netinet/sctp_os_userspace.h 2013-07-26 05:03:12.000000000 -0400
+--- overrides/usrsctplib/netinet/sctp_os_userspace.h 2013-07-26 04:46:41.000000000 -0400
***************
-*** 992,1000 ****
+*** 996,1012 ****
#define SCTP_READ_RANDOM(buf, len) read_random(buf, len)
- #ifdef USE_SCTP_SHA1
#include <netinet/sctp_sha1.h>
-- #else
- #if 0 /*this was old _KERNEL code... */
- #include <crypto/sha1.h>
- /* map standard crypto API names */
---- 992,998 ----
-***************
-*** 1002,1008 ****
- #define SHA1_Update SHA1Update
- #define SHA1_Final(x,y) SHA1Final((caddr_t)x, y)
- #endif
-- #endif
+! #else
+! #if 0 /*this was old _KERNEL code... */
+! #include <crypto/sha1.h>
+! /* map standard crypto API names */
+! #define SHA1_Init SHA1Init
+! #define SHA1_Update SHA1Update
+! #define SHA1_Final(x,y) SHA1Final((caddr_t)x, y)
+! #endif
+! #endif
+
+ #if defined(HAVE_SHA2)
+ #include <crypto/sha2/sha2.h>
+--- 996,1003 ----
+ #define SCTP_READ_RANDOM(buf, len) read_random(buf, len)
+
+
+ #include <netinet/sctp_sha1.h>
+!
#if defined(HAVE_SHA2)
#include <crypto/sha2/sha2.h>
---- 1000,1005 ----
-diff -NcrB usrsctplib/netinet/sctp_sha1.h overrides/usrsctplib/netinet/sctp_sha1.h
-*** usrsctplib/netinet/sctp_sha1.h 2013-06-10 17:42:32.483620614 -0700
---- overrides/usrsctplib/netinet/sctp_sha1.h 2013-06-10 17:41:29.603102743 -0700
+Only in usrsctplib/netinet: sctp_output.c
+Only in usrsctplib/netinet: sctp_output.h
+Only in usrsctplib/netinet: sctp_pcb.c
+Only in usrsctplib/netinet: sctp_pcb.h
+Only in usrsctplib/netinet: sctp_peeloff.c
+Only in usrsctplib/netinet: sctp_peeloff.h
+Only in usrsctplib/netinet: sctp_process_lock.h
+Only in usrsctplib/netinet: sctp_sha1.c
+diff -PcrB usrsctplib/netinet/sctp_sha1.h overrides/usrsctplib/netinet/sctp_sha1.h
+*** usrsctplib/netinet/sctp_sha1.h 2013-07-26 05:00:15.000000000 -0400
+--- overrides/usrsctplib/netinet/sctp_sha1.h 2013-07-29 23:00:51.000000000 -0400
***************
*** 36,46 ****
#endif
@@ -260,11 +304,11 @@ diff -NcrB usrsctplib/netinet/sctp_sha1.h overrides/usrsctplib/netinet/sctp_sha1
! #define __SCTP_SLA1_h__
#include <sys/types.h>
-!
+
struct sha1_context {
unsigned int A;
unsigned int B;
---- 36,50 ----
+--- 36,69 ----
#endif
@@ -272,18 +316,73 @@ diff -NcrB usrsctplib/netinet/sctp_sha1.h overrides/usrsctplib/netinet/sctp_sha1
! #define __SCTP_SHA1_h__
#include <sys/types.h>
-! #ifdef SCTP_USE_NSS_SHA1
-! #include <netinet/sctp_nss_sha1.h>
-! #elif SCTP_USE_OPENSSL_SHA1
-! #include <netinet/sctp_openssl_sha1.h>
-! #else // USE_SCTP_SHA1
+
++ #if !defined(SSL_USE_OPENSSL) && !defined(SSL_USE_NSS)
++ #if defined(WIN32)
++
++ #define SCTP_USE_SCTP_SHA1 1
++
++ #else // defined(WIN32)
++
++ #if defined(HAVE_OPENSSL_SSL_H)
++ #define SSL_USE_OPENSSL 1
++ #elif defined(HAVE_NSS_SSL_H)
++ #define SSL_USE_NSS 1
++ #else
++ #define SCTP_USE_SCTP_SHA1
++ #endif
++
++ #endif // !defined(WIN32)
++ #endif
++
++ #if defined(SSL_USE_NSS)
++ #include <netinet/sctp_nss_sha1.h>
++ #elif defined(SSL_USE_OPENSSL)
++ #include <netinet/sctp_openssl_sha1.h>
++ #else // SCTP_USE_SCTP_SHA1
struct sha1_context {
unsigned int A;
unsigned int B;
***************
-*** 96,98 ****
---- 100,103 ----
+*** 95,98 ****
+ void SHA1_Final(unsigned char *, struct sha1_context *);
#endif /* _KERNEL */
- #endif
-+ #endif
+! #endif
+--- 118,122 ----
+ void SHA1_Final(unsigned char *, struct sha1_context *);
+
+ #endif /* _KERNEL */
+! #endif /* !defined(SSL_USE_OPENSSL) && !defined(SSL_USE_NSS) */
+! #endif /* __SCTP_SHA1_h__ */
+Only in usrsctplib/netinet: sctp_ss_functions.c
+Only in usrsctplib/netinet: sctp_structs.h
+Only in usrsctplib/netinet: sctp_sysctl.c
+Only in usrsctplib/netinet: sctp_sysctl.h
+Only in usrsctplib/netinet: sctp_timer.c
+Only in usrsctplib/netinet: sctp_timer.h
+Only in usrsctplib/netinet: sctp_uio.h
+Only in usrsctplib/netinet: sctp_userspace.c
+Only in usrsctplib/netinet: sctp_usrreq.c
+Only in usrsctplib/netinet: sctp_var.h
+Only in usrsctplib/netinet: sctputil.c
+Only in usrsctplib/netinet: sctputil.h
+Only in usrsctplib: netinet6
+Only in usrsctplib: user_atomic.h
+Only in usrsctplib: user_environment.c
+Only in usrsctplib: user_environment.h
+Only in usrsctplib: user_inpcb.h
+Only in usrsctplib: user_ip6_var.h
+Only in usrsctplib: user_ip_icmp.h
+Only in usrsctplib: user_malloc.h
+Only in usrsctplib: user_mbuf.c
+Only in usrsctplib: user_mbuf.h
+Only in usrsctplib: user_queue.h
+Only in usrsctplib: user_recv_thread.c
+Only in usrsctplib: user_recv_thread.h
+Only in usrsctplib: user_route.h
+Only in usrsctplib: user_sctp_timer_iterate.c
+Only in usrsctplib: user_socket.c
+Only in usrsctplib: user_socketvar.h
+Only in usrsctplib: user_uma.h
+Only in usrsctplib: usrsctp.h
diff --git a/third_party/usrsctp/overrides/usrsctplib/netinet/sctp_nss_sha1.c b/third_party/usrsctp/overrides/usrsctplib/netinet/sctp_nss_sha1.c
index 2274f8c..b87ff71 100644
--- a/third_party/usrsctp/overrides/usrsctplib/netinet/sctp_nss_sha1.c
+++ b/third_party/usrsctp/overrides/usrsctplib/netinet/sctp_nss_sha1.c
@@ -38,6 +38,9 @@ __FBSDID("$FreeBSD$");
#ifdef SCTP_USE_NSS_SHA1
#include <netinet/sctp_nss_sha1.h>
+/* A SHA-1 Digest is 160 bits, or 20 bytes */
+#define SHA_DIGEST_LENGTH (20)
+
void
SCTP_NSS_SHA1_Init(struct sha1_context *ctx)
{
@@ -55,7 +58,7 @@ void
SCTP_NSS_SHA1_Final(unsigned char *digest, struct sha1_context *ctx)
{
unsigned int output_len = 0;
- PK11_DigestFinal(ctx->pk11_ctx, digest, &output_len, sizeof(digest));
+ PK11_DigestFinal(ctx->pk11_ctx, digest, &output_len, SHA_DIGEST_LENGTH);
PK11_DestroyContext(ctx->pk11_ctx, PR_TRUE);
}
#endif
diff --git a/third_party/usrsctp/overrides/usrsctplib/netinet/sctp_nss_sha1.h b/third_party/usrsctp/overrides/usrsctplib/netinet/sctp_nss_sha1.h
index 85e721d..ba58440 100644
--- a/third_party/usrsctp/overrides/usrsctplib/netinet/sctp_nss_sha1.h
+++ b/third_party/usrsctp/overrides/usrsctplib/netinet/sctp_nss_sha1.h
@@ -60,5 +60,5 @@ typedef struct sha1_context SHA1_CTX;
#define SHA1_Update SCTP_NSS_SHA1_Update
#define SHA1_Final SCTP_NSS_SHA1_Final
-#endif /* _KERNEL */
-#endif
+#endif /* _KERNEL */
+#endif /* __SCTP_NSS_SHA1_h__ */
diff --git a/third_party/usrsctp/overrides/usrsctplib/netinet/sctp_os_userspace.h b/third_party/usrsctp/overrides/usrsctplib/netinet/sctp_os_userspace.h
index 7e977f7..709e44d 100644
--- a/third_party/usrsctp/overrides/usrsctplib/netinet/sctp_os_userspace.h
+++ b/third_party/usrsctp/overrides/usrsctplib/netinet/sctp_os_userspace.h
@@ -44,8 +44,6 @@
#if defined(__Userspace_os_Windows)
#include <winsock2.h>
#include <ws2tcpip.h>
-#include <ws2ipdef.h>
-#include <ws2def.h>
#include <iphlpapi.h>
#include <Mswsock.h>
#include <Windows.h>
@@ -63,6 +61,10 @@ typedef struct
CRITICAL_SECTION waiters_count_lock;
HANDLE events_[C_MAX_EVENTS];
} userland_cond_t;
+void InitializeXPConditionVariable(userland_cond_t *);
+void DeleteXPConditionVariable(userland_cond_t *);
+int SleepXPConditionVariable(userland_cond_t *, userland_mutex_t *);
+void WakeAllXPConditionVariable(userland_cond_t *);
#define InitializeConditionVariable(cond) InitializeXPConditionVariable(cond)
#define DeleteConditionVariable(cond) DeleteXPConditionVariable(cond)
#define SleepConditionVariableCS(cond, mtx, time) SleepXPConditionVariable(cond, mtx)
@@ -210,8 +212,10 @@ typedef HANDLE userland_thread_t;
typedef char* caddr_t;
+int Win_getifaddrs(struct ifaddrs**);
#define getifaddrs(interfaces) (int)Win_getifaddrs(interfaces)
-#define if_nametoindex(x) (int)win_if_nametoindex(x)
+int win_if_nametoindex(const char *);
+#define if_nametoindex(x) win_if_nametoindex(x)
#define bzero(buf, len) memset(buf, 0, len)
#define bcopy(srcKey, dstKey, len) memcpy(dstKey, srcKey, len)
@@ -411,18 +415,18 @@ struct sx {int dummy;};
#else
#include <sys/queue.h>
#endif
+#include <user_malloc.h>
/* #include <sys/kernel.h> */
/* #include <sys/sysctl.h> */
/* #include <sys/protosw.h> */
/* on FreeBSD, this results in a redefintion of SOCK(BUF)_(UN)LOCK and
* uknown type of struct mtx for sb_mtx in struct sockbuf */
+#include "user_socketvar.h" /* MALLOC_DECLARE's M_PCB. Replacement for sys/socketvar.h */
/* #include <sys/jail.h> */
/* #include <sys/sysctl.h> */
-#include <user_atomic.h>
#include <user_environment.h>
-#include <user_malloc.h>
+#include <user_atomic.h>
#include <user_mbuf.h>
-#include "user_socketvar.h" /* MALLOC_DECLARE's M_PCB. Replacement for sys/socketvar.h */
/* #include <sys/uio.h> */
/* #include <sys/lock.h> */
#if defined(__FreeBSD__) && __FreeBSD_version > 602000
@@ -993,13 +997,7 @@ int sctp_userspace_get_mtu_from_ifn(uint32_t if_index, int af);
#include <netinet/sctp_sha1.h>
-#if 0 /*this was old _KERNEL code... */
-#include <crypto/sha1.h>
-/* map standard crypto API names */
-#define SHA1_Init SHA1Init
-#define SHA1_Update SHA1Update
-#define SHA1_Final(x,y) SHA1Final((caddr_t)x, y)
-#endif
+
#if defined(HAVE_SHA2)
#include <crypto/sha2/sha2.h>
diff --git a/third_party/usrsctp/overrides/usrsctplib/netinet/sctp_sha1.h b/third_party/usrsctp/overrides/usrsctplib/netinet/sctp_sha1.h
index 4000e41..006e920 100644
--- a/third_party/usrsctp/overrides/usrsctplib/netinet/sctp_sha1.h
+++ b/third_party/usrsctp/overrides/usrsctplib/netinet/sctp_sha1.h
@@ -40,11 +40,30 @@ __FBSDID("$FreeBSD$");
#define __SCTP_SHA1_h__
#include <sys/types.h>
-#ifdef SCTP_USE_NSS_SHA1
+
+#if !defined(SSL_USE_OPENSSL) && !defined(SSL_USE_NSS)
+#if defined(WIN32)
+
+#define SCTP_USE_SCTP_SHA1 1
+
+#else // defined(WIN32)
+
+#if defined(HAVE_OPENSSL_SSL_H)
+#define SSL_USE_OPENSSL 1
+#elif defined(HAVE_NSS_SSL_H)
+#define SSL_USE_NSS 1
+#else
+#define SCTP_USE_SCTP_SHA1
+#endif
+
+#endif // !defined(WIN32)
+#endif
+
+#if defined(SSL_USE_NSS)
#include <netinet/sctp_nss_sha1.h>
-#elif SCTP_USE_OPENSSL_SHA1
+#elif defined(SSL_USE_OPENSSL)
#include <netinet/sctp_openssl_sha1.h>
-#else // USE_SCTP_SHA1
+#else // SCTP_USE_SCTP_SHA1
struct sha1_context {
unsigned int A;
unsigned int B;
@@ -99,5 +118,5 @@ void SHA1_Update(struct sha1_context *, const unsigned char *, int);
void SHA1_Final(unsigned char *, struct sha1_context *);
#endif /* _KERNEL */
-#endif
-#endif
+#endif /* !defined(SSL_USE_OPENSSL) && !defined(SSL_USE_NSS) */
+#endif /* __SCTP_SHA1_h__ */
diff --git a/third_party/usrsctp/usrsctp.gyp b/third_party/usrsctp/usrsctp.gyp
index 9285e21..d273385 100644
--- a/third_party/usrsctp/usrsctp.gyp
+++ b/third_party/usrsctp/usrsctp.gyp
@@ -7,7 +7,6 @@
},
'target_defaults': {
'defines': [
- 'INET',
'SCTP_PROCESS_LEVEL_LOCKS',
'SCTP_SIMPLE_ALLOCATOR',
'__Userspace__',
@@ -32,19 +31,27 @@
'conditions': [
['use_openssl==1', {
'defines': [
- 'SCTP_USE_OPENSSL_SHA1',
+ 'SSL_USE_OPENSSL',
],
'dependencies': [
- '../../third_party/openssl/openssl.gyp:openssl',
+ '<(DEPTH)/third_party/openssl/openssl.gyp:openssl',
+ ],
+ 'sources': [
+ 'overrides/usrsctplib/netinet/sctp_openssl_sha1.h',
],
},
{ # else use_openssl==0, use NSS.
'defines' : [
+ 'SSL_USE_NSS',
'SCTP_USE_NSS_SHA1',
],
+ 'sources': [
+ 'overrides/usrsctplib/netinet/sctp_nss_sha1.c',
+ 'overrides/usrsctplib/netinet/sctp_nss_sha1.h',
+ ],
'conditions': [
['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android"', {
- 'dependencies': [
+ 'dependencies': [ # The system.gyp:ssl dependency includes nss
'<(DEPTH)/build/linux/system.gyp:ssl',
],
}],
@@ -66,9 +73,7 @@
'overrides/usrsctplib/netinet/sctp_auth.h',
'overrides/usrsctplib/netinet/sctp_os.h',
'overrides/usrsctplib/netinet/sctp_os_userspace.h',
- 'overrides/usrsctplib/netinet/sctp_nss_sha1.c',
- 'overrides/usrsctplib/netinet/sctp_nss_sha1.h',
-
+ 'overrides/usrsctplib/netinet/sctp_sha1.h',
'usrsctplib/usrsctp.h',
'usrsctplib/user_atomic.h',
'usrsctplib/user_environment.c',
@@ -97,8 +102,6 @@
'usrsctplib/netinet/sctp_constants.h',
'usrsctplib/netinet/sctp_crc32.c',
'usrsctplib/netinet/sctp_crc32.h',
- 'usrsctplib/netinet/sctp_hashdriver.h',
- 'usrsctplib/netinet/sctp_hashdriver.c',
'usrsctplib/netinet/sctp_header.h',
'usrsctplib/netinet/sctp_indata.c',
'usrsctplib/netinet/sctp_indata.h',
@@ -123,23 +126,10 @@
'usrsctplib/netinet/sctputil.c',
'usrsctplib/netinet/sctputil.h',
'usrsctplib/netinet/sctp_var.h',
- 'usrsctplib/netinet6/sctp6_usrreq.c',
- 'usrsctplib/netinet6/sctp6_var.h',
], # sources
'conditions': [
- ['use_openssl==1', {
- 'sources!': [
- 'overrides/usrsctplib/netinet/sctp_nss_sha1.c',
- 'overrides/usrsctplib/netinet/sctp_nss_sha1.h',
- ],
- 'sources': [
- 'overrides/usrsctplib/netinet/sctp_openssl_sha1.h',
- ],
- }],
['OS=="linux"', {
'defines': [
- 'HAVE_INET_ADDR',
- 'HAVE_SOCKET',
'__Userspace_os_Linux',
],
'cflags!': [ '-Werror', '-Wall' ],
@@ -147,13 +137,8 @@
}],
['OS=="mac"', {
'defines': [
- 'HAVE_INET_ADDR',
'HAVE_SA_LEN',
'HAVE_SCONN_LEN',
- 'HAVE_SIN6_LEN',
- 'HAVE_SIN_LEN',
- 'HAVE_SOCKET',
- 'INET6',
'__APPLE_USE_RFC_2292',
'__Userspace_os_Darwin',
],
@@ -165,12 +150,12 @@
}],
['OS=="win"', {
'defines': [
- 'INET6',
'__Userspace_os_Windows',
],
'cflags!': [ '/W3', '/WX' ],
'cflags': [ '/w' ],
- # TODO(ldixon) : Remove this disable.
+ # TODO(ldixon) : Remove this disabling of warnings by pushing a
+ # fix upstream to usrsctp
'msvs_disabled_warnings': [ 4700, 4013, 4018, 4133, 4267 ],
}, { # OS != "win",
'defines': [