summaryrefslogtreecommitdiffstats
path: root/crypto/encryptor.cc
diff options
context:
space:
mode:
authoravi <avi@chromium.org>2015-12-21 13:34:43 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-21 21:35:49 +0000
commitdd373b8b7d7501cf7f3bbfe861f58dce67578a69 (patch)
tree037d2922a3dc5079e1eff59e9a3eb5fe3c605fa0 /crypto/encryptor.cc
parent64114156487081d877b793d3a501a8658743141d (diff)
downloadchromium_src-dd373b8b7d7501cf7f3bbfe861f58dce67578a69.zip
chromium_src-dd373b8b7d7501cf7f3bbfe861f58dce67578a69.tar.gz
chromium_src-dd373b8b7d7501cf7f3bbfe861f58dce67578a69.tar.bz2
Switch to standard integer types in crypto/.
BUG=138542 TBR=rsleevi@chromium.org NOPRESUBMIT=true Review URL: https://codereview.chromium.org/1539353003 Cr-Commit-Position: refs/heads/master@{#366460}
Diffstat (limited to 'crypto/encryptor.cc')
-rw-r--r--crypto/encryptor.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/crypto/encryptor.cc b/crypto/encryptor.cc
index a673f81..7872774 100644
--- a/crypto/encryptor.cc
+++ b/crypto/encryptor.cc
@@ -4,6 +4,9 @@
#include "crypto/encryptor.h"
+#include <stddef.h>
+#include <stdint.h>
+
#include "base/logging.h"
#include "base/sys_byteorder.h"
@@ -21,8 +24,8 @@ Encryptor::Counter::~Counter() {
}
bool Encryptor::Counter::Increment() {
- uint64 low_num = base::NetToHost64(counter_.components64[1]);
- uint64 new_low_num = low_num + 1;
+ uint64_t low_num = base::NetToHost64(counter_.components64[1]);
+ uint64_t new_low_num = low_num + 1;
counter_.components64[1] = base::HostToNet64(new_low_num);
// If overflow occured then increment the most significant component.
@@ -36,7 +39,7 @@ bool Encryptor::Counter::Increment() {
}
void Encryptor::Counter::Write(void* buf) {
- uint8* buf_ptr = reinterpret_cast<uint8*>(buf);
+ uint8_t* buf_ptr = reinterpret_cast<uint8_t*>(buf);
memcpy(buf_ptr, &counter_, sizeof(counter_));
}
@@ -58,7 +61,7 @@ bool Encryptor::SetCounter(const base::StringPiece& counter) {
}
bool Encryptor::GenerateCounterMask(size_t plaintext_len,
- uint8* mask,
+ uint8_t* mask,
size_t* mask_len) {
DCHECK_EQ(CTR, mode_);
CHECK(mask);
@@ -86,9 +89,9 @@ void Encryptor::MaskMessage(const void* plaintext,
const void* mask,
void* ciphertext) const {
DCHECK_EQ(CTR, mode_);
- const uint8* plaintext_ptr = reinterpret_cast<const uint8*>(plaintext);
- const uint8* mask_ptr = reinterpret_cast<const uint8*>(mask);
- uint8* ciphertext_ptr = reinterpret_cast<uint8*>(ciphertext);
+ const uint8_t* plaintext_ptr = reinterpret_cast<const uint8_t*>(plaintext);
+ const uint8_t* mask_ptr = reinterpret_cast<const uint8_t*>(mask);
+ uint8_t* ciphertext_ptr = reinterpret_cast<uint8_t*>(ciphertext);
for (size_t i = 0; i < plaintext_len; ++i)
ciphertext_ptr[i] = plaintext_ptr[i] ^ mask_ptr[i];