Commit bf70fa9d9ee07aa175453b19a39b2b9dab602d97
Committed by
Herbert Xu
1 parent
8275d1aa64
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
crypto: sha512 - Expose generic sha512 routine to be callable from other modules
Other SHA512 routines may need to use the generic routine when FPU is not available. Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Showing 2 changed files with 10 additions and 6 deletions Side-by-side Diff
crypto/sha512_generic.c
... | ... | @@ -163,8 +163,8 @@ |
163 | 163 | return 0; |
164 | 164 | } |
165 | 165 | |
166 | -static int | |
167 | -sha512_update(struct shash_desc *desc, const u8 *data, unsigned int len) | |
166 | +int crypto_sha512_update(struct shash_desc *desc, const u8 *data, | |
167 | + unsigned int len) | |
168 | 168 | { |
169 | 169 | struct sha512_state *sctx = shash_desc_ctx(desc); |
170 | 170 | |
... | ... | @@ -197,6 +197,7 @@ |
197 | 197 | |
198 | 198 | return 0; |
199 | 199 | } |
200 | +EXPORT_SYMBOL(crypto_sha512_update); | |
200 | 201 | |
201 | 202 | static int |
202 | 203 | sha512_final(struct shash_desc *desc, u8 *hash) |
203 | 204 | |
... | ... | @@ -215,10 +216,10 @@ |
215 | 216 | /* Pad out to 112 mod 128. */ |
216 | 217 | index = sctx->count[0] & 0x7f; |
217 | 218 | pad_len = (index < 112) ? (112 - index) : ((128+112) - index); |
218 | - sha512_update(desc, padding, pad_len); | |
219 | + crypto_sha512_update(desc, padding, pad_len); | |
219 | 220 | |
220 | 221 | /* Append length (before padding) */ |
221 | - sha512_update(desc, (const u8 *)bits, sizeof(bits)); | |
222 | + crypto_sha512_update(desc, (const u8 *)bits, sizeof(bits)); | |
222 | 223 | |
223 | 224 | /* Store state in digest */ |
224 | 225 | for (i = 0; i < 8; i++) |
... | ... | @@ -245,7 +246,7 @@ |
245 | 246 | static struct shash_alg sha512_algs[2] = { { |
246 | 247 | .digestsize = SHA512_DIGEST_SIZE, |
247 | 248 | .init = sha512_init, |
248 | - .update = sha512_update, | |
249 | + .update = crypto_sha512_update, | |
249 | 250 | .final = sha512_final, |
250 | 251 | .descsize = sizeof(struct sha512_state), |
251 | 252 | .base = { |
... | ... | @@ -257,7 +258,7 @@ |
257 | 258 | }, { |
258 | 259 | .digestsize = SHA384_DIGEST_SIZE, |
259 | 260 | .init = sha384_init, |
260 | - .update = sha512_update, | |
261 | + .update = crypto_sha512_update, | |
261 | 262 | .final = sha384_final, |
262 | 263 | .descsize = sizeof(struct sha512_state), |
263 | 264 | .base = { |
include/crypto/sha.h