Lines Matching defs:output

536     /// Providing no output buffer will cause the input to be considered additional authenticated data (AAD).
538 /// Returns the number of bytes written to `output`.
542 /// Panics if `output` doesn't contain enough space for data to be
548 output: Option<&mut [u8]>,
550 if let Some(output) = &output {
557 output.len() >= min_output_size,
563 unsafe { self.cipher_update_unchecked(input, output) }
568 /// Providing no output buffer will cause the input to be considered additional authenticated data (AAD).
570 /// Returns the number of bytes written to `output`.
573 /// output size check removed. It can be used when the exact
577 /// The caller is expected to provide `output` buffer
579 /// ciphers the output buffer size should be at least as big as
580 /// the input buffer. For block ciphers the size of the output
586 output: Option<&mut [u8]>,
594 output.map_or(ptr::null_mut(), |b| b.as_mut_ptr()),
603 /// Like [`Self::cipher_update`] except that it appends output to a [`Vec`].
607 output: &mut Vec<u8>,
609 let base = output.len();
610 output.resize(base + input.len() + self.block_size(), 0);
611 let len = self.cipher_update(input, Some(&mut output[base..]))?;
612 output.truncate(base + len);
617 /// Like [`Self::cipher_update`] except that it writes output into the
623 /// Note: Use [`Self::cipher_update`] with no output argument to write AAD.
628 /// exceeds the buffer size, or if the output buffer does not contain enough
663 /// Any remaining data will be written to the output buffer.
665 /// Returns the number of bytes written to `output`.
669 /// Panics if `output` is smaller than the cipher's block size.
671 pub fn cipher_final(&mut self, output: &mut [u8]) -> Result<usize, ErrorStack> {
674 assert!(output.len() >= block_size);
677 unsafe { self.cipher_final_unchecked(output) }
682 /// Any remaining data will be written to the output buffer.
684 /// Returns the number of bytes written to `output`.
687 /// the output buffer size check removed.
690 /// The caller is expected to provide `output` buffer
692 /// ciphers the output buffer can be empty, for block ciphers the
693 /// output buffer should be at least as big as the block.
697 output: &mut [u8],
703 output.as_mut_ptr(),
710 /// Like [`Self::cipher_final`] except that it appends output to a [`Vec`].
711 pub fn cipher_final_vec(&mut self, output: &mut Vec<u8>) -> Result<usize, ErrorStack> {
712 let base = output.len();
713 output.resize(base + self.block_size(), 0);
714 let len = self.cipher_final(&mut output[base..])?;
715 output.truncate(base + len);
831 // this is a streaming cipher so the number of output bytes
833 let mut output = vec![0; 32];
835 .cipher_update(&[1; 15], Some(&mut output[0..15]))
840 // as previously it will output the same number of bytes as
843 .cipher_update(&[1; 17], Some(&mut output[15..]))
867 assert_eq!(data_inplace.as_slice(), output.as_slice());
875 // expect that the output for stream cipher will contain
879 .cipher_update(&output[0..15], Some(&mut output_decrypted[0..15]))
884 .cipher_update(&output[15..], Some(&mut output_decrypted[15..]))
892 // decrypt again, but now the output in-place
896 let outlen = ctx.cipher_update_inplace(&mut output[0..15], 15).unwrap();
899 let outlen = ctx.cipher_update_inplace(&mut output[15..], 17).unwrap();
903 assert_eq!(output_decrypted, output);