add external blob and internal blobmsg data structures
authorDaniel Golle <daniel@makrotopia.org>
Mon, 4 Jun 2018 22:02:00 +0000 (00:02 +0200)
committerDaniel Golle <daniel@makrotopia.org>
Thu, 14 Jun 2018 16:51:22 +0000 (18:51 +0200)
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This work was sponsored by WIO (wiowireless.com)

ucert.c

diff --git a/ucert.c b/ucert.c
index 54ec2233cbe57713439dccbcee26f7d0bdb24bdf..ac044201875da5046c0b7b29941a00e8641ffe69 100644 (file)
--- a/ucert.c
+++ b/ucert.c
@@ -43,6 +43,37 @@ static enum {
 
 static bool quiet;
 
 
 static bool quiet;
 
+enum cert_attr {
+       CERT_ATTR_SIGNATURE,
+       CERT_ATTR_PAYLOAD,
+       CERT_ATTR_MAX
+};
+
+static const struct blob_attr_info cert_policy[CERT_ATTR_MAX] = {
+       [CERT_ATTR_SIGNATURE] = { .type = BLOB_ATTR_BINARY },
+       [CERT_ATTR_PAYLOAD] = { .type = BLOB_ATTR_NESTED },
+};
+
+enum cert_payload_attr {
+       CERT_PL_ATTR_CERTTYPE,
+       CERT_PL_ATTR_CERTID,
+       CERT_PL_ATTR_PUBKEY,
+       CERT_PL_ATTR_KEY_FINGERPRINT,
+       CERT_PL_ATTR_MAX
+};
+
+enum certtype_id {
+       CERTTYPE_AUTH,
+       CERTTYPE_REVOKE
+};
+
+static const struct blobmsg_policy cert_payload_policy[CERT_PL_ATTR_MAX] = {
+       [CERT_PL_ATTR_CERTTYPE] = { .type = BLOBMSG_TYPE_INT8 },
+       [CERT_PL_ATTR_CERTID] = { .type = BLOBMSG_TYPE_INT64 },
+       [CERT_PL_ATTR_PUBKEY] = { .type = BLOBMSG_TYPE_STRING },
+       [CERT_PL_ATTR_KEY_FINGERPRINT] = { .type = BLOBMSG_TYPE_STRING },
+};
+
 static int cert_append(const char *certfile, const char *pubkeyfile, const char *sigfile) {
        fprintf(stderr, "not implemented\n");
        return 1;
 static int cert_append(const char *certfile, const char *pubkeyfile, const char *sigfile) {
        fprintf(stderr, "not implemented\n");
        return 1;