aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2017-12-05 00:27:38 -0800
committerbnewbold <bnewbold@robocracy.org>2017-12-06 00:06:10 -0800
commitf27bc0b98bfa5337354dca6baa866c6736278c49 (patch)
treebeec5f7f5201161641d180fb41b90e5d808ba333 /src
parentd542e4e12df6031139f5ff9c8cc607b8524cf948 (diff)
downloadgeniza-f27bc0b98bfa5337354dca6baa866c6736278c49.tar.gz
geniza-f27bc0b98bfa5337354dca6baa866c6736278c49.zip
switch to new upstream sodiumoxide
the stream_xor_ic() function was added to the sodiumoxide API upstream, so my hack-y branch is not longer required.
Diffstat (limited to 'src')
-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];