Commit ad5d3378 authored by ldixon@google.com's avatar ldixon@google.com

Updated usrsctp to fix various issues for windows (using changes pushed...

Updated usrsctp to fix various issues for windows (using changes pushed upstream) and unified SHA1 treatment with libjingle. 

Note: HAVE_SCTP is still currently turned off for windows (while investigating an apparent issue in win xp)

(patch from issue 19522005; exactly the same, except HAVE_SCTP is not turned on for windows)

BUG=

Review URL: https://chromiumcodereview.appspot.com/21968004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215983 0039d316-1c4b-4281-b951-d872f2087c98
parent 36499f88
......@@ -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",
......
......@@ -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
This diff is collapsed.
......@@ -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
......@@ -61,4 +61,4 @@ typedef struct sha1_context SHA1_CTX;
#define SHA1_Final SCTP_NSS_SHA1_Final
#endif /* _KERNEL */
#endif
#endif /* __SCTP_NSS_SHA1_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>
......
......@@ -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__ */
......@@ -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': [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment