Commit 6766ec47 authored by Niels Möller's avatar Niels Möller
Browse files

(test_spki_match, test_spki_grant, test_spki_deny): New functions.

Rev: src/testsuite/testutils.c:1.4
Rev: src/testsuite/testutils.h:1.4
parent 315d93f3
......@@ -236,3 +236,38 @@ test_sign(const char *name,
KILL(s);
KILL(key);
}
static int
test_spki_match(const char *name,
const struct lsh_string *resource,
const struct lsh_string *access)
{
struct spki_tag *tag = spki_sexp_to_tag
(string_to_sexp(SEXP_CANONICAL, resource, 0),
17);
struct sexp *access_expr
= string_to_sexp(SEXP_CANONICAL, access, 0);
(void) name;
return SPKI_TAG_MATCH(tag, access_expr);
}
void
test_spki_grant(const char *name,
const struct lsh_string *resource,
const struct lsh_string *access)
{
if (!test_spki_match(name, resource, access))
FAIL();
}
void
test_spki_deny(const char *name,
const struct lsh_string *resource,
const struct lsh_string *access)
{
if (test_spki_match(name, resource, access))
FAIL();
}
......@@ -44,6 +44,16 @@ test_sign(const char *name,
struct lsh_string *msg,
const struct lsh_string *signature);
void
test_spki_grant(const char *name,
const struct lsh_string *resource,
const struct lsh_string *access);
void
test_spki_deny(const char *name,
const struct lsh_string *resource,
const struct lsh_string *access);
#define H(x) decode_hex(x)
#define S(x) make_string(x)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment