2121#include <linux/percpu.h>
2222#include <asm/byteorder.h>
2323
24- struct sha512_ctx {
25- u64 state [8 ];
26- u32 count [4 ];
27- u8 buf [128 ];
28- };
29-
3024static DEFINE_PER_CPU (u64 [80 ], msg_schedule ) ;
3125
3226static inline u64 Ch (u64 x , u64 y , u64 z )
@@ -141,7 +135,7 @@ sha512_transform(u64 *state, const u8 *input)
141135static int
142136sha512_init (struct shash_desc * desc )
143137{
144- struct sha512_ctx * sctx = shash_desc_ctx (desc );
138+ struct sha512_state * sctx = shash_desc_ctx (desc );
145139 sctx -> state [0 ] = SHA512_H0 ;
146140 sctx -> state [1 ] = SHA512_H1 ;
147141 sctx -> state [2 ] = SHA512_H2 ;
@@ -158,7 +152,7 @@ sha512_init(struct shash_desc *desc)
158152static int
159153sha384_init (struct shash_desc * desc )
160154{
161- struct sha512_ctx * sctx = shash_desc_ctx (desc );
155+ struct sha512_state * sctx = shash_desc_ctx (desc );
162156 sctx -> state [0 ] = SHA384_H0 ;
163157 sctx -> state [1 ] = SHA384_H1 ;
164158 sctx -> state [2 ] = SHA384_H2 ;
@@ -175,7 +169,7 @@ sha384_init(struct shash_desc *desc)
175169static int
176170sha512_update (struct shash_desc * desc , const u8 * data , unsigned int len )
177171{
178- struct sha512_ctx * sctx = shash_desc_ctx (desc );
172+ struct sha512_state * sctx = shash_desc_ctx (desc );
179173
180174 unsigned int i , index , part_len ;
181175
@@ -214,7 +208,7 @@ sha512_update(struct shash_desc *desc, const u8 *data, unsigned int len)
214208static int
215209sha512_final (struct shash_desc * desc , u8 * hash )
216210{
217- struct sha512_ctx * sctx = shash_desc_ctx (desc );
211+ struct sha512_state * sctx = shash_desc_ctx (desc );
218212 static u8 padding [128 ] = { 0x80 , };
219213 __be64 * dst = (__be64 * )hash ;
220214 __be32 bits [4 ];
@@ -240,7 +234,7 @@ sha512_final(struct shash_desc *desc, u8 *hash)
240234 dst [i ] = cpu_to_be64 (sctx -> state [i ]);
241235
242236 /* Zeroize sensitive information. */
243- memset (sctx , 0 , sizeof (struct sha512_ctx ));
237+ memset (sctx , 0 , sizeof (struct sha512_state ));
244238
245239 return 0 ;
246240}
@@ -262,7 +256,7 @@ static struct shash_alg sha512 = {
262256 .init = sha512_init ,
263257 .update = sha512_update ,
264258 .final = sha512_final ,
265- .descsize = sizeof (struct sha512_ctx ),
259+ .descsize = sizeof (struct sha512_state ),
266260 .base = {
267261 .cra_name = "sha512" ,
268262 .cra_flags = CRYPTO_ALG_TYPE_SHASH ,
@@ -276,7 +270,7 @@ static struct shash_alg sha384 = {
276270 .init = sha384_init ,
277271 .update = sha512_update ,
278272 .final = sha384_final ,
279- .descsize = sizeof (struct sha512_ctx ),
273+ .descsize = sizeof (struct sha512_state ),
280274 .base = {
281275 .cra_name = "sha384" ,
282276 .cra_flags = CRYPTO_ALG_TYPE_SHASH ,
0 commit comments