summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2013-03-08 08:36:11 +0100
committerStef Walter <stefw@gnome.org>2013-03-08 14:01:54 +0100
commitba9cb5cab824fa4180355def6bc2e464b4e24ab0 (patch)
treef15f475b6502f73643c413f0bdb35da6a1affd31
parentd7aee0a1ab76fb1299db5cf398088ebec1fe98be (diff)
downloadp11-kit-ba9cb5cab824fa4180355def6bc2e464b4e24ab0.tar.gz
extract: Use bool instead of int where appropriate
-rw-r--r--tools/extract-info.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/tools/extract-info.c b/tools/extract-info.c
index ee6dbe1..2ae9e04 100644
--- a/tools/extract-info.c
+++ b/tools/extract-info.c
@@ -107,7 +107,7 @@ load_stapled_extensions (CK_FUNCTION_LIST_PTR module,
return stapled;
}
-static int
+static bool
extract_purposes (p11_extract_info *ex)
{
CK_ATTRIBUTE oid = { CKA_OBJECT_ID,
@@ -138,7 +138,7 @@ extract_purposes (p11_extract_info *ex)
/* No such extension, match anything */
if (ext == NULL)
- return 1;
+ return true;
ex->purposes = p11_x509_parse_extended_key_usage (ex->asn1_defs, ext, ext_len);
@@ -146,7 +146,7 @@ extract_purposes (p11_extract_info *ex)
return ex->purposes != NULL;
}
-static int
+static bool
extract_certificate (P11KitIter *iter,
p11_extract_info *ex)
{
@@ -158,11 +158,11 @@ extract_certificate (P11KitIter *iter,
if (!p11_attrs_find_ulong (ex->attrs, CKA_CERTIFICATE_TYPE, &type))
type = (CK_ULONG)-1;
if (type != CKC_X_509)
- return 0;
+ return false;
attr = p11_attrs_find_valid (ex->attrs, CKA_VALUE);
if (!attr || !attr->pValue)
- return 0;
+ return false;
ex->cert_der = attr->pValue;
ex->cert_len = attr->ulValueLen;
@@ -171,13 +171,13 @@ extract_certificate (P11KitIter *iter,
if (!ex->cert_asn) {
p11_message ("couldn't parse certificate: %s", message);
- return 0;
+ return false;
}
- return 1;
+ return true;
}
-static int
+static bool
extract_info (P11KitIter *iter,
p11_extract_info *ex)
{
@@ -204,25 +204,25 @@ extract_info (P11KitIter *iter,
/* The attributes couldn't be loaded */
if (rv != CKR_OK && rv != CKR_ATTRIBUTE_TYPE_INVALID && rv != CKR_ATTRIBUTE_SENSITIVE) {
p11_message ("couldn't load attributes: %s", p11_kit_strerror (rv));
- return 0;
+ return false;
}
attr = p11_attrs_find (ex->attrs, CKA_CLASS);
/* No class attribute, very strange, just skip */
if (!attr || !attr->pValue || attr->ulValueLen != sizeof (CK_OBJECT_CLASS))
- return 0;
+ return false;
ex->klass = *((CK_ULONG *)attr->pValue);
/* If a certificate then */
if (ex->klass != CKO_CERTIFICATE) {
p11_message ("skipping non-certificate object");
- return 0;
+ return false;
}
if (!extract_certificate (iter, ex))
- return 0;
+ return false;
attr = p11_attrs_find (ex->attrs, CKA_ID);
if (attr) {
@@ -230,13 +230,13 @@ extract_info (P11KitIter *iter,
p11_kit_iter_get_slot (iter),
attr);
if (!ex->stapled)
- return 0;
+ return false;
}
if (!extract_purposes (ex))
- return 0;
+ return false;
- return 1;
+ return true;
}
static void