From feb7d3a3d2bdeef0faecad60adfdff395316f202 Mon Sep 17 00:00:00 2001 From: rlee287 Date: Tue, 21 Nov 2023 22:33:12 -0800 Subject: [PATCH] Use typenum operator_aliases to make the array length summation types more readable --- committing-aead/src/lib.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/committing-aead/src/lib.rs b/committing-aead/src/lib.rs index 0f13dfc2..5b796ec6 100644 --- a/committing-aead/src/lib.rs +++ b/committing-aead/src/lib.rs @@ -63,6 +63,7 @@ mod padded_aead { use super::KeyCommittingAead; use aead::{AeadCore, AeadInPlace, KeyInit, KeySizeUser}; use core::ops::{Add, Mul}; + use generic_array::typenum::operator_aliases::{Prod, Sum}; use generic_array::typenum::{Unsigned, U3}; use generic_array::ArrayLength; use subtle::{Choice, ConstantTimeEq}; @@ -107,17 +108,15 @@ mod padded_aead { } impl AeadCore for PaddedAead where - Aead::CiphertextOverhead: Add<>::Output>, + Aead::CiphertextOverhead: Add>, Aead::KeySize: Mul, - >::Output>>::Output: - ArrayLength, + Sum>: ArrayLength, { type NonceSize = Aead::NonceSize; type TagSize = Aead::TagSize; - type CiphertextOverhead = - >::Output>>::Output; + type CiphertextOverhead = Sum>; } impl aead::Aead for PaddedAead @@ -288,6 +287,7 @@ mod ctx { use core::ops::Add; use digest::core_api::BlockSizeUser; use digest::{Digest, FixedOutput, Mac}; + use generic_array::typenum::operator_aliases::Sum; use generic_array::typenum::Unsigned; use generic_array::ArrayLength; use hmac::SimpleHmac; @@ -463,11 +463,11 @@ mod ctx { for CtxishHmacAead where Aead::TagSize: Add, - >::Output: ArrayLength, + Sum: ArrayLength, { type NonceSize = Aead::NonceSize; - type TagSize = >::Output; + type TagSize = Sum; type CiphertextOverhead = Aead::CiphertextOverhead; }