Skip to content

Commit

Permalink
rename encrypt fns
Browse files Browse the repository at this point in the history
  • Loading branch information
sinui0 committed Oct 6, 2023
1 parent 142d4c4 commit 5347d6e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion garble/mpz-garble-core/src/evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub(crate) fn and_gate(
let k = Block::new(((gid + 1) as u128).to_be_bytes());

let mut h = [x, y];
cipher.tccr_many_inplace(&[j, k], &mut h);
cipher.tccr_many(&[j, k], &mut h);

let [hx, hy] = h;

Expand Down
2 changes: 1 addition & 1 deletion garble/mpz-garble-core/src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub(crate) fn and_gate(
let k = Block::new(((gid + 1) as u128).to_be_bytes());

let mut h = [x_0, y_0, x_1, y_1];
cipher.tccr_many_inplace(&[j, k, j, k], &mut h);
cipher.tccr_many(&[j, k, j, k], &mut h);

let [hx_0, hy_0, hx_1, hy_1] = h;

Expand Down
14 changes: 7 additions & 7 deletions mpz-core/src/aes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl FixedKeyAes {
/// * `tweaks` - The tweaks to use for each block in `blocks`.
/// * `blocks` - The blocks to hash in-place.
#[inline]
pub fn tccr_many_inplace<const N: usize>(&self, tweaks: &[Block; N], blocks: &mut [Block; N]) {
pub fn tccr_many<const N: usize>(&self, tweaks: &[Block; N], blocks: &mut [Block; N]) {
// Store π(x) in `blocks`
self.aes
.encrypt_blocks(Block::as_generic_array_mut_slice(blocks));
Expand Down Expand Up @@ -90,7 +90,7 @@ impl FixedKeyAes {
///
/// * `blocks` - The blocks to hash in-place.
#[inline]
pub fn cr_many_inplace<const N: usize>(&self, blocks: &mut [Block; N]) {
pub fn cr_many<const N: usize>(&self, blocks: &mut [Block; N]) {
let mut buf = *blocks;

self.aes
Expand Down Expand Up @@ -124,9 +124,9 @@ impl FixedKeyAes {
///
/// * `blocks` - The blocks to hash in-place.
#[inline]
pub fn ccr_many_inplace<const N: usize>(&self, blocks: &mut [Block; N]) {
pub fn ccr_many<const N: usize>(&self, blocks: &mut [Block; N]) {
blocks.iter_mut().for_each(|b| *b = Block::sigma(*b));
self.cr_many_inplace(blocks);
self.cr_many(blocks);
}
}

Expand Down Expand Up @@ -160,9 +160,9 @@ impl AesEncryptor {
blks
}

/// Encrypt many blocks in-place.
/// Encrypt slice of blocks in-place.
#[inline]
pub fn encrypt_many_blocks_inplace(&self, blks: &mut [Block]) {
pub fn encrypt_blocks(&self, blks: &mut [Block]) {
self.0
.encrypt_blocks(Block::as_generic_array_mut_slice(blks));
}
Expand All @@ -188,7 +188,7 @@ impl AesEncryptor {
keys.iter()
.zip(blks.chunks_exact_mut(NM))
.for_each(|(key, blks)| {
key.encrypt_many_blocks_inplace(blks);
key.encrypt_blocks(blks);
});
}
}
Expand Down

0 comments on commit 5347d6e

Please sign in to comment.