Skip to content

Commit

Permalink
Fix compilation issues (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspervdm authored Feb 24, 2020
1 parent bf27520 commit b56afda
Show file tree
Hide file tree
Showing 6 changed files with 182 additions and 163 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions api/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ impl EncryptedBody {
let nonce = from_hex(self.nonce.clone()).context(ErrorKind::APIEncryption(
"EncryptedBody Dec: Invalid Nonce".to_string(),
))?;
if nonce.len() < 12 {
return Err(ErrorKind::APIEncryption(
"EncryptedBody Dec: Invalid Nonce length".to_string(),
)
.into());
}
let mut n = [0u8; 12];
n.copy_from_slice(&nonce[0..12]);
let unbound_key = aead::UnboundKey::new(&aead::AES_256_GCM, &dec_key.0).unwrap();
Expand Down
Loading

0 comments on commit b56afda

Please sign in to comment.