@@ -6,9 +6,10 @@ use digest::{
66 array:: { Array , ArraySize } ,
77 block_api:: {
88 AlgorithmName , Block , BlockSizeUser , Buffer , BufferKindUser , FixedOutputCore , Lazy ,
9- UpdateCore ,
9+ SmallBlockSizeUser , UpdateCore ,
1010 } ,
11- common:: { BlockSizes , InnerInit , InnerUser } ,
11+ block_buffer:: BlockSizes ,
12+ common:: { InnerInit , InnerUser } ,
1213} ;
1314
1415#[ cfg( feature = "zeroize" ) ]
@@ -18,7 +19,7 @@ use digest::zeroize::{Zeroize, ZeroizeOnDrop};
1819#[ derive( Clone ) ]
1920pub struct BeltMacCore < C = BeltBlock >
2021where
21- C : BlockCipherEncrypt + Clone ,
22+ C : BlockCipherEncrypt + SmallBlockSizeUser + Clone ,
2223{
2324 cipher : C ,
2425 state : Block < C > ,
@@ -27,30 +28,30 @@ where
2728
2829impl < C > BlockSizeUser for BeltMacCore < C >
2930where
30- C : BlockCipherEncrypt + Clone ,
31+ C : BlockCipherEncrypt + SmallBlockSizeUser + Clone ,
3132{
3233 type BlockSize = C :: BlockSize ;
3334}
3435
3536impl < C > OutputSizeUser for BeltMacCore < C >
3637where
37- C : BlockCipherEncrypt + Clone ,
38+ C : BlockCipherEncrypt + SmallBlockSizeUser + Clone ,
3839{
3940 type OutputSize = C :: BlockSize ;
4041}
4142
4243impl < C > InnerUser for BeltMacCore < C >
4344where
44- C : BlockCipherEncrypt + Clone ,
45+ C : BlockCipherEncrypt + SmallBlockSizeUser + Clone ,
4546{
4647 type Inner = C ;
4748}
4849
49- impl < C > MacMarker for BeltMacCore < C > where C : BlockCipherEncrypt + Clone { }
50+ impl < C > MacMarker for BeltMacCore < C > where C : BlockCipherEncrypt + SmallBlockSizeUser + Clone { }
5051
5152impl < C > InnerInit for BeltMacCore < C >
5253where
53- C : BlockCipherEncrypt + Clone ,
54+ C : BlockCipherEncrypt + SmallBlockSizeUser + Clone ,
5455{
5556 #[ inline]
5657 fn inner_init ( cipher : C ) -> Self {
@@ -63,14 +64,14 @@ where
6364
6465impl < C > BufferKindUser for BeltMacCore < C >
6566where
66- C : BlockCipherEncrypt + Clone ,
67+ C : BlockCipherEncrypt + SmallBlockSizeUser + Clone ,
6768{
6869 type BufferKind = Lazy ;
6970}
7071
7172impl < C > UpdateCore for BeltMacCore < C >
7273where
73- C : BlockCipherEncrypt + Clone ,
74+ C : BlockCipherEncrypt + SmallBlockSizeUser + Clone ,
7475{
7576 #[ inline]
7677 fn update_blocks ( & mut self , blocks : & [ Block < Self > ] ) {
@@ -100,7 +101,7 @@ where
100101
101102impl < C > Reset for BeltMacCore < C >
102103where
103- C : BlockCipherEncrypt + Clone ,
104+ C : BlockCipherEncrypt + SmallBlockSizeUser + Clone ,
104105{
105106 #[ inline( always) ]
106107 fn reset ( & mut self ) {
@@ -110,7 +111,7 @@ where
110111
111112impl < C > FixedOutputCore for BeltMacCore < C >
112113where
113- C : BlockCipherEncrypt + Clone ,
114+ C : BlockCipherEncrypt + SmallBlockSizeUser + Clone ,
114115{
115116 #[ inline]
116117 fn finalize_fixed_core ( & mut self , buffer : & mut Buffer < Self > , out : & mut Output < Self > ) {
@@ -147,7 +148,7 @@ where
147148
148149impl < C > AlgorithmName for BeltMacCore < C >
149150where
150- C : BlockCipherEncrypt + Clone ,
151+ C : BlockCipherEncrypt + SmallBlockSizeUser + Clone ,
151152{
152153 fn write_alg_name ( f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
153154 f. write_str ( "BeltMac" )
@@ -156,7 +157,7 @@ where
156157
157158impl < C > fmt:: Debug for BeltMacCore < C >
158159where
159- C : BlockCipherEncrypt + Clone ,
160+ C : BlockCipherEncrypt + SmallBlockSizeUser + Clone ,
160161{
161162 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
162163 f. write_str ( "BeltMacCore { ... }" )
@@ -166,15 +167,18 @@ where
166167#[ cfg( feature = "zeroize" ) ]
167168impl < C > Drop for BeltMacCore < C >
168169where
169- C : BlockCipherEncrypt + Clone ,
170+ C : BlockCipherEncrypt + SmallBlockSizeUser + Clone ,
170171{
171172 fn drop ( & mut self ) {
172173 self . state . zeroize ( ) ;
173174 }
174175}
175176
176177#[ cfg( feature = "zeroize" ) ]
177- impl < C > ZeroizeOnDrop for BeltMacCore < C > where C : BlockCipherEncrypt + Clone + ZeroizeOnDrop { }
178+ impl < C > ZeroizeOnDrop for BeltMacCore < C > where
179+ C : BlockCipherEncrypt + SmallBlockSizeUser + Clone + ZeroizeOnDrop
180+ {
181+ }
178182
179183#[ inline( always) ]
180184fn xor < N : ArraySize > ( buf : & mut Array < u8 , N > , data : & Array < u8 , N > ) {
0 commit comments