diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2022-10-29 18:06:26 +0900 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2022-10-29 18:06:26 +0900 |
commit | 0f2da4636e108c70697c589d9e38781f2bafefba (patch) | |
tree | 0e831befd71d4323596cdae55e8431df7720c531 /src/revocation/plugin_block_revocation.c | |
parent | 4e2259f14be320c8e2fe2a672a473e09677269c4 (diff) | |
download | gnunet-0f2da4636e108c70697c589d9e38781f2bafefba.tar.gz gnunet-0f2da4636e108c70697c589d9e38781f2bafefba.zip |
IDENTITY
This commit is a major rework of the unclean GNUNET_IDENTITY_*Key
structures and its use in serialized objects (e.g. RPC messages).
The structures are now no longer to be used directly but instead through
their serialization helper functions whenever needed.
Diffstat (limited to 'src/revocation/plugin_block_revocation.c')
-rw-r--r-- | src/revocation/plugin_block_revocation.c | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/src/revocation/plugin_block_revocation.c b/src/revocation/plugin_block_revocation.c index 12ec555e4..0c81440eb 100644 --- a/src/revocation/plugin_block_revocation.c +++ b/src/revocation/plugin_block_revocation.c | |||
@@ -56,10 +56,10 @@ struct InternalContext | |||
56 | */ | 56 | */ |
57 | static enum GNUNET_GenericReturnValue | 57 | static enum GNUNET_GenericReturnValue |
58 | block_plugin_revocation_check_query (void *cls, | 58 | block_plugin_revocation_check_query (void *cls, |
59 | enum GNUNET_BLOCK_Type type, | 59 | enum GNUNET_BLOCK_Type type, |
60 | const struct GNUNET_HashCode *query, | 60 | const struct GNUNET_HashCode *query, |
61 | const void *xquery, | 61 | const void *xquery, |
62 | size_t xquery_size) | 62 | size_t xquery_size) |
63 | { | 63 | { |
64 | (void) cls; | 64 | (void) cls; |
65 | (void) query; | 65 | (void) query; |
@@ -86,16 +86,16 @@ block_plugin_revocation_check_query (void *cls, | |||
86 | */ | 86 | */ |
87 | static enum GNUNET_GenericReturnValue | 87 | static enum GNUNET_GenericReturnValue |
88 | block_plugin_revocation_check_block (void *cls, | 88 | block_plugin_revocation_check_block (void *cls, |
89 | enum GNUNET_BLOCK_Type type, | 89 | enum GNUNET_BLOCK_Type type, |
90 | const void *block, | 90 | const void *block, |
91 | size_t block_size) | 91 | size_t block_size) |
92 | { | 92 | { |
93 | struct InternalContext *ic = cls; | 93 | struct InternalContext *ic = cls; |
94 | const struct RevokeMessage *rm = block; | 94 | const struct RevokeMessage *rm = block; |
95 | const struct GNUNET_REVOCATION_PowP *pow | 95 | const struct GNUNET_REVOCATION_PowP *pow |
96 | = (const struct GNUNET_REVOCATION_PowP *) &rm[1]; | 96 | = (const struct GNUNET_REVOCATION_PowP *) &rm[1]; |
97 | struct GNUNET_IDENTITY_PublicKey pk; | 97 | struct GNUNET_IDENTITY_PublicKey pk; |
98 | ssize_t pklen; | 98 | size_t pklen; |
99 | size_t left; | 99 | size_t left; |
100 | 100 | ||
101 | if (GNUNET_BLOCK_TYPE_REVOCATION != type) | 101 | if (GNUNET_BLOCK_TYPE_REVOCATION != type) |
@@ -114,9 +114,10 @@ block_plugin_revocation_check_block (void *cls, | |||
114 | return GNUNET_NO; | 114 | return GNUNET_NO; |
115 | } | 115 | } |
116 | left = block_size - sizeof (*rm) - sizeof (*pow); | 116 | left = block_size - sizeof (*rm) - sizeof (*pow); |
117 | pklen = GNUNET_IDENTITY_read_key_from_buffer (&pk, | 117 | GNUNET_IDENTITY_read_public_key_from_buffer (&pow[1], |
118 | &pow[1], | 118 | left, |
119 | left); | 119 | &pk, |
120 | &pklen); | ||
120 | if (0 > pklen) | 121 | if (0 > pklen) |
121 | { | 122 | { |
122 | GNUNET_break_op (0); | 123 | GNUNET_break_op (0); |
@@ -152,14 +153,14 @@ block_plugin_revocation_check_block (void *cls, | |||
152 | */ | 153 | */ |
153 | static enum GNUNET_BLOCK_ReplyEvaluationResult | 154 | static enum GNUNET_BLOCK_ReplyEvaluationResult |
154 | block_plugin_revocation_check_reply ( | 155 | block_plugin_revocation_check_reply ( |
155 | void *cls, | 156 | void *cls, |
156 | enum GNUNET_BLOCK_Type type, | 157 | enum GNUNET_BLOCK_Type type, |
157 | struct GNUNET_BLOCK_Group *group, | 158 | struct GNUNET_BLOCK_Group *group, |
158 | const struct GNUNET_HashCode *query, | 159 | const struct GNUNET_HashCode *query, |
159 | const void *xquery, | 160 | const void *xquery, |
160 | size_t xquery_size, | 161 | size_t xquery_size, |
161 | const void *reply_block, | 162 | const void *reply_block, |
162 | size_t reply_block_size) | 163 | size_t reply_block_size) |
163 | { | 164 | { |
164 | (void) cls; | 165 | (void) cls; |
165 | (void) group; | 166 | (void) group; |
@@ -199,7 +200,7 @@ block_plugin_revocation_get_key (void *cls, | |||
199 | const struct GNUNET_REVOCATION_PowP *pow | 200 | const struct GNUNET_REVOCATION_PowP *pow |
200 | = (const struct GNUNET_REVOCATION_PowP *) &rm[1]; | 201 | = (const struct GNUNET_REVOCATION_PowP *) &rm[1]; |
201 | struct GNUNET_IDENTITY_PublicKey pk; | 202 | struct GNUNET_IDENTITY_PublicKey pk; |
202 | ssize_t pklen; | 203 | size_t pklen; |
203 | size_t left; | 204 | size_t left; |
204 | 205 | ||
205 | if (GNUNET_BLOCK_TYPE_REVOCATION != type) | 206 | if (GNUNET_BLOCK_TYPE_REVOCATION != type) |
@@ -218,9 +219,10 @@ block_plugin_revocation_get_key (void *cls, | |||
218 | return GNUNET_NO; | 219 | return GNUNET_NO; |
219 | } | 220 | } |
220 | left = block_size - sizeof (*rm) - sizeof (*pow); | 221 | left = block_size - sizeof (*rm) - sizeof (*pow); |
221 | pklen = GNUNET_IDENTITY_read_key_from_buffer (&pk, | 222 | GNUNET_IDENTITY_read_public_key_from_buffer (&pow[1], |
222 | &pow[1], | 223 | left, |
223 | left); | 224 | &pk, |
225 | &pklen); | ||
224 | if (0 > pklen) | 226 | if (0 > pklen) |
225 | { | 227 | { |
226 | GNUNET_break_op (0); | 228 | GNUNET_break_op (0); |
@@ -242,7 +244,7 @@ void * | |||
242 | libgnunet_plugin_block_revocation_init (void *cls) | 244 | libgnunet_plugin_block_revocation_init (void *cls) |
243 | { | 245 | { |
244 | static const enum GNUNET_BLOCK_Type types[] = { | 246 | static const enum GNUNET_BLOCK_Type types[] = { |
245 | GNUNET_BLOCK_TYPE_REVOCATION, | 247 | GNUNET_BLOCK_TYPE_REVOCATION, |
246 | GNUNET_BLOCK_TYPE_ANY /* end of list */ | 248 | GNUNET_BLOCK_TYPE_ANY /* end of list */ |
247 | }; | 249 | }; |
248 | const struct GNUNET_CONFIGURATION_Handle *cfg = cls; | 250 | const struct GNUNET_CONFIGURATION_Handle *cfg = cls; |