dmitry-chirkov-dremio opened a new issue, #53776:
URL: https://github.com/apache/arrow/issues/53776

   ### Describe the enhancement requested
   
   ### Describe the enhancement requested
   
   Gandiva's `aes_encrypt` / `aes_decrypt` (ARROW-14431) support only AES-ECB 
and operate on VARCHAR. ECB is deterministic and unauthenticated: identical 
plaintext blocks give identical ciphertext, there is no IV, and tampering goes 
undetected. VARCHAR is also a poor fit for ciphertext, which is arbitrary bytes.
   
   This adds binary `encrypt` / `decrypt` functions with modern cipher modes:
   
       encrypt(data, key, mode)
       encrypt(data, key, mode, iv)
       encrypt(data, key, mode, iv, aad)   -- decrypt has the same overloads
   
   All arguments and results are `binary`.
   
   - Modes: `AES-ECB`, `AES-CBC` (PKCS#7 by default, `-NONE` variants), 
`AES-GCM`; 16/24/32-byte keys.
   - GCM: caller-supplied nonce and optional AAD. Output is `ciphertext || 
16-byte tag`; `decrypt` verifies the tag and errors on any key, IV, AAD or 
ciphertext mismatch.
   - IV and AAD are caller-managed and not embedded in the output. A NULL 
argument yields NULL. Failures are reported as Gandiva function errors with the 
OpenSSL diagnostic.
   - The registry functions `aes_encrypt` / `aes_decrypt` keep their signatures 
and output and are routed through the new implementation. They stay ECB-only 
and are not recommended for new use.
   
   Testing: all modes and key sizes, invalid key/IV/padding, GCM tag and AAD 
mismatch, block-aligned inputs, and known-answer vectors from the GCM 
specification (McGrew and Viega, test cases 4-6; 12-, 8- and 60-byte IVs).
   
   Related: #50522 (output sizing in the current `aes_encrypt` stub; the new 
implementation sizes buffers independently of key length), #45693, #29995.
   
   A PR will follow.
   
   ### Component(s)
   
   C++, Gandiva
   
   
   ### Component(s)
   
   C++, Gandiva


-- 
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