diff options
author | codeworkx <daniel.hillenbrand@codeworkx.de> | 2012-06-02 13:09:29 +0200 |
---|---|---|
committer | codeworkx <daniel.hillenbrand@codeworkx.de> | 2012-06-02 13:09:29 +0200 |
commit | c6da2cfeb05178a11c6d062a06f8078150ee492f (patch) | |
tree | f3b4021d252c52d6463a9b3c1bb7245e399b009c /crypto/api.c | |
parent | c6d7c4dbff353eac7919342ae6b3299a378160a6 (diff) | |
download | kernel_samsung_smdk4412-c6da2cfeb05178a11c6d062a06f8078150ee492f.zip kernel_samsung_smdk4412-c6da2cfeb05178a11c6d062a06f8078150ee492f.tar.gz kernel_samsung_smdk4412-c6da2cfeb05178a11c6d062a06f8078150ee492f.tar.bz2 |
samsung update 1
Diffstat (limited to 'crypto/api.c')
-rw-r--r-- | crypto/api.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/crypto/api.c b/crypto/api.c index 033a714..0686dc5 100644 --- a/crypto/api.c +++ b/crypto/api.c @@ -361,6 +361,11 @@ struct crypto_tfm *__crypto_alloc_tfm(struct crypto_alg *alg, u32 type, unsigned int tfm_size; int err = -ENOMEM; +#ifdef CONFIG_CRYPTO_FIPS + if (unlikely(in_fips_err())) + return ERR_PTR(-EACCES); +#endif + tfm_size = sizeof(*tfm) + crypto_ctxsize(alg, type, mask); tfm = kzalloc(tfm_size, GFP_KERNEL); if (tfm == NULL) @@ -417,6 +422,11 @@ struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask) struct crypto_tfm *tfm; int err; +#ifdef CONFIG_CRYPTO_FIPS + if (unlikely(in_fips_err())) + return ERR_PTR(-EACCES); +#endif + for (;;) { struct crypto_alg *alg; @@ -455,6 +465,13 @@ void *crypto_create_tfm(struct crypto_alg *alg, unsigned int total; int err = -ENOMEM; +#ifdef CONFIG_CRYPTO_FIPS + if (unlikely(in_fips_err())) { + printk(KERN_ERR + "Fail crypto_create_tfm due to fips error state.\n"); + return ERR_PTR(-EACCES); + } +#endif tfmsize = frontend->tfmsize; total = tfmsize + sizeof(*tfm) + frontend->extsize(alg); @@ -534,6 +551,11 @@ void *crypto_alloc_tfm(const char *alg_name, void *tfm; int err; +#ifdef CONFIG_CRYPTO_FIPS + if (unlikely(in_fips_err())) + return ERR_PTR(-EACCES); +#endif + for (;;) { struct crypto_alg *alg; |