summaryrefslogtreecommitdiff
path: root/tools/tests/test-openssl.c
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2013-02-03 23:26:10 +0100
committerStef Walter <stefw@gnome.org>2013-02-05 15:00:25 +0100
commit32ca4f6d3167d08fc985d66fe48f453954596f87 (patch)
tree4dd767287480a047e4f1370bc6925d2fb748ceea /tools/tests/test-openssl.c
parent39e9f190416ecb4260a3b079e1d79fc2e55f5a33 (diff)
Use the CN, OU or O of certificates to generate a label
* This is in cases where the certificate information does not already have a friendly name or alias.
Diffstat (limited to 'tools/tests/test-openssl.c')
-rw-r--r--tools/tests/test-openssl.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/tools/tests/test-openssl.c b/tools/tests/test-openssl.c
index a48220d..d242b50 100644
--- a/tools/tests/test-openssl.c
+++ b/tools/tests/test-openssl.c
@@ -373,7 +373,7 @@ test_file_without (CuTest *tc)
}
/* From extract-openssl.c */
-void p11_openssl_canon_string (char *str, long *len);
+void p11_openssl_canon_string (char *str, size_t *len);
static void
test_canon_string (CuTest *tc)
@@ -392,21 +392,23 @@ test_canon_string (CuTest *tc)
};
char *str;
- long len;
- long out;
+ size_t len;
+ size_t out;
int i;
for (i = 0; i < ELEMS (fixtures); i++) {
- len = fixtures[i].input_len;
- if (len < 0)
+ if (fixtures[i].input_len < 0)
len = strlen (fixtures[i].input);
+ else
+ len = fixtures[i].input_len;
str = strndup (fixtures[i].input, len);
p11_openssl_canon_string (str, &len);
- out = fixtures[i].output_len;
- if (out < 0)
+ if (fixtures[i].output_len < 0)
out = strlen (fixtures[i].output);
+ else
+ out = fixtures[i].output_len;
CuAssertIntEquals (tc, out, len);
CuAssertStrEquals (tc, fixtures[i].output, str);