diff options
Diffstat (limited to 'crypto/encryptor.cc')
-rw-r--r-- | crypto/encryptor.cc | 17 |
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]; |