Skip to content

feat!: make AES128 decrypt oracle return Option#21696

Merged
nventuro merged 3 commits intomerge-train/fairiesfrom
feat/f-452-try-aes128-decrypt
Mar 17, 2026
Merged

feat!: make AES128 decrypt oracle return Option#21696
nventuro merged 3 commits intomerge-train/fairiesfrom
feat/f-452-try-aes128-decrypt

Conversation

@nchamo
Copy link
Contributor

@nchamo nchamo commented Mar 17, 2026

Summary

  • Rename AES128 decrypt oracle from aztec_utl_aes128Decrypt to aztec_utl_tryAes128Decrypt, returning Option<BoundedVec<u8, N>> instead of BoundedVec<u8, N>
  • Wrap TS decrypt calls (PXE + TXE) in try/catch so Barretenberg exceptions on malformed input return Option::none() instead of crashing the process
  • Update legacy utilityAes128Decrypt mapping to strip the Option wrapper and re-throw on failure (preserving old error semantics for pinned contracts)

Fixes F-452

@nchamo nchamo requested a review from nventuro as a code owner March 17, 2026 17:35
@nchamo nchamo self-assigned this Mar 17, 2026
@nchamo nchamo changed the title feat!(aztec-nr,pxe,txe): make AES128 decrypt oracle return Option feat!: make AES128 decrypt oracle return Option Mar 17, 2026
): Promise<(ACVMField | ACVMField[])[]> =>
oracle.aztec_utl_aes128Decrypt(ciphertextBVecStorage, ciphertextLength, iv, symKey),
): Promise<(ACVMField | ACVMField[])[]> => {
// Strip the Option wrapper: new oracle returns [some, storage, length], legacy callers expect [storage, length].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be good to explain that the old oracle received a bounded vec and that we're now returning an option.

Is this oracle part of the legacy set though? I don't think any protocol or standard contract does decryptino of any kind.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, it wasn't being used. I don't know how I missed it during my last review. Will delete it then

try_aes128_decrypt(header_ciphertext_bvec, header_iv, header_sym_key)
// Extract ciphertext length from header (2 bytes, big-endian)
extract_ciphertext_length(header_plaintext)
.and_then(|header_plaintext| extract_ciphertext_length(header_plaintext))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shame that we get no warnings here no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nchamo nchamo requested a review from nventuro March 17, 2026 19:14
@nventuro nventuro merged commit e9cab7c into merge-train/fairies Mar 17, 2026
11 checks passed
@nventuro nventuro deleted the feat/f-452-try-aes128-decrypt branch March 17, 2026 19:40
@AztecBot
Copy link
Collaborator

❌ Failed to cherry-pick to v4-next due to conflicts. (🤖) View backport run.

github-merge-queue bot pushed a commit that referenced this pull request Mar 18, 2026
BEGIN_COMMIT_OVERRIDE
fix(stdlib): accept null return_type for void Noir functions (#21647)
feat!: make AES128 decrypt oracle return Option (#21696)
fix(aztec-nr): fix OOB index with nonzero offset (#21613)
feat!: include init_hash in private initialization nullifier to prevent
privacy leak (#21427)
END_COMMIT_OVERRIDE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants