aboutsummaryrefslogtreecommitdiffstats
path: root/src/protocol.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-12-12 11:41:36 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-12-12 11:41:36 -0800
commit1a0131928e54fce0623afe1bea5799277b40be6a (patch)
tree210646de95a842270c17ed81ed7bee09d3db03fc /src/protocol.rs
parent66bf3345a944e087cf8b66a2fbbceb143873c5e4 (diff)
downloadgeniza-1a0131928e54fce0623afe1bea5799277b40be6a.tar.gz
geniza-1a0131928e54fce0623afe1bea5799277b40be6a.zip
start flushing out new APIs
Diffstat (limited to 'src/protocol.rs')
-rw-r--r--src/protocol.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/protocol.rs b/src/protocol.rs
index 2b23959..5940840 100644
--- a/src/protocol.rs
+++ b/src/protocol.rs
@@ -60,6 +60,7 @@ fn msg_sugar(msg: &DatNetMessage) -> &Message {
/// This helper is pretty slow/inefficient; lots of copying memory
fn bytewise_stream_xor_ic_inplace(buf: &mut [u8], byte_offset: u64, nonce: &Nonce, key: &Key) {
+ // TODO: switch to new stream_xor_ic_inplace() variant?
let mut offset = byte_offset;
// We may have a partial-64-byte-block to finish encrypting first
@@ -70,14 +71,14 @@ fn bytewise_stream_xor_ic_inplace(buf: &mut [u8], byte_offset: u64, nonce: &Nonc
for i in 0..partial_len {
partial[partial_offset + i] = buf[i];
}
- let partial_enc = stream_xor_ic(&partial, offset / 64, &nonce, &key);
+ let partial_enc = stream_xor_ic(&partial, &nonce, offset / 64, &key);
offset += partial_len as u64;
for i in 0..partial_len {
buf[i] = partial_enc[partial_offset + i];
}
}
if buf.len() > partial_len {
- let main_enc = stream_xor_ic(&buf[partial_len..], offset / 64, &nonce, &key);
+ let main_enc = stream_xor_ic(&buf[partial_len..], &nonce, offset / 64, &key);
//offset += main_enc.len() as u64;
for i in 0..main_enc.len() {
buf[partial_len + i] = main_enc[i];