summaryrefslogtreecommitdiffstats
path: root/userspace/ncrypto_key.c
diff options
context:
space:
mode:
authorJan Chadima <jchadima@redhat.com>2010-08-05 18:36:18 +0200
committerMiloslav Trmač <mitr@redhat.com>2010-08-23 20:01:58 +0200
commitc162df10090ee57d0219adcd6b51809bd78a2dd2 (patch)
tree8a615f094fd73052e16c389d541e59799e16e55b /userspace/ncrypto_key.c
parenta46cc44977691cf6ea62c19d2b57d74f94ae2e20 (diff)
downloadcryptodev-linux-c162df10090ee57d0219adcd6b51809bd78a2dd2.tar.gz
cryptodev-linux-c162df10090ee57d0219adcd6b51809bd78a2dd2.tar.xz
cryptodev-linux-c162df10090ee57d0219adcd6b51809bd78a2dd2.zip
Don't assume NCR_KEY_INVALID is 0
Diffstat (limited to 'userspace/ncrypto_key.c')
-rw-r--r--userspace/ncrypto_key.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/userspace/ncrypto_key.c b/userspace/ncrypto_key.c
index b5f2c92..47d4c94 100644
--- a/userspace/ncrypto_key.c
+++ b/userspace/ncrypto_key.c
@@ -26,7 +26,7 @@ ncr_key_generate(ncr_key_t key, ncr_key_generate_params_t params)
struct ncr_key_generate_st io;
memset(&io, 0, sizeof(io));
- if (!key) {
+ if (key == NCR_KEY_INVALID) {
errno = EINVAL;
return -1;
}
@@ -52,7 +52,7 @@ ncr_key_generate_pair(ncr_key_t key1, ncr_key_t key2, ncr_key_generate_params_t
struct ncr_key_generate_st io;
memset(&io, 0, sizeof(io));
- if (!key1 || !key2) {
+ if (key1 == NCR_KEY_INVALID|| key2 == NCR_KEY_INVALID) {
errno = EINVAL;
return -1;
}
@@ -79,7 +79,7 @@ ncr_key_derive(ncr_key_t newkey, unsigned int keyflags, ncr_key_t key, ncr_key_p
struct ncr_key_derivation_params_st io;
memset(&io, 0, sizeof(io));
- if (!newkey) {
+ if (newkey == NCR_KEY_INVALID || key == NCR_KEY_INVALID) {
errno = EINVAL;
return -1;
}
@@ -107,7 +107,7 @@ ncr_key_get_flags(ncr_key_t key)
struct ncr_key_info_st io;
memset(&io, 0, sizeof(io));
- if (!key) {
+ if (key == NCR_KEY_INVALID) {
errno = EINVAL;
return -1;
}
@@ -131,7 +131,7 @@ ncr_key_get_type(ncr_key_t key)
struct ncr_key_info_st io;
memset(&io, 0, sizeof(io));
- if (!key) {
+ if (key == NCR_KEY_INVALID) {
errno = EINVAL;
return -1;
}
@@ -155,7 +155,7 @@ ncr_key_get_id(ncr_key_t key, void *id, size_t *id_size)
struct ncr_key_info_st io;
memset(&io, 0, sizeof(io));
- if (!key) {
+ if (key == NCR_KEY_INVALID) {
errno = EINVAL;
return -1;
}
@@ -184,7 +184,7 @@ ncr_key_export(ncr_key_t key, void *idata, size_t idata_size)
struct ncr_key_data_st io;
memset(&io, 0, sizeof(io));
- if (!key || !idata || !idata_size) {
+ if (key == NCR_KEY_INVALID || !idata || !idata_size) {
errno = EINVAL;
return -1;
}
@@ -210,7 +210,7 @@ ncr_key_import(ncr_key_t key, void *idata, size_t idata_size, void *id, size_t i
struct ncr_key_data_st io;
memset(&io, 0, sizeof(io));
- if (!key || !idata || !idata_size || !id || !id_size || (algorithm == NCR_ALG_NONE)) {
+ if (key == NCR_KEY_INVALID || !idata || !idata_size || !id || !id_size || algorithm == NCR_ALG_NONE) {
errno = EINVAL;
return -1;
}
@@ -243,7 +243,7 @@ ncr_key_wrap(ncr_key_t key, ncr_wrap_algorithm_t algorithm, ncr_key_params_t par
struct ncr_key_wrap_st io;
memset(&io, 0, sizeof(io));
- if (!key || !keytowrap || !idata || !idata_size) {
+ if (key == NCR_KEY_INVALID || keytowrap == NCR_KEY_INVALID || !idata || !idata_size) {
errno = EINVAL;
return -1;
}
@@ -273,7 +273,7 @@ ncr_key_unwrap(ncr_key_t key, ncr_wrap_algorithm_t algorithm, ncr_key_params_t p
struct ncr_key_wrap_st io;
memset(&io, 0, sizeof(io));
- if (!key || !keytowrap || !idata || !idata_size) {
+ if (key == NCR_KEY_INVALID || keytowrap == NCR_KEY_INVALID || !idata || !idata_size) {
errno = EINVAL;
return -1;
}
@@ -303,7 +303,7 @@ ncr_key_storage_wrap(ncr_key_t keytowrap, void *idata, size_t idata_size)
struct ncr_key_storage_wrap_st io;
memset(&io, 0, sizeof(io));
- if (!keytowrap || !idata || !idata_size) {
+ if (keytowrap == NCR_KEY_INVALID || !idata || !idata_size) {
errno = EINVAL;
return -1;
}
@@ -329,7 +329,7 @@ ncr_key_storage_unwrap(ncr_key_t keytowrap, void *idata, size_t idata_size)
struct ncr_key_storage_wrap_st io;
memset(&io, 0, sizeof(io));
- if (!keytowrap || !idata || !idata_size) {
+ if (keytowrap == NCR_KEY_INVALID|| !idata || !idata_size) {
errno = EINVAL;
return -1;
}
@@ -352,7 +352,7 @@ ncr_key_storage_unwrap(ncr_key_t keytowrap, void *idata, size_t idata_size)
int
ncr_key_deinit(ncr_key_t key)
{
- if (!key) {
+ if (key == NCR_KEY_INVALID) {
errno = EINVAL;
return -1;
}