aboutsummaryrefslogtreecommitdiff
path: root/src/escrow/plugin_escrow_gns.c
diff options
context:
space:
mode:
authorjospaeth <spaethj@in.tum.de>2020-07-15 16:28:26 +0200
committerjospaeth <spaethj@in.tum.de>2020-07-15 16:28:26 +0200
commit3192c1c84a8cf6aa81e55ac647adf125cbd88904 (patch)
treecf8c0505b36ac3a5c7d86d6a683b6651c1917dce /src/escrow/plugin_escrow_gns.c
parent122f2979146c6068cbaf189560f196e4a3323801 (diff)
downloadgnunet-3192c1c84a8cf6aa81e55ac647adf125cbd88904.tar.gz
gnunet-3192c1c84a8cf6aa81e55ac647adf125cbd88904.zip
changes to the escrow api [not compiling]
Diffstat (limited to 'src/escrow/plugin_escrow_gns.c')
-rw-r--r--src/escrow/plugin_escrow_gns.c61
1 files changed, 59 insertions, 2 deletions
diff --git a/src/escrow/plugin_escrow_gns.c b/src/escrow/plugin_escrow_gns.c
index 85cbf4347..04a6984e2 100644
--- a/src/escrow/plugin_escrow_gns.c
+++ b/src/escrow/plugin_escrow_gns.c
@@ -28,6 +28,7 @@
28#include "platform.h" 28#include "platform.h"
29#include "gnunet_util_lib.h" 29#include "gnunet_util_lib.h"
30#include "gnunet_escrow_plugin.h" 30#include "gnunet_escrow_plugin.h"
31#include "escrow_plugin_helper.h"
31#include <sss.h> 32#include <sss.h>
32#include <inttypes.h> 33#include <inttypes.h>
33 34
@@ -36,6 +37,17 @@
36 37
37 38
38/** 39/**
40 * Identity handle
41 */
42static struct GNUNET_IDENTITY_Handle *identity_handle;
43
44/**
45 * Handle for the plugin instance
46 */
47struct EscrowPluginHandle ph;
48
49
50/**
39 * Start the GNS escrow of the key 51 * Start the GNS escrow of the key
40 * 52 *
41 * @param ego the identity ego containing the private key 53 * @param ego the identity ego containing the private key
@@ -77,7 +89,7 @@ start_gns_key_escrow (const struct GNUNET_IDENTITY_Ego *ego)
77 * @return the escrow anchor needed to restore the key 89 * @return the escrow anchor needed to restore the key
78 */ 90 */
79void * 91void *
80renew_gns_key_escrow (const struct GNUNET_IDENTITY_Ego *ego) 92renew_gns_key_escrow (void *escrowAnchor)
81{ 93{
82 // TODO: implement 94 // TODO: implement
83 return NULL; 95 return NULL;
@@ -119,21 +131,63 @@ restore_gns_key_escrow (void *escrowAnchor,
119 131
120 132
121/** 133/**
134 * Deserialize an escrow anchor string into a GNUNET_ESCROW_Anchor struct
135 *
136 * @param anchorString the encoded escrow anchor string
137 * @return the deserialized data packed into a GNUNET_ESCROW_Anchor struct
138 */
139const struct GNUNET_ESCROW_Anchor *
140gns_anchor_string_to_data (char *anchorString)
141{
142 struct GNUNET_ESCROW_Anchor *anchor;
143 uint32_t data_size;
144
145 data_size = strlen (anchorString) + 1;
146
147 anchor = GNUNET_malloc (sizeof (struct GNUNET_ESCROW_Anchor) + data_size);
148 anchor->size = data_size;
149 // TODO: deserialize?
150 GNUNET_memcpy (&anchor[1], anchorString, data_size);
151
152 return anchor;
153}
154
155
156/**
157 * ContinueIdentityInitFunction for the GNS plugin
158 */
159void
160gns_cont_init ()
161{
162 return;
163}
164
165
166/**
122 * Entry point for the plugin. 167 * Entry point for the plugin.
123 * 168 *
124 * @param cls NULL 169 * @param cls Config info
125 * @return the exported block API 170 * @return the exported block API
126 */ 171 */
127void * 172void *
128libgnunet_plugin_escrow_gns_init (void *cls) 173libgnunet_plugin_escrow_gns_init (void *cls)
129{ 174{
130 struct GNUNET_ESCROW_KeyPluginFunctions *api; 175 struct GNUNET_ESCROW_KeyPluginFunctions *api;
176 struct GNUNET_CONFIGURATION_Handle *cfg = cls;
131 177
132 api = GNUNET_new (struct GNUNET_ESCROW_KeyPluginFunctions); 178 api = GNUNET_new (struct GNUNET_ESCROW_KeyPluginFunctions);
133 api->start_key_escrow = &start_gns_key_escrow; 179 api->start_key_escrow = &start_gns_key_escrow;
134 api->renew_key_escrow = &renew_gns_key_escrow; 180 api->renew_key_escrow = &renew_gns_key_escrow;
135 api->verify_key_escrow = &verify_gns_key_escrow; 181 api->verify_key_escrow = &verify_gns_key_escrow;
136 api->restore_key = &restore_gns_key_escrow; 182 api->restore_key = &restore_gns_key_escrow;
183 api->anchor_string_to_data = &gns_anchor_string_to_data;
184
185 ph.cont = &gns_cont_init;
186
187 identity_handle = GNUNET_IDENTITY_connect (cfg,
188 &GNUNET_ESCROW_list_ego,
189 &ph);
190
137 return api; 191 return api;
138} 192}
139 193
@@ -150,6 +204,9 @@ libgnunet_plugin_escrow_gns_done (void *cls)
150 struct GNUNET_RECLAIM_EscrowKeyPluginFunctions *api = cls; 204 struct GNUNET_RECLAIM_EscrowKeyPluginFunctions *api = cls;
151 205
152 GNUNET_free (api); 206 GNUNET_free (api);
207 GNUNET_IDENTITY_disconnect (identity_handle);
208 GNUNET_ESCROW_cleanup_ego_list (&ph);
209
153 return NULL; 210 return NULL;
154} 211}
155 212