summaryrefslogtreecommitdiffstats
path: root/crypto/p224.cc
diff options
context:
space:
mode:
authorwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-06 04:34:24 +0000
committerwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-06 04:34:24 +0000
commitdb5b1fbad334d44a1f29a6e718e34b67430dbe23 (patch)
tree0969bf9319e029e579a78a0bdfb678e2334206e8 /crypto/p224.cc
parent93e150069eca91ce80b59b8b0323d8eb947777d6 (diff)
downloadchromium_src-db5b1fbad334d44a1f29a6e718e34b67430dbe23.zip
chromium_src-db5b1fbad334d44a1f29a6e718e34b67430dbe23.tar.gz
chromium_src-db5b1fbad334d44a1f29a6e718e34b67430dbe23.tar.bz2
Avoid loading ws2_32.dll just to get htons() and friends.
Chrome does not load ws2_32.dll into the renderer sandbox, so code calling these functions would fail attempting to load the DLL. This CL replaces the calls with direct use of the MSVC byte-swap intrinsics. BUG=115477,116591 TEST=Chromoting client does not crash on connect on Windows. Review URL: http://codereview.chromium.org/9614004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125110 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'crypto/p224.cc')
-rw-r--r--crypto/p224.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/crypto/p224.cc b/crypto/p224.cc
index a7cc66b..d0e4baf 100644
--- a/crypto/p224.cc
+++ b/crypto/p224.cc
@@ -13,6 +13,14 @@
#include "base/sys_byteorder.h"
+#if defined(OS_WIN)
+// Allow htonl/ntohl to be called without requiring ws2_32.dll to be loaded,
+// which isn't available in Chrome's sandbox. See crbug.com/116591.
+// TODO(wez): Replace these calls with base::htonl() etc when available.
+#define ntohl(x) _byteswap_ulong(x)
+#define htonl(x) _byteswap_ulong(x)
+#endif // OS_WIN
+
namespace {
// Field element functions.