diff options
author | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-28 20:19:31 +0000 |
---|---|---|
committer | wez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-28 20:19:31 +0000 |
commit | 9eb7b11b614e987d7608678d0396873f37ca817e (patch) | |
tree | 7f222f4ae73bd3c3edc33d39f3bf7050d10f4254 /crypto/encryptor.cc | |
parent | 97f37d558f60a245190b17ce14d3d9039fc83767 (diff) | |
download | chromium_src-9eb7b11b614e987d7608678d0396873f37ca817e.zip chromium_src-9eb7b11b614e987d7608678d0396873f37ca817e.tar.gz chromium_src-9eb7b11b614e987d7608678d0396873f37ca817e.tar.bz2 |
Add base::HostToNetXX() & NetToHostXX(), and use them to replace htonX() & ntohX() in Chrome.
This primarily addresses issues with code using the OS-provided htonX() & ntohX() functions from within the Chrome sandbox. Under Windows these functions are provided by ws2_32.dll, which is no longer available within Chrome's sandbox.
The new base::HostToNetXX() and NetToHostXX() functions are safe for use by sandboxed code on Windows, and provide a single place where future fixes for other platforms can be made.
BUG=117252
Review URL: http://codereview.chromium.org/9716020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129476 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'crypto/encryptor.cc')
-rw-r--r-- | crypto/encryptor.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/encryptor.cc b/crypto/encryptor.cc index 31a7cc8..a673f81 100644 --- a/crypto/encryptor.cc +++ b/crypto/encryptor.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,14 +21,14 @@ Encryptor::Counter::~Counter() { } bool Encryptor::Counter::Increment() { - uint64 low_num = base::ntohll(counter_.components64[1]); + uint64 low_num = base::NetToHost64(counter_.components64[1]); uint64 new_low_num = low_num + 1; - counter_.components64[1] = base::htonll(new_low_num); + counter_.components64[1] = base::HostToNet64(new_low_num); // If overflow occured then increment the most significant component. if (new_low_num < low_num) { counter_.components64[0] = - base::htonll(base::ntohll(counter_.components64[0]) + 1); + base::HostToNet64(base::NetToHost64(counter_.components64[0]) + 1); } // TODO(hclam): Return false if counter value overflows. |