From 57434b3f1d6e62a5c8aacd471f0be6b5b986b580 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Sat, 19 Jun 2010 11:12:35 +0200 Subject: Version is shown on module load. --- Makefile | 7 ++++--- cryptodev_main.c | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 815549b..3eda015 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -KERNEL_DIR ?= /lib/modules/$(shell uname -r)/build -VERSION = 0.1 +KERNEL_DIR = /lib/modules/$(shell uname -r)/build +VERSION = 0.3 cryptodev-objs = cryptodev_main.o cryptodev_cipher.o ncr.o \ ncr-data.o ncr-key.o ncr-limits.o ncr-sessions.o \ @@ -8,7 +8,8 @@ cryptodev-objs = cryptodev_main.o cryptodev_cipher.o ncr.o \ obj-m += cryptodev.o build: - make -C $(KERNEL_DIR) SUBDIRS=`pwd` modules + @echo "#define VERSION \"$(VERSION)\"" > version.h + make -C $(KERNEL_DIR) VERSION="$VERSION" SUBDIRS=`pwd` modules install: make -C $(KERNEL_DIR) SUBDIRS=`pwd` modules_install diff --git a/cryptodev_main.c b/cryptodev_main.c index 6c897c8..abc1bde 100644 --- a/cryptodev_main.c +++ b/cryptodev_main.c @@ -41,6 +41,7 @@ #include "cryptodev_int.h" #include "ncr_int.h" #include +#include "version.h" MODULE_AUTHOR("Nikos Mavrogiannopoulos "); MODULE_DESCRIPTION("CryptoDev driver"); @@ -204,12 +205,12 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop) dprintk(1,KERN_DEBUG,"Setting key failed for %s-%zu.\n", alg_name, (size_t)sop->keylen*8); ret = -EINVAL; - goto error; + goto error_cipher; } ret = copy_from_user(keyp, sop->key, sop->keylen); if (unlikely(ret)) { - goto error; + goto error_cipher; } ret = cryptodev_cipher_init(&ses_new->cdata, alg_name, keyp, sop->keylen); @@ -217,7 +218,7 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop) dprintk(1,KERN_DEBUG,"%s: Failed to load cipher for %s\n", __func__, alg_name); ret = -EINVAL; - goto error; + goto error_cipher; } } @@ -228,12 +229,12 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop) dprintk(1,KERN_DEBUG,"Setting key failed for %s-%zu.\n", alg_name, (size_t)sop->mackeylen*8); ret = -EINVAL; - goto error; + goto error_hash; } ret = copy_from_user(keyp, sop->mackey, sop->mackeylen); if (unlikely(ret)) { - goto error; + goto error_hash; } ret = cryptodev_hash_init(&ses_new->hdata, hash_name, hmac_mode, keyp, sop->mackeylen); @@ -241,7 +242,7 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop) dprintk(1,KERN_DEBUG,"%s: Failed to load hash for %s\n", __func__, hash_name); ret = -EINVAL; - goto error; + goto error_hash; } } @@ -269,9 +270,9 @@ restart: return 0; -error: +error_hash: cryptodev_cipher_deinit( &ses_new->cdata); - cryptodev_hash_deinit( &ses_new->hdata); +error_cipher: if (ses_new) kfree(ses_new); return ret; @@ -802,7 +803,7 @@ int __init init_cryptodev(void) if (unlikely(rc)) return rc; - printk(KERN_INFO PFX "driver loaded.\n"); + printk(KERN_INFO PFX "driver %s loaded.\n", VERSION); return 0; } -- cgit