From b37db5b51290fb82bb66a071c1a16d57ca58e920 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 5 Jun 2018 00:02:00 +0200 Subject: [PATCH 1/1] add external blob and internal blobmsg data structures Signed-off-by: Daniel Golle This work was sponsored by WIO (wiowireless.com) --- ucert.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/ucert.c b/ucert.c index 54ec223..ac04420 100644 --- a/ucert.c +++ b/ucert.c @@ -43,6 +43,37 @@ static enum { 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; -- 2.25.1