adamreeve commented on code in PR #43195:
URL: https://github.com/apache/arrow/pull/43195#discussion_r1673413697


##########
cpp/src/parquet/encryption/encryption_internal.cc:
##########
@@ -227,45 +269,54 @@ int AesEncryptor::AesEncryptorImpl::GcmEncrypt(const 
uint8_t* plaintext,
     ciphertext[1] = static_cast<uint8_t>(0xff & (buffer_size >> 8));
     ciphertext[0] = static_cast<uint8_t>(0xff & (buffer_size));
   }
-  std::copy(nonce, nonce + kNonceLength, ciphertext + length_buffer_length_);
+  std::copy(nonce.begin(), nonce.begin() + kNonceLength,
+            ciphertext.begin() + length_buffer_length_);
   std::copy(tag, tag + kGcmTagLength,
-            ciphertext + length_buffer_length_ + kNonceLength + 
ciphertext_len);
+            ciphertext.begin() + length_buffer_length_ + kNonceLength + 
ciphertext_len);
 
   return length_buffer_length_ + buffer_size;
 }
 
-int AesEncryptor::AesEncryptorImpl::CtrEncrypt(const uint8_t* plaintext,
-                                               int plaintext_len, const 
uint8_t* key,
-                                               int key_len, const uint8_t* 
nonce,
-                                               uint8_t* ciphertext) {
+int AesEncryptor::AesEncryptorImpl::CtrEncrypt(span<const uint8_t> plaintext,
+                                               span<const uint8_t> key,
+                                               span<const uint8_t> nonce,
+                                               span<uint8_t> ciphertext) {
   int len;
   int ciphertext_len;
 
+  if (nonce.size() < static_cast<size_t>(kNonceLength)) {

Review Comment:
   I've changed this to equality too



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to