@@ -21,10 +21,14 @@ use core::fmt;
2121use cipher:: zeroize:: { Zeroize , ZeroizeOnDrop } ;
2222
2323/// Byte-level BelT CTR
24- pub type BeltCtr < C = BeltBlock > = StreamCipherCoreWrapper < BeltCtrCore < C > > ;
25-
24+ pub type BeltCtr = GenericBeltCtr < BeltBlock > ;
2625/// Block-level BelT CTR
27- pub struct BeltCtrCore < C = BeltBlock >
26+ pub type BeltCtrCore = GenericBeltCtrCore < BeltBlock > ;
27+ /// Byte-level BelT CTR generic over block cipher implementation
28+ pub type GenericBeltCtr < C > = StreamCipherCoreWrapper < GenericBeltCtrCore < C > > ;
29+
30+ /// Block-level BelT CTR generic over block cipher implementation
31+ pub struct GenericBeltCtrCore < C >
2832where
2933 C : BlockCipherEncrypt + BlockSizeUser < BlockSize = U16 > ,
3034{
3337 s_init : u128 ,
3438}
3539
36- impl < C > StreamCipherCore for BeltCtrCore < C >
40+ impl < C > StreamCipherCore for GenericBeltCtrCore < C >
3741where
3842 C : BlockCipherEncrypt + BlockSizeUser < BlockSize = U16 > ,
3943{
6569 }
6670}
6771
68- impl < C > StreamCipherSeekCore for BeltCtrCore < C >
72+ impl < C > StreamCipherSeekCore for GenericBeltCtrCore < C >
6973where
7074 C : BlockCipherEncrypt + BlockSizeUser < BlockSize = U16 > ,
7175{
@@ -80,28 +84,28 @@ where
8084 }
8185}
8286
83- impl < C > BlockSizeUser for BeltCtrCore < C >
87+ impl < C > BlockSizeUser for GenericBeltCtrCore < C >
8488where
8589 C : BlockCipherEncrypt + BlockSizeUser < BlockSize = U16 > ,
8690{
8791 type BlockSize = C :: BlockSize ;
8892}
8993
90- impl < C > IvSizeUser for BeltCtrCore < C >
94+ impl < C > IvSizeUser for GenericBeltCtrCore < C >
9195where
9296 C : BlockCipherEncrypt + BlockSizeUser < BlockSize = U16 > ,
9397{
9498 type IvSize = C :: BlockSize ;
9599}
96100
97- impl < C > InnerUser for BeltCtrCore < C >
101+ impl < C > InnerUser for GenericBeltCtrCore < C >
98102where
99103 C : BlockCipherEncrypt + BlockSizeUser < BlockSize = U16 > ,
100104{
101105 type Inner = C ;
102106}
103107
104- impl < C > InnerIvInit for BeltCtrCore < C >
108+ impl < C > InnerIvInit for GenericBeltCtrCore < C >
105109where
106110 C : BlockCipherEncrypt + BlockSizeUser < BlockSize = U16 > ,
107111{
@@ -118,7 +122,7 @@ where
118122 }
119123}
120124
121- impl < C > IvState for BeltCtrCore < C >
125+ impl < C > IvState for GenericBeltCtrCore < C >
122126where
123127 C : BlockCipherEncrypt + BlockCipherDecrypt + BlockSizeUser < BlockSize = U16 > ,
124128{
@@ -129,7 +133,7 @@ where
129133 }
130134}
131135
132- impl < C > AlgorithmName for BeltCtrCore < C >
136+ impl < C > AlgorithmName for GenericBeltCtrCore < C >
133137where
134138 C : BlockCipherEncrypt + BlockSizeUser < BlockSize = U16 > + AlgorithmName ,
135139{
@@ -140,7 +144,7 @@ where
140144 }
141145}
142146
143- impl < C > fmt:: Debug for BeltCtrCore < C >
147+ impl < C > fmt:: Debug for GenericBeltCtrCore < C >
144148where
145149 C : BlockCipherEncrypt + BlockSizeUser < BlockSize = U16 > + AlgorithmName ,
146150{
@@ -152,7 +156,7 @@ where
152156 }
153157}
154158
155- impl < C : BlockCipherEncrypt > Drop for BeltCtrCore < C >
159+ impl < C : BlockCipherEncrypt > Drop for GenericBeltCtrCore < C >
156160where
157161 C : BlockCipherEncrypt + BlockSizeUser < BlockSize = U16 > ,
158162{
@@ -166,7 +170,7 @@ where
166170}
167171
168172#[ cfg( feature = "zeroize" ) ]
169- impl < C > ZeroizeOnDrop for BeltCtrCore < C > where
173+ impl < C > ZeroizeOnDrop for GenericBeltCtrCore < C > where
170174 C : BlockCipherEncrypt + BlockSizeUser < BlockSize = U16 > + ZeroizeOnDrop
171175{
172176}
0 commit comments