Skip to content

fix(crypto): align cipher handle state and encodings - #3539

Merged
proggeramlug merged 2 commits into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-cipher-handle-overloads
May 31, 2026
Merged

proggeramlug merged 2 commits into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-cipher-handle-overloads

Conversation

@andrewtdiz

Copy link
Copy Markdown
Contributor

Summary

  • decode string input encodings and honor output encodings for cipher update/final overloads
  • align Cipher/Decipher invalid-state errors and hide incompatible GCM auth-tag methods by handle type
  • support AES-GCM with non-96-bit IVs by using the manual GCM counter/tag path and streaming GCM encryption output from update

Closes #2962
Closes #3381
Closes #3382

Tests

  • cargo check -p perry-stdlib
  • PERRY_NO_AUTO_OPTIMIZE=1 ./run_parity_tests.sh --suite node-suite --module crypto/cipher --filter invalid-state-errors
  • PERRY_NO_AUTO_OPTIMIZE=1 ./run_parity_tests.sh --suite node-suite --module crypto/cipher --filter update-string-encoding
  • PERRY_NO_AUTO_OPTIMIZE=1 ./run_parity_tests.sh --suite node-suite --module crypto/cipher --filter aes-gcm-non-96-iv
  • PERRY_NO_AUTO_OPTIMIZE=1 ./run_parity_tests.sh --suite node-suite --module crypto/cipher
  • cargo fmt --check
  • git diff --check
  • ./scripts/check_file_size.sh (fails on pre-existing crates/perry-runtime/src/process.rs at 2047 lines; unchanged from origin/main)

# Conflicts:
#	crates/perry-stdlib/src/crypto/cipher.rs
@proggeramlug
proggeramlug merged commit c645a34 into PerryTS:main May 31, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants