summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Chadima <jchadima@redhat.com>2010-08-05 18:36:18 +0200
committerMiloslav Trmač <mitr@redhat.com>2010-08-24 20:58:30 +0200
commit281991a6bf8daf4ca587b63da32d88e58f3b7962 (patch)
tree4d0d340aace4ef0cb6ff7901efbe291be0c47b2e
parent4553bbd1ed220d481955e8a7a503dcd89c1bef61 (diff)
downloadcryptodev-linux-281991a6bf8daf4ca587b63da32d88e58f3b7962.tar.gz
cryptodev-linux-281991a6bf8daf4ca587b63da32d88e58f3b7962.tar.xz
cryptodev-linux-281991a6bf8daf4ca587b63da32d88e58f3b7962.zip
Don't assume NCR_KEY_INVALID is 0
-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;
}