Rename encrypt_append() to encrypt()

This commit is contained in:
Joe Birr-Pixton committed 2026-10-16 15:00:52 +00:00
1 parent 7270583a06
commit bb2165fa87
11 files changed
+21 -21

No files matched your search

+3 -3
View File
@@ -325,7 +325,7 @@ impl RecordDecrypter for GcmRecordDecrypter {
}
impl RecordEncrypter for GcmRecordEncrypter {
fn encrypt_append(
fn encrypt(
&mut self,
msg: Record<OutboundPlain<'_>>,
seq: u64,
@@ -435,7 +435,7 @@ impl RecordDecrypter for ChaCha20Poly1305RecordDecrypter {
}
impl RecordEncrypter for ChaCha20Poly1305RecordEncrypter {
fn encrypt_append(
fn encrypt(
&mut self,
msg: Record<OutboundPlain<'_>>,
seq: u64,
@@ -637,7 +637,7 @@ mod tests {
let payload_len = encrypter.encrypted_payload_len(record.payload.len());
let mut out = vec![fill; PREFIX_LEN];
encrypter
.encrypt_append(record, TEST_SEQ, &mut out)
.encrypt(record, TEST_SEQ, &mut out)
.unwrap();
assert_eq!(out[..PREFIX_LEN], [fill; PREFIX_LEN]);
assert_eq!(out.len(), PREFIX_LEN + HEADER_LEN + payload_len);
+3 -3
View File
@@ -238,7 +238,7 @@ struct AeadRecordDecrypter {
}
impl RecordEncrypter for AeadRecordEncrypter {
fn encrypt_append(
fn encrypt(
&mut self,
msg: Record<OutboundPlain<'_>>,
seq: u64,
@@ -328,7 +328,7 @@ struct GcmRecordEncrypter {
}
impl RecordEncrypter for GcmRecordEncrypter {
fn encrypt_append(
fn encrypt(
&mut self,
msg: Record<OutboundPlain<'_>>,
seq: u64,
@@ -555,7 +555,7 @@ mod tests {
let payload_len = encrypter.encrypted_payload_len(record.payload.len());
let mut out = vec![fill; PREFIX_LEN];
encrypter
.encrypt_append(record, TEST_SEQ, &mut out)
.encrypt(record, TEST_SEQ, &mut out)
.unwrap();
assert_eq!(out[..PREFIX_LEN], [fill; PREFIX_LEN]);
assert_eq!(out.len(), PREFIX_LEN + HEADER_LEN + payload_len);
+2 -2
View File
@@ -318,7 +318,7 @@ impl Tls12AeadAlgorithm for Aead {
struct Tls13Cipher;
impl RecordEncrypter for Tls13Cipher {
fn encrypt_append(
fn encrypt(
&mut self,
record: Record<OutboundPlain<'_>>,
seq: u64,
@@ -388,7 +388,7 @@ impl RecordDecrypter for Tls13Cipher {
struct Tls12Cipher;
impl RecordEncrypter for Tls12Cipher {
fn encrypt_append(
fn encrypt(
&mut self,
record: Record<OutboundPlain<'_>>,
seq: u64,
+2 -2
View File
@@ -297,7 +297,7 @@ impl RecordDecrypter for GcmRecordDecrypter {
}
impl RecordEncrypter for GcmRecordEncrypter {
fn encrypt_append(
fn encrypt(
&mut self,
record: Record<OutboundPlain<'_>>,
seq: u64,
@@ -388,7 +388,7 @@ impl RecordDecrypter for ChaCha20Poly1305RecordDecrypter {
}
impl RecordEncrypter for ChaCha20Poly1305RecordEncrypter {
fn encrypt_append(
fn encrypt(
&mut self,
record: Record<OutboundPlain<'_>>,
seq: u64,
+1 -1
View File
@@ -209,7 +209,7 @@ struct Tls13RecordDecrypter {
}
impl RecordEncrypter for Tls13RecordEncrypter {
fn encrypt_append(
fn encrypt(
&mut self,
record: Record<OutboundPlain<'_>>,
seq: u64,
+2 -2
View File
@@ -1576,7 +1576,7 @@ impl RawTls {
let msg = msg.borrow_outbound();
let mut record = vec![];
self.encrypter
.encrypt_append(msg, self.enc_seq, &mut record)
.encrypt(msg, self.enc_seq, &mut record)
.unwrap();
self.enc_seq += 1;
@@ -2039,7 +2039,7 @@ mod plaintext {
struct Encrypter;
impl RecordEncrypter for Encrypter {
fn encrypt_append(
fn encrypt(
&mut self,
record: Record<OutboundPlain<'_>>,
_seq: u64,
+1 -1
View File
@@ -1228,7 +1228,7 @@ fn move_encrypted_extensions_into_server_hello(
payload: Payload::Borrowed(remainder),
};
encrypter
.encrypt_append(remainder.borrow_outbound(), 0, &mut output)
.encrypt(remainder.borrow_outbound(), 0, &mut output)
.unwrap();
output
}
+2 -2
View File
@@ -724,7 +724,7 @@ fn client_requiring_rpk_receives_server_ee(
let ee = ee.borrow_outbound();
let mut enc_ee = Vec::new();
encrypter
.encrypt_append(ee, 0, &mut enc_ee)
.encrypt(ee, 0, &mut enc_ee)
.unwrap();
input
@@ -868,7 +868,7 @@ fn test_client_rejects_protected_change_cipher_spec() {
let ccs = ccs.borrow_outbound();
let mut enc_ccs = Vec::new();
encrypter
.encrypt_append(ccs, 0, &mut enc_ccs)
.encrypt(ccs, 0, &mut enc_ccs)
.unwrap();
input
+1 -1
View File
@@ -378,7 +378,7 @@ impl Encrypting {
let seq = self.write_seq;
self.write_seq += 1;
self.encrypter
.encrypt_append(plain, seq, output)
.encrypt(plain, seq, output)
}
fn send_key_update_request(&mut self, tls: &mut Vec<u8>) -> Result<(), Error> {
+2 -2
View File
@@ -163,7 +163,7 @@ pub trait RecordEncrypter: Send + Sync {
/// A full wire-format TLS record, including all framing the ciphersuite requires,
/// such as any explicit nonce, padding and/or authentication tag, must be appended to `out`.
/// Any existing data on the front of `out` must be left alone.
fn encrypt_append(
fn encrypt(
&mut self,
record: Record<OutboundPlain<'_>>,
seq: u64,
@@ -175,7 +175,7 @@ pub trait RecordEncrypter: Send + Sync {
/// For a zero `payload_len` this should return the _minimum_ overhead for any
/// payload. Then, to fragment a long payload into chunks of length `F`,
/// Rustls will first set `A := encrypted_payload_len(0)` and then supply the
/// payload to [`Self::encrypt_append()`] in chunks of length `F - A`. Each `encrypt_append()`
/// payload to [`Self::encrypt()`] in chunks of length `F - A`. Each `encrypt()`
/// is then free to pad or otherwise transform the length at its option.
fn encrypted_payload_len(&self, payload_len: usize) -> usize;
}
+2 -2
View File
@@ -380,7 +380,7 @@ impl Tls12AeadAlgorithm for Aead {
pub(crate) struct Tls13Cipher;
impl RecordEncrypter for Tls13Cipher {
fn encrypt_append(
fn encrypt(
&mut self,
record: Record<OutboundPlain<'_>>,
seq: u64,
@@ -452,7 +452,7 @@ impl RecordDecrypter for Tls13Cipher {
struct Tls12Cipher;
impl RecordEncrypter for Tls12Cipher {
fn encrypt_append(
fn encrypt(
&mut self,
record: Record<OutboundPlain<'_>>,
seq: u64,