diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2019-09-05 07:50:10 +0200 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2019-09-05 07:50:10 +0200 |
commit | d9a37dee7a3f425b0846a8dd1b6089dc7f27d723 (patch) | |
tree | 499249a3c3ed5fbd323331aae65071a25fbfbb29 /src/reclaim | |
parent | 0b408bd2ced465a24ba16a0f267dfcda63cb842a (diff) | |
download | gnunet-d9a37dee7a3f425b0846a8dd1b6089dc7f27d723.tar.gz gnunet-d9a37dee7a3f425b0846a8dd1b6089dc7f27d723.zip |
fix signature check
Diffstat (limited to 'src/reclaim')
-rw-r--r-- | src/reclaim/oidc_helper.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/reclaim/oidc_helper.c b/src/reclaim/oidc_helper.c index 2750ef1ca..cbf0d1a1d 100644 --- a/src/reclaim/oidc_helper.c +++ b/src/reclaim/oidc_helper.c | |||
@@ -632,6 +632,8 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *ecdsa_priv, | |||
632 | plaintext = GNUNET_malloc (plaintext_len); | 632 | plaintext = GNUNET_malloc (plaintext_len); |
633 | decrypt_payload (ecdsa_priv, ecdh_pub, ptr, plaintext_len, plaintext); | 633 | decrypt_payload (ecdsa_priv, ecdh_pub, ptr, plaintext_len, plaintext); |
634 | //ptr = plaintext; | 634 | //ptr = plaintext; |
635 | ptr += plaintext_len; | ||
636 | signature = (struct GNUNET_CRYPTO_EcdsaSignature*) ptr; | ||
635 | params = (struct OIDC_Parameters *) plaintext; | 637 | params = (struct OIDC_Parameters *) plaintext; |
636 | 638 | ||
637 | // cmp code_challenge code_verifier | 639 | // cmp code_challenge code_verifier |
@@ -665,17 +667,10 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *ecdsa_priv, | |||
665 | // Nonce | 667 | // Nonce |
666 | nonce = ntohl (params->nonce); //ntohl (*((uint32_t *) ptr)); | 668 | nonce = ntohl (params->nonce); //ntohl (*((uint32_t *) ptr)); |
667 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got nonce: %u\n", nonce); | 669 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got nonce: %u\n", nonce); |
668 | // Attributes | ||
669 | attrs_ser = ((char *) ¶ms[1]) + code_challenge_len; | ||
670 | attrs_ser_len = ntohl (params->attr_list_len); | ||
671 | *attrs = GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (attrs_ser, attrs_ser_len); | ||
672 | // Signature | 670 | // Signature |
673 | signature = | ||
674 | (struct GNUNET_CRYPTO_EcdsaSignature *) (attrs_ser + attrs_ser_len); | ||
675 | GNUNET_CRYPTO_ecdsa_key_get_public (ecdsa_priv, &ecdsa_pub); | 671 | GNUNET_CRYPTO_ecdsa_key_get_public (ecdsa_priv, &ecdsa_pub); |
676 | if (0 != GNUNET_memcmp (&ecdsa_pub, &ticket->audience)) | 672 | if (0 != GNUNET_memcmp (&ecdsa_pub, &ticket->audience)) |
677 | { | 673 | { |
678 | GNUNET_RECLAIM_ATTRIBUTE_list_destroy (*attrs); | ||
679 | GNUNET_free (code_payload); | 674 | GNUNET_free (code_payload); |
680 | GNUNET_free (plaintext); | 675 | GNUNET_free (plaintext); |
681 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 676 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -688,12 +683,16 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *ecdsa_priv, | |||
688 | signature, | 683 | signature, |
689 | &ticket->identity)) | 684 | &ticket->identity)) |
690 | { | 685 | { |
691 | GNUNET_RECLAIM_ATTRIBUTE_list_destroy (*attrs); | ||
692 | GNUNET_free (code_payload); | 686 | GNUNET_free (code_payload); |
693 | GNUNET_free (plaintext); | 687 | GNUNET_free (plaintext); |
694 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Signature of AuthZ code invalid!\n"); | 688 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Signature of AuthZ code invalid!\n"); |
695 | return GNUNET_SYSERR; | 689 | return GNUNET_SYSERR; |
696 | } | 690 | } |
691 | // Attributes | ||
692 | attrs_ser = ((char *) ¶ms[1]) + code_challenge_len; | ||
693 | attrs_ser_len = ntohl (params->attr_list_len); | ||
694 | *attrs = GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (attrs_ser, attrs_ser_len); | ||
695 | |||
697 | *nonce_str = NULL; | 696 | *nonce_str = NULL; |
698 | if (nonce != 0) | 697 | if (nonce != 0) |
699 | GNUNET_asprintf (nonce_str, "%u", nonce); | 698 | GNUNET_asprintf (nonce_str, "%u", nonce); |