aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/ahash.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/ahash.c')
-rw-r--r--crypto/ahash.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/crypto/ahash.c b/crypto/ahash.c
index f669822..5f6a8e4 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -78,6 +78,11 @@ int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err)
unsigned int alignmask = walk->alignmask;
unsigned int nbytes = walk->entrylen;
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return -EACCES;
+#endif
+
walk->data -= walk->offset;
if (nbytes && walk->offset & alignmask && !err) {
@@ -115,6 +120,11 @@ EXPORT_SYMBOL_GPL(crypto_hash_walk_done);
int crypto_hash_walk_first(struct ahash_request *req,
struct crypto_hash_walk *walk)
{
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return -EACCES;
+#endif
+
walk->total = req->nbytes;
if (!walk->total)
@@ -132,6 +142,11 @@ int crypto_hash_walk_first_compat(struct hash_desc *hdesc,
struct crypto_hash_walk *walk,
struct scatterlist *sg, unsigned int len)
{
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return -EACCES;
+#endif
+
walk->total = len;
if (!walk->total)
@@ -250,6 +265,11 @@ static int crypto_ahash_op(struct ahash_request *req,
struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
unsigned long alignmask = crypto_ahash_alignmask(tfm);
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return -EACCES;
+#endif
+
if ((unsigned long)req->result & alignmask)
return ahash_op_unaligned(req, op);
@@ -366,6 +386,11 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
struct crypto_ahash *hash = __crypto_ahash_cast(tfm);
struct ahash_alg *alg = crypto_ahash_alg(hash);
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return -EACCES;
+#endif
+
hash->setkey = ahash_nosetkey;
hash->export = ahash_no_export;
hash->import = ahash_no_import;
@@ -468,6 +493,11 @@ int ahash_register_instance(struct crypto_template *tmpl,
{
int err;
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return -EACCES;
+#endif
+
err = ahash_prepare_alg(&inst->alg);
if (err)
return err;