Compare commits

..

2 commits

Author SHA1 Message Date
ac52c20e3b
More flexible build script 2021-10-30 19:43:03 -07:00
d2084f369e
Fix split_off bug 2021-10-30 19:42:51 -07:00
2 changed files with 3 additions and 3 deletions

View file

@ -24,5 +24,5 @@ strip target/release/omegaupload-server
cp target/release/omegaupload-server dist/omegaupload-server cp target/release/omegaupload-server dist/omegaupload-server
tar -cvf dist.tar dist tar -cvf dist.tar dist
rm -r dist.tar.zst rm -rf dist.tar.zst
zstd -T0 --ultra --rm -22 dist.tar zstd -T0 --ultra --rm -22 dist.tar

View file

@ -92,7 +92,7 @@ pub fn open_in_place(data: &mut Vec<u8>, key: &Key, password: Option<&str>) -> R
None None
}; };
let nonce = Nonce::from_slice(&data.split_off(Nonce::SIZE)); let nonce = Nonce::from_slice(&data.split_off(buffer_len - Nonce::SIZE));
// At this point we should have a buffer that's only the ciphertext. // At this point we should have a buffer that's only the ciphertext.
@ -111,7 +111,7 @@ pub fn open_in_place(data: &mut Vec<u8>, key: &Key, password: Option<&str>) -> R
#[must_use] #[must_use]
fn gen_key_nonce() -> (Key, Nonce) { fn gen_key_nonce() -> (Key, Nonce) {
let mut rng = thread_rng(); let mut rng = thread_rng();
let mut key: Key = GenericArray::default(); let mut key = GenericArray::default();
rng.fill(key.as_mut_slice()); rng.fill(key.as_mut_slice());
let mut nonce = Nonce::default(); let mut nonce = Nonce::default();
rng.fill(nonce.as_mut_slice()); rng.fill(nonce.as_mut_slice());