Skip to content

Commit

Permalink
cast fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ggershinsky committed May 28, 2019
1 parent dfe98ee commit 1a99725
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cpp/src/parquet/util/crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ int gcm_encrypt(const uint8_t* plaintext, int plaintext_len, uint8_t* key, int k

// Copying the buffer size, nonce and tag to ciphertext
int bufferSize = nonce_len + ciphertext_len + gcmTagLen;
ciphertext[3] = 0xff & (bufferSize >> 24);
ciphertext[2] = 0xff & (bufferSize >> 16);
ciphertext[1] = 0xff & (bufferSize >> 8);
ciphertext[0] = 0xff & (bufferSize);
ciphertext[3] = (uint8_t)(0xff & (bufferSize >> 24));
ciphertext[2] = (uint8_t)(0xff & (bufferSize >> 16));
ciphertext[1] = (uint8_t)(0xff & (bufferSize >> 8));
ciphertext[0] = (uint8_t)(0xff & (bufferSize));
std::copy(nonce, nonce + nonce_len, ciphertext + bufferSizeLen);
std::copy(tag, tag + gcmTagLen, ciphertext + bufferSizeLen + nonce_len + ciphertext_len);

Expand Down Expand Up @@ -233,10 +233,10 @@ int ctr_encrypt(const uint8_t* plaintext, int plaintext_len, uint8_t* key, int k

// Copying the buffer size and nonce to ciphertext
int bufferSize = nonceLen + ciphertext_len;
ciphertext[3] = 0xff & (bufferSize >> 24);
ciphertext[2] = 0xff & (bufferSize >> 16);
ciphertext[1] = 0xff & (bufferSize >> 8);
ciphertext[0] = 0xff & (bufferSize);
ciphertext[3] = (uint8_t)(0xff & (bufferSize >> 24));
ciphertext[2] = (uint8_t)(0xff & (bufferSize >> 16));
ciphertext[1] = (uint8_t)(0xff & (bufferSize >> 8));
ciphertext[0] = (uint8_t)(0xff & (bufferSize));
std::copy(nonce, nonce + nonceLen, ciphertext + bufferSizeLen);

return bufferSizeLen + bufferSize;
Expand Down

0 comments on commit 1a99725

Please sign in to comment.