diff options
Diffstat (limited to 'src/reclaim/oidc_helper.c')
-rw-r--r-- | src/reclaim/oidc_helper.c | 11 |
1 files changed, 10 insertions, 1 deletions
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) | |||
79 | return json_str; | 79 | return json_str; |
80 | } | 80 | } |
81 | 81 | ||
82 | |||
82 | static void | 83 | static void |
83 | replace_char (char *str, char find, char replace) | 84 | replace_char (char *str, char find, char replace) |
84 | { | 85 | { |
@@ -91,6 +92,7 @@ replace_char (char *str, char find, char replace) | |||
91 | } | 92 | } |
92 | } | 93 | } |
93 | 94 | ||
95 | |||
94 | // RFC4648 | 96 | // RFC4648 |
95 | static void | 97 | static void |
96 | fix_base64 (char *str) | 98 | fix_base64 (char *str) |
@@ -102,6 +104,7 @@ fix_base64 (char *str) | |||
102 | replace_char (str, '/', '_'); | 104 | replace_char (str, '/', '_'); |
103 | } | 105 | } |
104 | 106 | ||
107 | |||
105 | /** | 108 | /** |
106 | * Create a JWT from attributes | 109 | * Create a JWT from attributes |
107 | * | 110 | * |
@@ -229,6 +232,7 @@ OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key, | |||
229 | return result; | 232 | return result; |
230 | } | 233 | } |
231 | 234 | ||
235 | |||
232 | /* Converts a hex character to its integer value */ | 236 | /* Converts a hex character to its integer value */ |
233 | static char | 237 | static char |
234 | from_hex (char ch) | 238 | from_hex (char ch) |
@@ -236,6 +240,7 @@ from_hex (char ch) | |||
236 | return isdigit (ch) ? ch - '0' : tolower (ch) - 'a' + 10; | 240 | return isdigit (ch) ? ch - '0' : tolower (ch) - 'a' + 10; |
237 | } | 241 | } |
238 | 242 | ||
243 | |||
239 | /* Converts an integer value to its hex character*/ | 244 | /* Converts an integer value to its hex character*/ |
240 | static char | 245 | static char |
241 | to_hex (char code) | 246 | to_hex (char code) |
@@ -245,6 +250,7 @@ to_hex (char code) | |||
245 | return hex[code & 15]; | 250 | return hex[code & 15]; |
246 | } | 251 | } |
247 | 252 | ||
253 | |||
248 | /* Returns a url-encoded version of str */ | 254 | /* Returns a url-encoded version of str */ |
249 | /* IMPORTANT: be sure to free() the returned string after use */ | 255 | /* IMPORTANT: be sure to free() the returned string after use */ |
250 | static char * | 256 | static char * |
@@ -307,6 +313,7 @@ url_decode (const char *str) | |||
307 | return buf; | 313 | return buf; |
308 | } | 314 | } |
309 | 315 | ||
316 | |||
310 | /** | 317 | /** |
311 | * Returns base64 encoded string urlencoded | 318 | * Returns base64 encoded string urlencoded |
312 | * | 319 | * |
@@ -440,6 +447,7 @@ encrypt_payload (const struct GNUNET_CRYPTO_EcdsaPublicKey *ecdsa_pub, | |||
440 | GNUNET_CRYPTO_symmetric_encrypt (payload, payload_len, &key, &iv, buf)); | 447 | GNUNET_CRYPTO_symmetric_encrypt (payload, payload_len, &key, &iv, buf)); |
441 | } | 448 | } |
442 | 449 | ||
450 | |||
443 | /** | 451 | /** |
444 | * Builds an OIDC authorization code including | 452 | * Builds an OIDC authorization code including |
445 | * a reclaim ticket and nonce | 453 | * a reclaim ticket and nonce |
@@ -481,7 +489,7 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, | |||
481 | // Assign nonce | 489 | // Assign nonce |
482 | nonce = 0; | 490 | nonce = 0; |
483 | payload_len = sizeof(struct OIDC_Parameters); | 491 | payload_len = sizeof(struct OIDC_Parameters); |
484 | if ((NULL != nonce_str)&& (strcmp ("", nonce_str) != 0)) | 492 | if ((NULL != nonce_str) && (strcmp ("", nonce_str) != 0)) |
485 | { | 493 | { |
486 | if ((1 != sscanf (nonce_str, "%u", &nonce)) || (nonce > UINT32_MAX)) | 494 | if ((1 != sscanf (nonce_str, "%u", &nonce)) || (nonce > UINT32_MAX)) |
487 | { | 495 | { |
@@ -753,6 +761,7 @@ OIDC_build_token_response (const char *access_token, | |||
753 | json_decref (root_json); | 761 | json_decref (root_json); |
754 | } | 762 | } |
755 | 763 | ||
764 | |||
756 | /** | 765 | /** |
757 | * Generate a new access token | 766 | * Generate a new access token |
758 | */ | 767 | */ |