diff options
Diffstat (limited to 'drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c')
-rw-r--r-- | drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c index 7f56d2c..68e34b4 100644 --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c @@ -64,7 +64,7 @@ static int cfs_crypto_hash_alloc(enum cfs_crypto_hash_alg hash_alg, unsigned int key_len) { struct crypto_ahash *tfm; - int err = 0; + int err = 0; *type = cfs_crypto_hash_type(hash_alg); @@ -93,12 +93,12 @@ static int cfs_crypto_hash_alloc(enum cfs_crypto_hash_alg hash_alg, if (key) err = crypto_ahash_setkey(tfm, key, key_len); - else if ((*type)->cht_key != 0) + else if ((*type)->cht_key) err = crypto_ahash_setkey(tfm, (unsigned char *)&((*type)->cht_key), (*type)->cht_size); - if (err != 0) { + if (err) { ahash_request_free(*req); crypto_free_ahash(tfm); return err; @@ -147,16 +147,16 @@ int cfs_crypto_hash_digest(enum cfs_crypto_hash_alg hash_alg, unsigned char *key, unsigned int key_len, unsigned char *hash, unsigned int *hash_len) { - struct scatterlist sl; + struct scatterlist sl; struct ahash_request *req; - int err; - const struct cfs_crypto_hash_type *type; + int err; + const struct cfs_crypto_hash_type *type; - if (!buf || buf_len == 0 || !hash_len) + if (!buf || !buf_len || !hash_len) return -EINVAL; err = cfs_crypto_hash_alloc(hash_alg, &type, &req, key, key_len); - if (err != 0) + if (err) return err; if (!hash || *hash_len < type->cht_size) { @@ -177,7 +177,7 @@ int cfs_crypto_hash_digest(enum cfs_crypto_hash_alg hash_alg, EXPORT_SYMBOL(cfs_crypto_hash_digest); /** - * Allocate and initialize desriptor for hash algorithm. + * Allocate and initialize descriptor for hash algorithm. * * This should be used to initialize a hash descriptor for multiple calls * to a single hash function when computing the hash across multiple @@ -198,8 +198,8 @@ cfs_crypto_hash_init(enum cfs_crypto_hash_alg hash_alg, unsigned char *key, unsigned int key_len) { struct ahash_request *req; - int err; - const struct cfs_crypto_hash_type *type; + int err; + const struct cfs_crypto_hash_type *type; err = cfs_crypto_hash_alloc(hash_alg, &type, &req, key, key_len); @@ -273,7 +273,7 @@ EXPORT_SYMBOL(cfs_crypto_hash_update); int cfs_crypto_hash_final(struct cfs_crypto_hash_desc *hdesc, unsigned char *hash, unsigned int *hash_len) { - int err; + int err; struct ahash_request *req = (void *)hdesc; int size = crypto_ahash_digestsize(crypto_ahash_reqtfm(req)); @@ -312,8 +312,8 @@ static void cfs_crypto_performance_test(enum cfs_crypto_hash_alg hash_alg) { int buf_len = max(PAGE_SIZE, 1048576UL); void *buf; - unsigned long start, end; - int bcount, err = 0; + unsigned long start, end; + int bcount, err = 0; struct page *page; unsigned char hash[CFS_CRYPTO_HASH_DIGESTSIZE_MAX]; unsigned int hash_len = sizeof(hash); @@ -358,7 +358,7 @@ out_err: CDEBUG(D_INFO, "Crypto hash algorithm %s test error: rc = %d\n", cfs_crypto_hash_name(hash_alg), err); } else { - unsigned long tmp; + unsigned long tmp; tmp = ((bcount * buf_len / jiffies_to_msecs(end - start)) * 1000) / (1024 * 1024); @@ -440,6 +440,6 @@ int cfs_crypto_register(void) */ void cfs_crypto_unregister(void) { - if (adler32 == 0) + if (!adler32) cfs_crypto_adler32_unregister(); } |