X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Freclaim%2Foidc_helper.c;h=1c3d65f3569494d58165e8e9ec5651fd4d73cbef;hb=7e3cf5f461eb4fbb7581672bf0835da07c378136;hp=6bcae21d420a87bf6fc3640aaea1c5168d58ebe7;hpb=01b480d6d026e0c537dc284a7e7df2c0320a3528;p=oweals%2Fgnunet.git diff --git a/src/reclaim/oidc_helper.c b/src/reclaim/oidc_helper.c index 6bcae21d4..1c3d65f35 100644 --- a/src/reclaim/oidc_helper.c +++ b/src/reclaim/oidc_helper.c @@ -79,6 +79,7 @@ create_jwt_header (void) return json_str; } + static void replace_char (char *str, char find, char replace) { @@ -91,6 +92,7 @@ replace_char (char *str, char find, char replace) } } + // RFC4648 static void fix_base64 (char *str) @@ -102,6 +104,7 @@ fix_base64 (char *str) replace_char (str, '/', '_'); } + /** * Create a JWT from attributes * @@ -229,6 +232,7 @@ OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key, return result; } + /* Converts a hex character to its integer value */ static char from_hex (char ch) @@ -236,6 +240,7 @@ from_hex (char ch) return isdigit (ch) ? ch - '0' : tolower (ch) - 'a' + 10; } + /* Converts an integer value to its hex character*/ static char to_hex (char code) @@ -245,6 +250,7 @@ to_hex (char code) return hex[code & 15]; } + /* Returns a url-encoded version of str */ /* IMPORTANT: be sure to free() the returned string after use */ static char * @@ -307,6 +313,7 @@ url_decode (const char *str) return buf; } + /** * Returns base64 encoded string urlencoded * @@ -440,6 +447,7 @@ encrypt_payload (const struct GNUNET_CRYPTO_EcdsaPublicKey *ecdsa_pub, GNUNET_CRYPTO_symmetric_encrypt (payload, payload_len, &key, &iv, buf)); } + /** * Builds an OIDC authorization code including * a reclaim ticket and nonce @@ -481,7 +489,7 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, // Assign nonce nonce = 0; payload_len = sizeof(struct OIDC_Parameters); - if ((NULL != nonce_str)&& (strcmp ("", nonce_str) != 0)) + if ((NULL != nonce_str) && (strcmp ("", nonce_str) != 0)) { if ((1 != sscanf (nonce_str, "%u", &nonce)) || (nonce > UINT32_MAX)) { @@ -753,6 +761,7 @@ OIDC_build_token_response (const char *access_token, json_decref (root_json); } + /** * Generate a new access token */