aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/gnunet_zklaim_service.h14
-rw-r--r--src/zklaim/zklaim_functions.c41
2 files changed, 55 insertions, 0 deletions
diff --git a/src/include/gnunet_zklaim_service.h b/src/include/gnunet_zklaim_service.h
index 6654555ab..0a551e703 100644
--- a/src/include/gnunet_zklaim_service.h
+++ b/src/include/gnunet_zklaim_service.h
@@ -37,6 +37,7 @@ extern "C"
37#endif 37#endif
38 38
39#include "gnunet_util_lib.h" 39#include "gnunet_util_lib.h"
40#include "zklaim/zklaim.h"
40 41
41/** 42/**
42 * Version number of GNUnet Identity Provider API. 43 * Version number of GNUnet Identity Provider API.
@@ -80,6 +81,19 @@ typedef void
80 uint64_t *data); 81 uint64_t *data);
81 82
82 83
84/**
85 * Iterator called for each attribute to set a predicate in proof generation.
86 *
87 * @param cls closure
88 * @param name name of attribute
89 * @param data attribute data (can be modified)
90 */
91typedef void
92(*GNUNET_ZKLAIM_PredicateIterator) (void *cls,
93 const char* name,
94 enum zklaim_op *op,
95 uint64_t *ref);
96
83 97
84/** 98/**
85 * Continuation called to notify client about result of the 99 * Continuation called to notify client about result of the
diff --git a/src/zklaim/zklaim_functions.c b/src/zklaim/zklaim_functions.c
index 268056698..3c968cfea 100644
--- a/src/zklaim/zklaim_functions.c
+++ b/src/zklaim/zklaim_functions.c
@@ -98,3 +98,44 @@ ZKLAIM_context_issue (struct GNUNET_ZKLAIM_Context *ctx,
98 ZKLAIM_context_sign (ctx, 98 ZKLAIM_context_sign (ctx,
99 key); 99 key);
100} 100}
101
102void
103ZKLAIM_context_prove (struct GNUNET_ZKLAIM_Context *ctx,
104 GNUNET_ZKLAIM_PredicateIterator iter,
105 void *iter_cls)
106{
107 int i;
108 int j;
109 char *attr_name;
110 char *tmp;
111 zklaim_wrap_payload_ctx *plw;
112
113 tmp = GNUNET_strdup (ctx->attrs);
114 attr_name = strtok (tmp, ",");
115 plw = ctx->ctx->pl_ctx_head;
116
117 for (i = 0; i < ctx->ctx->num_of_payloads; i++)
118 {
119 for (j = 0; j < ZKLAIM_MAX_PAYLOAD_ATTRIBUTES; j++)
120 {
121 GNUNET_assert (NULL != attr_name);
122 iter (iter_cls,
123 attr_name,
124 &plw->pl.data_op[i],
125 &plw->pl.data_ref[i]);
126 attr_name = strtok (NULL, ",");
127 }
128 plw = plw->next;
129 GNUNET_assert (NULL != plw);
130 }
131 GNUNET_free (tmp);
132
133}
134
135int
136ZKLAIM_context_verify (struct GNUNET_ZKLAIM_Context *ctx,
137 const struct GNUNET_CRYPTO_EcdsaPublicKey *ttp)
138{
139 //TODO check ttp pubkey against pubkey in ctx
140 return zklaim_ctx_verify (ctx->ctx);
141}