Skip to content

Commit

Permalink
aes_gcm: Make it clearer in two cases that slicing can't panic.
Browse files Browse the repository at this point in the history
  • Loading branch information
briansmith committed Jun 12, 2024
1 parent 731f419 commit 16e33e0
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/aead/aes_gcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,14 @@ pub(super) fn seal(
)
};

&mut in_out[processed..]
match in_out.get_mut(processed..) {
Some(remaining) => remaining,
None => {
// This can't happen. If it did, then the assembly already
// caused a buffer overflow.
unreachable!()
}
}
}
};

Expand Down Expand Up @@ -206,7 +213,14 @@ pub(super) fn open(
xi,
)
};
&mut in_out[processed..]
match in_out.get_mut(processed..) {
Some(remaining) => remaining,
None => {
// This can't happen. If it did, then the assembly already
// caused a buffer overflow.
unreachable!()
}
}
}
};

Expand Down

0 comments on commit 16e33e0

Please sign in to comment.