aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/api.c
diff options
context:
space:
mode:
authorcodeworkx <daniel.hillenbrand@codeworkx.de>2012-06-02 13:09:29 +0200
committercodeworkx <daniel.hillenbrand@codeworkx.de>2012-06-02 13:09:29 +0200
commitc6da2cfeb05178a11c6d062a06f8078150ee492f (patch)
treef3b4021d252c52d6463a9b3c1bb7245e399b009c /crypto/api.c
parentc6d7c4dbff353eac7919342ae6b3299a378160a6 (diff)
downloadkernel_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.c22
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;