diff options
author | jospaeth <spaethj@in.tum.de> | 2020-07-05 13:06:14 +0200 |
---|---|---|
committer | jospaeth <spaethj@in.tum.de> | 2020-07-09 14:56:09 +0200 |
commit | eeb3610df1d4f102e60abf20d22a3febc0f9b273 (patch) | |
tree | 566a1cc8d4d14e43c6001265185f6118f0af5bfd /src/escrow/plugin_escrow_gns.c | |
parent | c9ea27bc037eeae5ee39b05cd11b06e48399fb43 (diff) | |
download | gnunet-eeb3610df1d4f102e60abf20d22a3febc0f9b273.tar.gz gnunet-eeb3610df1d4f102e60abf20d22a3febc0f9b273.zip |
create escrow component
Diffstat (limited to 'src/escrow/plugin_escrow_gns.c')
-rw-r--r-- | src/escrow/plugin_escrow_gns.c | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/src/escrow/plugin_escrow_gns.c b/src/escrow/plugin_escrow_gns.c new file mode 100644 index 000000000..3851025e6 --- /dev/null +++ b/src/escrow/plugin_escrow_gns.c | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2013, 2014, 2016 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file escrow/plugin_escrow_gns.c | ||
23 | * @brief escrow-plugin-gns escrow plugin for the escrow of the key | ||
24 | * using GNS and escrow identities | ||
25 | * | ||
26 | * @author Johannes Späth | ||
27 | */ | ||
28 | #include "platform.h" | ||
29 | #include "gnunet_util_lib.h" | ||
30 | #include "gnunet_escrow_plugin.h" | ||
31 | #include <sss.h> | ||
32 | #include <inttypes.h> | ||
33 | |||
34 | |||
35 | /** | ||
36 | * Start the GNS escrow of the key | ||
37 | * | ||
38 | * @param ego the identity ego containing the private key | ||
39 | * @param escrowAnchor the anchor needed to restore the key | ||
40 | * @return GNUNET_OK if successful | ||
41 | */ | ||
42 | int | ||
43 | start_gns_key_escrow (const struct GNUNET_IDENTITY_Ego *ego, | ||
44 | void *escrowAnchor) | ||
45 | { | ||
46 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; | ||
47 | |||
48 | if (NULL == ego) | ||
49 | { | ||
50 | return GNUNET_NO; | ||
51 | } | ||
52 | pk = GNUNET_IDENTITY_ego_get_private_key (ego); | ||
53 | |||
54 | // split the private key (SSS) | ||
55 | |||
56 | // create the escrow identities | ||
57 | |||
58 | // distribute the shares to the identities | ||
59 | |||
60 | |||
61 | // TODO: implement | ||
62 | return GNUNET_NO; | ||
63 | } | ||
64 | |||
65 | |||
66 | /** | ||
67 | * Renew the GNS escrow of the key | ||
68 | * | ||
69 | * @param ego the identity ego containing the private key | ||
70 | * @param escrowAnchor the anchor needed to restore the key | ||
71 | * @return GNUNET_OK if successful | ||
72 | */ | ||
73 | int | ||
74 | renew_gns_key_escrow (const struct GNUNET_IDENTITY_Ego *ego, | ||
75 | void *escrowAnchor) | ||
76 | { | ||
77 | // TODO: implement | ||
78 | return GNUNET_NO; | ||
79 | } | ||
80 | |||
81 | |||
82 | /** | ||
83 | * Entry point for the plugin. | ||
84 | * | ||
85 | * @param cls NULL | ||
86 | * @return the exported block API | ||
87 | */ | ||
88 | void * | ||
89 | libgnunet_plugin_escrow_gns_init (void *cls) | ||
90 | { | ||
91 | struct GNUNET_ESCROW_KeyPluginFunctions *api; | ||
92 | |||
93 | api = GNUNET_new (struct GNUNET_ESCROW_KeyPluginFunctions); | ||
94 | api->start_key_escrow = &start_gns_key_escrow; | ||
95 | api->renew_key_escrow = &renew_gns_key_escrow; | ||
96 | return api; | ||
97 | } | ||
98 | |||
99 | |||
100 | /** | ||
101 | * Exit point from the plugin. | ||
102 | * | ||
103 | * @param cls the return value from #libgnunet_plugin_block_test_init() | ||
104 | * @return NULL | ||
105 | */ | ||
106 | void * | ||
107 | libgnunet_plugin_escrow_gns_done (void *cls) | ||
108 | { | ||
109 | struct GNUNET_RECLAIM_EscrowKeyPluginFunctions *api = cls; | ||
110 | |||
111 | GNUNET_free (api); | ||
112 | return NULL; | ||
113 | } | ||
114 | |||
115 | |||
116 | /* end of plugin_escrow_gns.c */ | ||