diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2019-04-27 10:16:11 +0200 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2019-04-27 10:16:11 +0200 |
commit | f0688c57bf1f85bbb71d166b33317db0bd565008 (patch) | |
tree | aa73db7c9285c5e958ef9cc473e8da5d330f0928 /src | |
parent | 4fca11423e6fd34032848a1b8684b3c06197e6e5 (diff) | |
download | gnunet-f0688c57bf1f85bbb71d166b33317db0bd565008.tar.gz gnunet-f0688c57bf1f85bbb71d166b33317db0bd565008.zip |
RECLAIM/OIDC: fix nonce size
Diffstat (limited to 'src')
-rw-r--r-- | src/reclaim/oidc_helper.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/reclaim/oidc_helper.c b/src/reclaim/oidc_helper.c index f0691796b..fb0fb2e08 100644 --- a/src/reclaim/oidc_helper.c +++ b/src/reclaim/oidc_helper.c | |||
@@ -315,13 +315,13 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, | |||
315 | size_t signature_payload_len; | 315 | size_t signature_payload_len; |
316 | size_t attr_list_len; | 316 | size_t attr_list_len; |
317 | size_t code_payload_len; | 317 | size_t code_payload_len; |
318 | unsigned int nonce; | 318 | uint32_t nonce; |
319 | unsigned int nonce_tmp; | 319 | uint32_t nonce_tmp; |
320 | struct GNUNET_CRYPTO_EccSignaturePurpose *purpose; | 320 | struct GNUNET_CRYPTO_EccSignaturePurpose *purpose; |
321 | 321 | ||
322 | attrs_ser = NULL; | 322 | attrs_ser = NULL; |
323 | signature_payload_len = | 323 | signature_payload_len = |
324 | sizeof (struct GNUNET_RECLAIM_Ticket) + sizeof (unsigned int); | 324 | sizeof (struct GNUNET_RECLAIM_Ticket) + sizeof (uint32_t); |
325 | if (NULL != attrs) | 325 | if (NULL != attrs) |
326 | { | 326 | { |
327 | attr_list_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (attrs); | 327 | attr_list_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (attrs); |
@@ -361,9 +361,9 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, | |||
361 | return NULL; | 361 | return NULL; |
362 | } | 362 | } |
363 | } | 363 | } |
364 | nonce_tmp = htons (nonce); | 364 | nonce_tmp = htonl (nonce); |
365 | memcpy (buf_ptr, &nonce_tmp, sizeof (unsigned int)); | 365 | memcpy (buf_ptr, &nonce_tmp, sizeof (uint32_t)); |
366 | buf_ptr += sizeof (unsigned int); | 366 | buf_ptr += sizeof (uint32_t); |
367 | // Finally, attributes | 367 | // Finally, attributes |
368 | if (NULL != attrs_ser) | 368 | if (NULL != attrs_ser) |
369 | { | 369 | { |
@@ -415,7 +415,7 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPublicKey *audience, | |||
415 | size_t code_payload_len; | 415 | size_t code_payload_len; |
416 | size_t attrs_ser_len; | 416 | size_t attrs_ser_len; |
417 | size_t signature_offset; | 417 | size_t signature_offset; |
418 | unsigned int nonce; | 418 | uint32_t nonce; |
419 | 419 | ||
420 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Trying to decode `%s'", code); | 420 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Trying to decode `%s'", code); |
421 | code_payload = NULL; | 421 | code_payload = NULL; |
@@ -424,7 +424,7 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPublicKey *audience, | |||
424 | 424 | ||
425 | if (code_payload_len < sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + | 425 | if (code_payload_len < sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + |
426 | sizeof (struct GNUNET_RECLAIM_Ticket) + | 426 | sizeof (struct GNUNET_RECLAIM_Ticket) + |
427 | sizeof (unsigned int) + | 427 | sizeof (uint32_t) + |
428 | sizeof (struct GNUNET_CRYPTO_EcdsaSignature)) | 428 | sizeof (struct GNUNET_CRYPTO_EcdsaSignature)) |
429 | { | 429 | { |
430 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Authorization code malformed\n"); | 430 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Authorization code malformed\n"); |
@@ -439,9 +439,9 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPublicKey *audience, | |||
439 | *ticket = *((struct GNUNET_RECLAIM_Ticket *) ptr); | 439 | *ticket = *((struct GNUNET_RECLAIM_Ticket *) ptr); |
440 | attrs_ser_len -= sizeof (struct GNUNET_RECLAIM_Ticket); | 440 | attrs_ser_len -= sizeof (struct GNUNET_RECLAIM_Ticket); |
441 | ptr += sizeof (struct GNUNET_RECLAIM_Ticket); | 441 | ptr += sizeof (struct GNUNET_RECLAIM_Ticket); |
442 | nonce = ntohs (*((unsigned int *) ptr)); | 442 | nonce = ntohl (*((uint32_t *) ptr)); |
443 | attrs_ser_len -= sizeof (unsigned int); | 443 | attrs_ser_len -= sizeof (uint32_t); |
444 | ptr += sizeof (unsigned int); | 444 | ptr += sizeof (uint32_t); |
445 | attrs_ser_len -= sizeof (struct GNUNET_CRYPTO_EcdsaSignature); | 445 | attrs_ser_len -= sizeof (struct GNUNET_CRYPTO_EcdsaSignature); |
446 | *attrs = GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (ptr, attrs_ser_len); | 446 | *attrs = GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (ptr, attrs_ser_len); |
447 | signature_offset = | 447 | signature_offset = |