diff options
Diffstat (limited to 'src/credential/credential_serialization.c')
-rw-r--r-- | src/credential/credential_serialization.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/credential/credential_serialization.c b/src/credential/credential_serialization.c index b14ec26f2..4f3b11450 100644 --- a/src/credential/credential_serialization.c +++ b/src/credential/credential_serialization.c | |||
@@ -149,12 +149,12 @@ GNUNET_CREDENTIAL_delegation_set_deserialize ( | |||
149 | size_t | 149 | size_t |
150 | GNUNET_CREDENTIAL_credentials_get_size ( | 150 | GNUNET_CREDENTIAL_credentials_get_size ( |
151 | unsigned int c_count, | 151 | unsigned int c_count, |
152 | const struct GNUNET_CREDENTIAL_Credential *cd) | 152 | const struct GNUNET_CREDENTIAL_Delegate *cd) |
153 | { | 153 | { |
154 | unsigned int i; | 154 | unsigned int i; |
155 | size_t ret; | 155 | size_t ret; |
156 | 156 | ||
157 | ret = sizeof (struct CredentialEntry) * (c_count); | 157 | ret = sizeof (struct DelegateEntry) * (c_count); |
158 | 158 | ||
159 | for (i = 0; i < c_count; i++) | 159 | for (i = 0; i < c_count; i++) |
160 | { | 160 | { |
@@ -175,11 +175,11 @@ GNUNET_CREDENTIAL_credentials_get_size ( | |||
175 | ssize_t | 175 | ssize_t |
176 | GNUNET_CREDENTIAL_credentials_serialize ( | 176 | GNUNET_CREDENTIAL_credentials_serialize ( |
177 | unsigned int c_count, | 177 | unsigned int c_count, |
178 | const struct GNUNET_CREDENTIAL_Credential *cd, | 178 | const struct GNUNET_CREDENTIAL_Delegate *cd, |
179 | size_t dest_size, | 179 | size_t dest_size, |
180 | char *dest) | 180 | char *dest) |
181 | { | 181 | { |
182 | struct CredentialEntry c_rec; | 182 | struct DelegateEntry c_rec; |
183 | unsigned int i; | 183 | unsigned int i; |
184 | size_t off; | 184 | size_t off; |
185 | 185 | ||
@@ -192,7 +192,7 @@ GNUNET_CREDENTIAL_credentials_serialize ( | |||
192 | c_rec.signature = cd[i].signature; | 192 | c_rec.signature = cd[i].signature; |
193 | c_rec.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CREDENTIAL); | 193 | c_rec.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CREDENTIAL); |
194 | c_rec.purpose.size = | 194 | c_rec.purpose.size = |
195 | htonl ((sizeof (struct CredentialEntry) + cd[i].issuer_attribute_len) - | 195 | htonl ((sizeof (struct DelegateEntry) + cd[i].issuer_attribute_len) - |
196 | sizeof (struct GNUNET_CRYPTO_EcdsaSignature)); | 196 | sizeof (struct GNUNET_CRYPTO_EcdsaSignature)); |
197 | c_rec.expiration = GNUNET_htonll (cd[i].expiration.abs_value_us); | 197 | c_rec.expiration = GNUNET_htonll (cd[i].expiration.abs_value_us); |
198 | if (off + sizeof (c_rec) > dest_size) | 198 | if (off + sizeof (c_rec) > dest_size) |
@@ -225,9 +225,9 @@ GNUNET_CREDENTIAL_credentials_deserialize ( | |||
225 | size_t len, | 225 | size_t len, |
226 | const char *src, | 226 | const char *src, |
227 | unsigned int c_count, | 227 | unsigned int c_count, |
228 | struct GNUNET_CREDENTIAL_Credential *cd) | 228 | struct GNUNET_CREDENTIAL_Delegate *cd) |
229 | { | 229 | { |
230 | struct CredentialEntry c_rec; | 230 | struct DelegateEntry c_rec; |
231 | unsigned int i; | 231 | unsigned int i; |
232 | size_t off; | 232 | size_t off; |
233 | 233 | ||
@@ -247,6 +247,7 @@ GNUNET_CREDENTIAL_credentials_deserialize ( | |||
247 | return GNUNET_SYSERR; | 247 | return GNUNET_SYSERR; |
248 | cd[i].issuer_attribute = &src[off]; | 248 | cd[i].issuer_attribute = &src[off]; |
249 | off += cd[i].issuer_attribute_len; | 249 | off += cd[i].issuer_attribute_len; |
250 | cd[i].subject_attribute_len = 0; | ||
250 | } | 251 | } |
251 | return GNUNET_OK; | 252 | return GNUNET_OK; |
252 | } | 253 | } |
@@ -267,7 +268,7 @@ GNUNET_CREDENTIAL_delegation_chain_get_size ( | |||
267 | unsigned int d_count, | 268 | unsigned int d_count, |
268 | const struct GNUNET_CREDENTIAL_Delegation *dd, | 269 | const struct GNUNET_CREDENTIAL_Delegation *dd, |
269 | unsigned int c_count, | 270 | unsigned int c_count, |
270 | const struct GNUNET_CREDENTIAL_Credential *cd) | 271 | const struct GNUNET_CREDENTIAL_Delegate *cd) |
271 | { | 272 | { |
272 | unsigned int i; | 273 | unsigned int i; |
273 | size_t ret; | 274 | size_t ret; |
@@ -299,7 +300,7 @@ GNUNET_CREDENTIAL_delegation_chain_serialize ( | |||
299 | unsigned int d_count, | 300 | unsigned int d_count, |
300 | const struct GNUNET_CREDENTIAL_Delegation *dd, | 301 | const struct GNUNET_CREDENTIAL_Delegation *dd, |
301 | unsigned int c_count, | 302 | unsigned int c_count, |
302 | const struct GNUNET_CREDENTIAL_Credential *cd, | 303 | const struct GNUNET_CREDENTIAL_Delegate *cd, |
303 | size_t dest_size, | 304 | size_t dest_size, |
304 | char *dest) | 305 | char *dest) |
305 | { | 306 | { |
@@ -358,7 +359,7 @@ GNUNET_CREDENTIAL_delegation_chain_deserialize ( | |||
358 | unsigned int d_count, | 359 | unsigned int d_count, |
359 | struct GNUNET_CREDENTIAL_Delegation *dd, | 360 | struct GNUNET_CREDENTIAL_Delegation *dd, |
360 | unsigned int c_count, | 361 | unsigned int c_count, |
361 | struct GNUNET_CREDENTIAL_Credential *cd) | 362 | struct GNUNET_CREDENTIAL_Delegate *cd) |
362 | { | 363 | { |
363 | struct ChainEntry rec; | 364 | struct ChainEntry rec; |
364 | unsigned int i; | 365 | unsigned int i; |
@@ -460,8 +461,6 @@ GNUNET_CREDENTIAL_credential_deserialize (const char *data, size_t data_size) | |||
460 | return cred; | 461 | return cred; |
461 | } | 462 | } |
462 | 463 | ||
463 | //TODO own file for delegate de/serialization | ||
464 | |||
465 | int | 464 | int |
466 | GNUNET_CREDENTIAL_delegate_serialize (struct GNUNET_CREDENTIAL_Delegate *dele, | 465 | GNUNET_CREDENTIAL_delegate_serialize (struct GNUNET_CREDENTIAL_Delegate *dele, |
467 | char **data) | 466 | char **data) |