summaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre/include/linux
diff options
context:
space:
mode:
authorAndreas Dilger <andreas.dilger@intel.com>2016-03-26 15:40:48 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-03-29 12:06:51 -0700
commit24a4e1ec63ffcd87f656f507709b5f03f6a5f155 (patch)
treec7f130e97ead8d1d5f3753eb98aa3fbf7849d325 /drivers/staging/lustre/include/linux
parent4d60ffa12c887e1944d5582d79cc9d7f3593eb00 (diff)
downloadop-kernel-dev-24a4e1ec63ffcd87f656f507709b5f03f6a5f155.zip
op-kernel-dev-24a4e1ec63ffcd87f656f507709b5f03f6a5f155.tar.gz
staging: lustre: libcfs: add new definitions for cfs_crypto api
Add CFS_HASH_ALG_UNKOWN for unknown hash names instead of using "0xFF" directly. Define the max digestsize the cfs crypto api can handle. Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5053 Reviewed-on: http://review.whamcloud.com/9990 Reviewed-by: Bob Glossman <bob.glossman@intel.com> Reviewed-by: James Simmons <uja.ornl@gmail.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/include/linux')
-rw-r--r--drivers/staging/lustre/include/linux/libcfs/libcfs_crypto.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_crypto.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_crypto.h
index 0782bfb..921aa7c 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_crypto.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_crypto.h
@@ -46,7 +46,8 @@ enum cfs_crypto_hash_alg {
CFS_HASH_ALG_SHA384,
CFS_HASH_ALG_SHA512,
CFS_HASH_ALG_CRC32C,
- CFS_HASH_ALG_MAX
+ CFS_HASH_ALG_MAX,
+ CFS_HASH_ALG_UNKNOWN = 0xff
};
static struct cfs_crypto_hash_type hash_types[] = {
@@ -59,8 +60,12 @@ static struct cfs_crypto_hash_type hash_types[] = {
[CFS_HASH_ALG_SHA256] = { "sha256", 0, 32 },
[CFS_HASH_ALG_SHA384] = { "sha384", 0, 48 },
[CFS_HASH_ALG_SHA512] = { "sha512", 0, 64 },
+ [CFS_HASH_ALG_MAX] = { NULL, 0, 64 },
};
+/* Maximum size of hash_types[].cht_size */
+#define CFS_CRYPTO_HASH_DIGESTSIZE_MAX 64
+
/**
* Return hash algorithm information for the specified algorithm identifier
*
@@ -131,7 +136,7 @@ static inline unsigned char cfs_crypto_hash_alg(const char *algname)
for (i = 0; i < CFS_HASH_ALG_MAX; i++)
if (!strcmp(hash_types[i].cht_name, algname))
break;
- return (i == CFS_HASH_ALG_MAX ? 0xFF : i);
+ return (i == CFS_HASH_ALG_MAX ? CFS_HASH_ALG_UNKNOWN : i);
}
int cfs_crypto_hash_digest(unsigned char hash_alg,
OpenPOWER on IntegriCloud