summaryrefslogtreecommitdiff
path: root/crypto/algapi.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2018-06-28 14:07:57 +0200
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2018-06-28 14:07:57 +0200
commit4ac44d603f290242cbba2e0d0383460412d55c04 (patch)
treea573d3a85920efb639707e6e528e0cac59666199 /crypto/algapi.c
parentaeb235fbdded8149156360a2b2f9ca2c6d99448e (diff)
parentc5c0586a6771a33a5da7985495c1beab72d292b1 (diff)
downloadlinux-crypto-4ac44d603f290242cbba2e0d0383460412d55c04.tar.gz
linux-crypto-4ac44d603f290242cbba2e0d0383460412d55c04.zip
Merge tag 'v4.18-rc2' of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into fbdev-for-next
Linux 4.18-rc2
Diffstat (limited to '')
-rw-r--r--crypto/algapi.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c
index 2a0271b5..c0755cf4 100644
--- a/crypto/algapi.c
+++ b/crypto/algapi.c
@@ -10,6 +10,7 @@
*
*/
+#include <crypto/algapi.h>
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/fips.h>
@@ -59,6 +60,15 @@ static int crypto_check_alg(struct crypto_alg *alg)
if (alg->cra_blocksize > PAGE_SIZE / 8)
return -EINVAL;
+ if (!alg->cra_type && (alg->cra_flags & CRYPTO_ALG_TYPE_MASK) ==
+ CRYPTO_ALG_TYPE_CIPHER) {
+ if (alg->cra_alignmask > MAX_CIPHER_ALIGNMASK)
+ return -EINVAL;
+
+ if (alg->cra_blocksize > MAX_CIPHER_BLOCKSIZE)
+ return -EINVAL;
+ }
+
if (alg->cra_priority < 0)
return -EINVAL;