diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2010-07-07 08:31:14 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2010-07-07 08:31:14 +0200 |
commit | 58a20b797e5a987fc8f7c5bea3be24d754908bf5 (patch) | |
tree | 8f3d54711c4685da083826b3422f0d9dd46ae452 /cryptodev_main.c | |
parent | d12ecf68276ab0e57ea578d763f23b2143e57ed8 (diff) | |
download | cryptodev-linux-58a20b797e5a987fc8f7c5bea3be24d754908bf5.tar.gz cryptodev-linux-58a20b797e5a987fc8f7c5bea3be24d754908bf5.tar.xz cryptodev-linux-58a20b797e5a987fc8f7c5bea3be24d754908bf5.zip |
set_iv() function accepts argument from kernel memory.
Diffstat (limited to 'cryptodev_main.c')
-rw-r--r-- | cryptodev_main.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/cryptodev_main.c b/cryptodev_main.c index 00f598c..f99c71a 100644 --- a/cryptodev_main.c +++ b/cryptodev_main.c @@ -426,10 +426,15 @@ crypto_run(struct fcrypt *fcr, struct crypt_op *cop) goto out_unlock; } - ivsize = ses_ptr->cdata.ivsize; - if (cop->iv) { - cryptodev_cipher_set_iv(&ses_ptr->cdata, cop->iv, ivsize); + uint8_t iv[EALG_MAX_BLOCK_LEN]; + + ivsize = min((int)sizeof(iv), ses_ptr->cdata.ivsize); + ret = copy_from_user(iv, cop->iv, ivsize); + if (unlikely(ret)) + goto out_unlock; + + cryptodev_cipher_set_iv(&ses_ptr->cdata, iv, ivsize); } } |