File tree Expand file tree Collapse file tree
wrapper/rust/wolfssl-wolfcrypt/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -470,6 +470,7 @@ impl aead::AeadInPlace for XChaCha20Poly1305Aead {
470470 // single output buffer. Use a stack buffer to hold both, then split
471471 // the tag out and copy the ciphertext back over the caller's buffer.
472472 const MAX_INLINE : usize = 4096 ;
473+ debug_assert ! ( buffer. len( ) <= MAX_INLINE , "Maximum of 4096 bytes supported" ) ;
473474 if buffer. len ( ) > MAX_INLINE {
474475 return Err ( aead:: Error ) ;
475476 }
@@ -495,6 +496,7 @@ impl aead::AeadInPlace for XChaCha20Poly1305Aead {
495496 Ok ( tag)
496497 }
497498
499+ // This function can decrypt a maximum of 4096 bytes.
498500 fn decrypt_in_place_detached (
499501 & self ,
500502 nonce : & aead:: Nonce < Self > ,
@@ -505,6 +507,7 @@ impl aead::AeadInPlace for XChaCha20Poly1305Aead {
505507 // wc_XChaCha20Poly1305_Decrypt expects the auth tag appended after the
506508 // ciphertext. Build a combined [ciphertext | tag] buffer on the stack.
507509 const MAX_INLINE : usize = 4096 ;
510+ debug_assert ! ( buffer. len( ) <= MAX_INLINE , "Maximum of 4096 bytes supported" ) ;
508511 if buffer. len ( ) > MAX_INLINE {
509512 return Err ( aead:: Error ) ;
510513 }
You can’t perform that action at this time.
0 commit comments