Skip to content

Commit 0bb0353

Browse files
committed
Updating some formatting problems from the pipeline.
Signed-off-by: Jason Parker <[email protected]>
1 parent bd41a6b commit 0bb0353

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cryptoki/src/mechanism/aead.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ impl<'a> GcmParams<'a> {
3131
/// `tag_bits` - The length, in **bits**, of the authentication tag. Must
3232
/// be between 0 and 128. The tag is appended to the end of the
3333
/// ciphertext.
34-
///
34+
/// # Errors
35+
/// This function returns an error if the length of `iv` or `aad` does not
36+
/// fit into an [Ulong].
3537
pub fn new(iv: &'a mut [u8], aad: &'a [u8], tag_bits: Ulong) -> Result<Self, &'a str> {
3638
// The ulIvBits parameter seems to be missing from the 2.40 spec,
3739
// although it is included in the header file. In [1], OASIS clarified
@@ -52,7 +54,7 @@ impl<'a> GcmParams<'a> {
5254

5355
let iv_len = iv.len();
5456
// Some HSMs may require the ulIvBits field to be populated, while others don't pay attention to it.
55-
let iv_bit_len = iv_len*8;
57+
let iv_bit_len = iv_len * 8;
5658

5759
Ok(GcmParams {
5860
inner: CK_GCM_PARAMS {
@@ -65,9 +67,7 @@ impl<'a> GcmParams<'a> {
6567
// If the HSM doesn't require the field, it won't mind; and it it does, it would break anyways.
6668
ulIvBits: iv_bit_len.try_into().unwrap_or_default(),
6769
pAAD: aad.as_ptr() as *mut _,
68-
ulAADLen: match aad
69-
.len()
70-
.try_into() {
70+
ulAADLen: match aad.len().try_into() {
7171
Ok(len) => len,
7272
Err(_e) => return Err("aad length does not fit in CK_ULONG"),
7373
},

0 commit comments

Comments
 (0)