summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2014-04-17 10:56:26 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2014-04-17 10:56:26 +0000
commitaa22825dae7ac2c9ed6898ab7d8adeb879867e4b (patch)
treea6a5f02179f24b474b4568fe2e4e8fb848f01752
parent8c54d996aaaff1270290deb9248428cd15a96548 (diff)
remove duplicated tests in if statements
ok krw@ sthen@ deraadt@
-rw-r--r--lib/libssl/src/crypto/store/str_lib.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/libssl/src/crypto/store/str_lib.c b/lib/libssl/src/crypto/store/str_lib.c
index 32ae5bd3957..e92dc1f51c2 100644
--- a/lib/libssl/src/crypto/store/str_lib.c
+++ b/lib/libssl/src/crypto/store/str_lib.c
@@ -472,7 +472,7 @@ EVP_PKEY *STORE_get_private_key(STORE *s, OPENSSL_ITEM attributes[],
object = s->meth->get_object(s, STORE_OBJECT_TYPE_PRIVATE_KEY,
attributes, parameters);
- if (!object || !object->data.key || !object->data.key)
+ if (!object || !object->data.key)
{
STOREerr(STORE_F_STORE_GET_PRIVATE_KEY,
STORE_R_FAILED_GETTING_KEY);
@@ -613,7 +613,7 @@ EVP_PKEY *STORE_list_private_key_next(STORE *s, void *handle)
list_object_next,STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION);
object = s->meth->list_object_next(s, handle);
- if (!object || !object->data.key || !object->data.key)
+ if (!object || !object->data.key)
{
STOREerr(STORE_F_STORE_LIST_PRIVATE_KEY_NEXT,
STORE_R_FAILED_LISTING_KEYS);
@@ -667,7 +667,7 @@ EVP_PKEY *STORE_get_public_key(STORE *s, OPENSSL_ITEM attributes[],
object = s->meth->get_object(s, STORE_OBJECT_TYPE_PUBLIC_KEY,
attributes, parameters);
- if (!object || !object->data.key || !object->data.key)
+ if (!object || !object->data.key)
{
STOREerr(STORE_F_STORE_GET_PUBLIC_KEY,
STORE_R_FAILED_GETTING_KEY);
@@ -808,7 +808,7 @@ EVP_PKEY *STORE_list_public_key_next(STORE *s, void *handle)
list_object_next,STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION);
object = s->meth->list_object_next(s, handle);
- if (!object || !object->data.key || !object->data.key)
+ if (!object || !object->data.key)
{
STOREerr(STORE_F_STORE_LIST_PUBLIC_KEY_NEXT,
STORE_R_FAILED_LISTING_KEYS);
@@ -1670,7 +1670,7 @@ int STORE_parse_attrs_endp(void *handle)
}
static int attr_info_compare_compute_range(
- unsigned char *abits, unsigned char *bbits,
+ const unsigned char *abits, const unsigned char *bbits,
unsigned int *alowp, unsigned int *ahighp,
unsigned int *blowp, unsigned int *bhighp)
{
@@ -1739,13 +1739,15 @@ static int attr_info_compare_compute_range(
return res;
}
-int STORE_ATTR_INFO_compare(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b)
+int STORE_ATTR_INFO_compare(const STORE_ATTR_INFO * const *a,
+ const STORE_ATTR_INFO * const *b)
{
if (a == b) return 0;
if (!a) return -1;
if (!b) return 1;
- return attr_info_compare_compute_range(a->set, b->set, 0, 0, 0, 0);
+ return attr_info_compare_compute_range((*a)->set, (*b)->set, 0, 0, 0, 0);
}
+
int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b)
{
unsigned int alow, ahigh, blow, bhigh;
@@ -1759,6 +1761,7 @@ int STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b)
return 1;
return 0;
}
+
int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b)
{
unsigned char *abits, *bbits;
@@ -1776,6 +1779,7 @@ int STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b)
}
return 1;
}
+
int STORE_ATTR_INFO_in_ex(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b)
{
STORE_ATTR_TYPES i;