Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Unified Diff: crypto/encryptor.cc

Issue 1539353003: Switch to standard integer types in crypto/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « crypto/encryptor.h ('k') | crypto/encryptor_nss.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/encryptor.cc
diff --git a/crypto/encryptor.cc b/crypto/encryptor.cc
index a673f81c1781d47f2338adc220474d6a79d4b5da..7872774e301c6995505f6f922a64a7bff74f4fb7 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];
« no previous file with comments | « crypto/encryptor.h ('k') | crypto/encryptor_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698