Skip to content

Commit 7e5bbc7

Browse files
chore: remove useless conversion + rename var
1 parent dcb7d1f commit 7e5bbc7

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

crypto/lakers-crypto-rustcrypto/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,27 +88,27 @@ impl<Rng: rand_core::RngCore + rand_core::CryptoRng> CryptoTrait for Crypto<Rng>
8888
)]
8989
match Tag::LEN {
9090
8 => {
91-
let tag = AesCcm16_64_128::new(key.into())
91+
let enc = AesCcm16_64_128::new(key.into())
9292
.encrypt_in_place_detached(
9393
iv.into(),
9494
ad,
9595
&mut outbuffer.content[..plaintext.len()],
9696
)
9797
.expect("Preconfigured sizes should not allow encryption to fail");
9898

99-
outbuffer.extend_from_slice(&tag).unwrap()
99+
outbuffer.extend_from_slice(&enc).unwrap()
100100
}
101101

102102
16 => {
103-
let tag = AesCcm16_128_128::new(key.into())
103+
let enc = AesCcm16_128_128::new(key.into())
104104
.encrypt_in_place_detached(
105105
iv.into(),
106106
ad,
107107
&mut outbuffer.content[..plaintext.len()],
108108
)
109109
.expect("Preconfigured sizes should not allow encryption to fail");
110110

111-
outbuffer.extend_from_slice(&tag).unwrap()
111+
outbuffer.extend_from_slice(&enc).unwrap()
112112
}
113113

114114
_ => unreachable!(), // CcmTagLen bound guarantees this

shared/src/crypto.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,11 @@ pub mod test_helper {
106106
let key: BytesCcmKeyLen = [
107107
0x26, 0x51, 0x1f, 0xb5, 0x1f, 0xcf, 0xa7, 0x5c, 0xb4, 0xb4, 0x4d, 0xa7, 0x5a, 0x6e,
108108
0x5a, 0x0e,
109-
]
110-
.into();
109+
];
111110

112111
let iv: BytesCcmIvLen = [
113112
0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, 0x40, 0x3a, 0xff, 0x85, 0x9f, 0xbb,
114-
]
115-
.into();
113+
];
116114

117115
let ad = [
118116
0xa1, 0x6a, 0x2e, 0x74, 0x1f, 0x1c, 0xd9, 0x71, 0x72, 0x85, 0xb6, 0xd8, 0x82, 0xc1,
@@ -139,13 +137,11 @@ pub mod test_helper {
139137
let key: BytesCcmKeyLen = [
140138
0x36, 0x8f, 0x35, 0xa1, 0xf8, 0x0e, 0xaa, 0xac, 0xd6, 0xbb, 0x13, 0x66, 0x09, 0x38,
141139
0x97, 0x27,
142-
]
143-
.into();
140+
];
144141

145142
let iv: BytesCcmIvLen = [
146143
0x84, 0x2a, 0x84, 0x45, 0x84, 0x75, 0x02, 0xea, 0x77, 0x36, 0x3a, 0x16, 0xb6,
147-
]
148-
.into();
144+
];
149145

150146
let ad = [
151147
0x34, 0x39, 0x6d, 0xfc, 0xfa, 0x6f, 0x74, 0x2a, 0xea, 0x70, 0x40, 0x97, 0x6b, 0xd5,
@@ -182,13 +178,11 @@ pub mod test_helper {
182178
let key: BytesCcmKeyLen = [
183179
0x41, 0x89, 0x35, 0x1b, 0x5c, 0xae, 0xa3, 0x75, 0xa0, 0x29, 0x9e, 0x81, 0xc6, 0x21,
184180
0xbf, 0x43,
185-
]
186-
.into();
181+
];
187182

188183
let iv: BytesCcmIvLen = [
189184
0x48, 0xc0, 0x90, 0x69, 0x30, 0x56, 0x1e, 0x0a, 0xb0, 0xef, 0x4c, 0xd9, 0x72,
190-
]
191-
.into();
185+
];
192186

193187
let ad = [
194188
0x40, 0xa2, 0x7c, 0x1d, 0x1e, 0x23, 0xea, 0x3d, 0xbe, 0x80, 0x56, 0xb2, 0x77, 0x48,

0 commit comments

Comments
 (0)