]> git.proxmox.com Git - proxmox-backup.git/commitdiff
cipherbench: be conform with rfc7539, use 12 byte nonce
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 17 Dec 2019 07:45:20 +0000 (08:45 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 17 Dec 2019 07:49:07 +0000 (08:49 +0100)
else we get an error from this call, using a 16 byte (128 bit) nonce
is currently only supported by the still in draft
XChaCha20-Poly1305, not the current default specified by RFC 7539[0],
which uses a 12 byte (96 bit) nonce.

Fixes the following error:
> thread 'main' panicked at 'called `Result::unwrap()` on an `Err`
> value: ErrorStack([])', src/libcore/result.rs:1165:5

[0]: https://tools.ietf.org/html/rfc7539

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/bin/cipherbench.rs

index 590c102426df6748413a4524e69809aebb186f7f..7238c09b0c2eded82d40949bb6d3bc7db8476cac 100644 (file)
@@ -69,7 +69,7 @@ fn main() -> Result<(), Error> {
         openssl::symm::encrypt_aead(
             cipher,
             &key,
-            Some(&iv),
+            Some(&iv[..12]),
             b"",
             &input,
             &mut tag).unwrap();