@@ -66,14 +66,14 @@ __chacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len,
66
66
__le64 lens [2 ];
67
67
} b ;
68
68
69
- chacha_crypt (chacha_state , b .block0 , pad0 , sizeof (b .block0 ), 20 );
69
+ chacha20_crypt (chacha_state , b .block0 , pad0 , sizeof (b .block0 ));
70
70
poly1305_init (& poly1305_state , b .block0 );
71
71
72
72
poly1305_update (& poly1305_state , ad , ad_len );
73
73
if (ad_len & 0xf )
74
74
poly1305_update (& poly1305_state , pad0 , 0x10 - (ad_len & 0xf ));
75
75
76
- chacha_crypt (chacha_state , dst , src , src_len , 20 );
76
+ chacha20_crypt (chacha_state , dst , src , src_len );
77
77
78
78
poly1305_update (& poly1305_state , dst , src_len );
79
79
if (src_len & 0xf )
@@ -140,7 +140,7 @@ __chacha20poly1305_decrypt(u8 *dst, const u8 *src, const size_t src_len,
140
140
if (unlikely (src_len < POLY1305_DIGEST_SIZE ))
141
141
return false;
142
142
143
- chacha_crypt (chacha_state , b .block0 , pad0 , sizeof (b .block0 ), 20 );
143
+ chacha20_crypt (chacha_state , b .block0 , pad0 , sizeof (b .block0 ));
144
144
poly1305_init (& poly1305_state , b .block0 );
145
145
146
146
poly1305_update (& poly1305_state , ad , ad_len );
@@ -160,7 +160,7 @@ __chacha20poly1305_decrypt(u8 *dst, const u8 *src, const size_t src_len,
160
160
161
161
ret = crypto_memneq (b .mac , src + dst_len , POLY1305_DIGEST_SIZE );
162
162
if (likely (!ret ))
163
- chacha_crypt (chacha_state , dst , src , dst_len , 20 );
163
+ chacha20_crypt (chacha_state , dst , src , dst_len );
164
164
165
165
memzero_explicit (& b , sizeof (b ));
166
166
@@ -241,7 +241,7 @@ bool chacha20poly1305_crypt_sg_inplace(struct scatterlist *src,
241
241
b .iv [1 ] = cpu_to_le64 (nonce );
242
242
243
243
chacha_init (chacha_state , b .k , (u8 * )b .iv );
244
- chacha_crypt (chacha_state , b .block0 , pad0 , sizeof (b .block0 ), 20 );
244
+ chacha20_crypt (chacha_state , b .block0 , pad0 , sizeof (b .block0 ));
245
245
poly1305_init (& poly1305_state , b .block0 );
246
246
247
247
if (unlikely (ad_len )) {
@@ -278,14 +278,14 @@ bool chacha20poly1305_crypt_sg_inplace(struct scatterlist *src,
278
278
279
279
if (unlikely (length < sl ))
280
280
l &= ~(CHACHA_BLOCK_SIZE - 1 );
281
- chacha_crypt (chacha_state , addr , addr , l , 20 );
281
+ chacha20_crypt (chacha_state , addr , addr , l );
282
282
addr += l ;
283
283
length -= l ;
284
284
}
285
285
286
286
if (unlikely (length > 0 )) {
287
- chacha_crypt (chacha_state , b .chacha_stream , pad0 ,
288
- CHACHA_BLOCK_SIZE , 20 );
287
+ chacha20_crypt (chacha_state , b .chacha_stream , pad0 ,
288
+ CHACHA_BLOCK_SIZE );
289
289
crypto_xor (addr , b .chacha_stream , length );
290
290
partial = length ;
291
291
}
0 commit comments