aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crypto/shash.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/crypto/shash.c b/crypto/shash.c
index 14a3b707a31f..f7fcc652ff32 100644
--- a/crypto/shash.c
+++ b/crypto/shash.c
@@ -142,8 +142,7 @@ int crypto_shash_finup(struct shash_desc *desc, const u8 *data,
142 struct shash_alg *shash = crypto_shash_alg(tfm); 142 struct shash_alg *shash = crypto_shash_alg(tfm);
143 unsigned long alignmask = crypto_shash_alignmask(tfm); 143 unsigned long alignmask = crypto_shash_alignmask(tfm);
144 144
145 if (((unsigned long)data | (unsigned long)out) & alignmask || 145 if (((unsigned long)data | (unsigned long)out) & alignmask)
146 !shash->finup)
147 return shash_finup_unaligned(desc, data, len, out); 146 return shash_finup_unaligned(desc, data, len, out);
148 147
149 return shash->finup(desc, data, len, out); 148 return shash->finup(desc, data, len, out);
@@ -164,8 +163,7 @@ int crypto_shash_digest(struct shash_desc *desc, const u8 *data,
164 struct shash_alg *shash = crypto_shash_alg(tfm); 163 struct shash_alg *shash = crypto_shash_alg(tfm);
165 unsigned long alignmask = crypto_shash_alignmask(tfm); 164 unsigned long alignmask = crypto_shash_alignmask(tfm);
166 165
167 if (((unsigned long)data | (unsigned long)out) & alignmask || 166 if (((unsigned long)data | (unsigned long)out) & alignmask)
168 !shash->digest)
169 return shash_digest_unaligned(desc, data, len, out); 167 return shash_digest_unaligned(desc, data, len, out);
170 168
171 return shash->digest(desc, data, len, out); 169 return shash->digest(desc, data, len, out);
@@ -488,6 +486,10 @@ static int shash_prepare_alg(struct shash_alg *alg)
488 base->cra_flags &= ~CRYPTO_ALG_TYPE_MASK; 486 base->cra_flags &= ~CRYPTO_ALG_TYPE_MASK;
489 base->cra_flags |= CRYPTO_ALG_TYPE_SHASH; 487 base->cra_flags |= CRYPTO_ALG_TYPE_SHASH;
490 488
489 if (!alg->finup)
490 alg->finup = shash_finup_unaligned;
491 if (!alg->digest)
492 alg->digest = shash_digest_unaligned;
491 if (!alg->import) 493 if (!alg->import)
492 alg->import = shash_no_import; 494 alg->import = shash_no_import;
493 if (!alg->export) 495 if (!alg->export)