Skip to content

Commit e7cef64

Browse files
committed
Lint and clippy
1 parent 316accc commit e7cef64

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

parquet/src/encryption/ciphers.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,10 @@ impl BlockDecryptor for RingGcmBlockDecryptor {
6767
}
6868

6969
fn compute_tag(&self, nonce: &[u8], aad: &[u8], plaintext: &mut [u8]) -> Result<Vec<u8>> {
70-
let nonce = ring::aead::Nonce::try_assume_unique_for_key(
71-
&nonce,
72-
)?;
73-
let tag = self.key.seal_in_place_separate_tag(
74-
nonce,
75-
Aad::from(aad),
76-
plaintext,
77-
)?;
70+
let nonce = ring::aead::Nonce::try_assume_unique_for_key(nonce)?;
71+
let tag = self
72+
.key
73+
.seal_in_place_separate_tag(nonce, Aad::from(aad), plaintext)?;
7874
Ok(tag.as_ref().to_vec())
7975
}
8076
}

parquet/src/encryption/decrypt.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,20 @@
1717

1818
//! Configuration and utilities for decryption of files using Parquet Modular Encryption
1919
20-
use crate::encryption::ciphers::{BlockDecryptor, RingGcmBlockDecryptor, NONCE_LEN, TAG_LEN, SIZE_LEN};
20+
use crate::encryption::ciphers::{
21+
BlockDecryptor, RingGcmBlockDecryptor, NONCE_LEN, TAG_LEN, SIZE_LEN
22+
};
2123
use crate::encryption::modules::{create_footer_aad, create_module_aad, ModuleType};
2224
use crate::errors::{ParquetError, Result};
2325
use crate::file::column_crypto_metadata::ColumnCryptoMetaData;
26+
use crate::format::FileMetaData as TFileMetaData;
27+
use crate::thrift::TSerializable;
2428
use std::borrow::Cow;
2529
use std::collections::HashMap;
2630
use std::fmt::Formatter;
2731
use std::io::Read;
2832
use std::sync::Arc;
2933
use thrift::protocol::TCompactOutputProtocol;
30-
use crate::thrift::TSerializable;
31-
use crate::format::{FileMetaData as TFileMetaData};
3234

3335
/// Trait for retrieving an encryption key using the key's metadata
3436
///
@@ -574,11 +576,7 @@ impl FileDecryptor {
574576
// let aad = self.file_aad();
575577
let footer_decryptor = self.get_footer_decryptor()?;
576578

577-
let computed_tag = footer_decryptor.compute_tag(
578-
nonce,
579-
aad.as_ref(),
580-
&mut plaintext,
581-
)?;
579+
let computed_tag = footer_decryptor.compute_tag(nonce, aad.as_ref(), &mut plaintext)?;
582580

583581
if computed_tag != tag {
584582
return Err(general_err!(

0 commit comments

Comments
 (0)