adamreeve commented on code in PR #43195:
URL: https://github.com/apache/arrow/pull/43195#discussion_r1671571252
##########
cpp/src/parquet/encryption/encryption_internal.cc:
##########
@@ -58,20 +58,39 @@ class AesEncryptor::AesEncryptorImpl {
~AesEncryptorImpl() { WipeOut(); }
- int Encrypt(const uint8_t* plaintext, int plaintext_len, const uint8_t* key,
- int key_len, const uint8_t* aad, int aad_len, uint8_t*
ciphertext);
+ int Encrypt(span<const uint8_t> plaintext, span<const uint8_t> key,
+ span<const uint8_t> aad, span<uint8_t> ciphertext);
- int SignedFooterEncrypt(const uint8_t* footer, int footer_len, const
uint8_t* key,
- int key_len, const uint8_t* aad, int aad_len,
- const uint8_t* nonce, uint8_t* encrypted_footer);
+ int SignedFooterEncrypt(span<const uint8_t> footer, span<const uint8_t> key,
+ span<const uint8_t> aad, span<const uint8_t> nonce,
+ span<uint8_t> encrypted_footer);
void WipeOut() {
if (nullptr != ctx_) {
EVP_CIPHER_CTX_free(ctx_);
ctx_ = nullptr;
}
}
- int ciphertext_size_delta() { return ciphertext_size_delta_; }
+ [[nodiscard]] int CiphertextLength(int64_t plaintext_len) const {
+ if (plaintext_len < 0) {
+ std::stringstream ss;
+ ss << "Negative plaintext length " << plaintext_len;
+ throw ParquetException(ss.str());
+ } else if (plaintext_len > std::numeric_limits<int32_t>::max()) {
Review Comment:
Hmm yeah I opened #43141 in response to some feedback from #43071 for
changing uses of `int` in the Encryptor and Decryptor APIs to `int32_t`, but
given this is a new method I think it makes sense to just change this to
`int32_t` now.
--
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]