Skip to content

Commit b570e8e

Browse files
author
Revital1 Eres
committed
Fixes following Gidon's comments
1 parent 535d0e2 commit b570e8e

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

cpp/src/parquet/encryption_internal.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,7 @@ int AesEncryptor::AesEncryptorImpl::CtrEncrypt(const uint8_t* plaintext,
239239
// Parquet CTR IVs are comprised of a 12-byte nonce and a 4-byte initial
240240
// counter field.
241241
// The first 31 bits of the initial counter field are set to 0, the last bit
242-
// is set
243-
// to 1.
242+
// is set to 1.
244243
uint8_t iv[kCtrIvLength];
245244
memset(iv, 0, kCtrIvLength);
246245
std::copy(nonce, nonce + kNonceLength, iv);
@@ -600,8 +599,7 @@ std::string CreateFooterAad(const std::string& aad_prefix_bytes) {
600599
}
601600

602601
// Update last two bytes with new page ordinal (instead of creating new page AAD
603-
// from
604-
// scratch)
602+
// from scratch)
605603
void QuickUpdatePageAad(const std::string& AAD, int16_t new_page_ordinal) {
606604
std::string page_ordinal_bytes = ShortToBytesLe(new_page_ordinal);
607605
int length = static_cast<int>(AAD.size());

cpp/src/parquet/encryption_internal.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,23 @@ constexpr int8_t kDictionaryPageHeader = 5;
4343
constexpr int8_t kColumnIndex = 6;
4444
constexpr int8_t kOffsetIndex = 7;
4545

46-
/// Do AES_GCM_CTR_V1 or AES_GCM_V1 encryption
46+
/// Performs AES encryption operations with GCM or CTR ciphers.
4747
class AesEncryptor {
4848
public:
4949
static AesEncryptor* Make(ParquetCipher::type alg_id, int key_len, bool metadata,
5050
std::shared_ptr<std::vector<AesEncryptor*>> all_encryptors);
5151

5252
~AesEncryptor();
5353

54-
/// Size different between plaintext and ciphertext, for this cipher.
54+
/// Size difference between plaintext and ciphertext, for this cipher.
5555
int CiphertextSizeDelta();
5656

57-
/// Key length is passed only for validation. If different from value in
58-
/// constructor, exception will be thrown.
57+
/// Encrypts plaintext with the key and aad. Key length is passed only for validation.
58+
/// If different from value in constructor, exception will be thrown.
5959
int Encrypt(const uint8_t* plaintext, int plaintext_len, uint8_t* key, int key_len,
6060
uint8_t* aad, int aad_len, uint8_t* ciphertext);
6161

62+
/// Encrypts plaintext footer, in order to compute the signature (tag).
6263
int SignedFooterEncrypt(const uint8_t* footer, int footer_len, uint8_t* key,
6364
int key_len, uint8_t* aad, int aad_len, uint8_t* nonce,
6465
uint8_t* encrypted_footer);
@@ -73,7 +74,7 @@ class AesEncryptor {
7374
std::unique_ptr<AesEncryptorImpl> impl_;
7475
};
7576

76-
/// Do AES_GCM_CTR_V1 or AES_GCM_V1 decryption
77+
/// Performs AES decryption operations with GCM or CTR ciphers.
7778
class AesDecryptor {
7879
public:
7980
static AesDecryptor* Make(ParquetCipher::type alg_id, int key_len, bool metadata,
@@ -82,11 +83,11 @@ class AesDecryptor {
8283
~AesDecryptor();
8384
void WipeOut();
8485

85-
/// Size different between plaintext and ciphertext, for this cipher.
86+
/// Size difference between plaintext and ciphertext, for this cipher.
8687
int CiphertextSizeDelta();
8788

88-
/// Key length is passed only for validation. If different from value in
89-
/// constructor, exception will be thrown.
89+
/// Decrypts ciphertext with the key and aad. Key length is passed only for
90+
/// validation. If different from value in constructor, exception will be thrown.
9091
int Decrypt(const uint8_t* ciphertext, int ciphertext_len, uint8_t* key, int key_len,
9192
uint8_t* aad, int aad_len, uint8_t* plaintext);
9293

0 commit comments

Comments
 (0)