summaryrefslogtreecommitdiffstats
path: root/crypto/userspace/cryptodev_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/userspace/cryptodev_main.c')
-rw-r--r--crypto/userspace/cryptodev_main.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/crypto/userspace/cryptodev_main.c b/crypto/userspace/cryptodev_main.c
index 0cbe3c4bdc3..89cd15b6287 100644
--- a/crypto/userspace/cryptodev_main.c
+++ b/crypto/userspace/cryptodev_main.c
@@ -31,6 +31,7 @@
*
*/
+#include <linux/audit.h>
#include <linux/crypto.h>
#include <linux/mm.h>
#include <linux/highmem.h>
@@ -102,13 +103,21 @@ int __get_userbuf(uint8_t __user *addr, uint32_t len, int write,
static int
cryptodev_open(struct inode *inode, struct file *filp)
{
- void *ncr;
+ struct ncr_lists *ncr;
+ int ret;
ncr = ncr_init_lists();
if (ncr == NULL) {
return -ENOMEM;
}
+ ret = audit_log_crypto_op(AUDIT_CRYPTO_OP_CONTEXT_NEW, ncr->id, -1,
+ NULL, NULL, -1, NULL, 0, -1, NULL, 0);
+ if (ret < 0) {
+ ncr_deinit_lists(ncr);
+ return ret;
+ }
+
filp->private_data = ncr;
return 0;
}
@@ -116,9 +125,11 @@ cryptodev_open(struct inode *inode, struct file *filp)
static int
cryptodev_release(struct inode *inode, struct file *filp)
{
- void *ncr = filp->private_data;
+ struct ncr_lists *ncr = filp->private_data;
if (ncr) {
+ audit_log_crypto_op(AUDIT_CRYPTO_OP_CONTEXT_DEL, ncr->id, -1,
+ NULL, NULL, -1, NULL, 0, -1, NULL, 0);
ncr_deinit_lists(ncr);
filp->private_data = NULL;
}