Lines Matching refs:ai
292 static int mod_auth_algorithm_parse(http_auth_info_t *ai, const char *s, size_t len) { in mod_auth_algorithm_parse() argument
294 ai->dalgo = HTTP_AUTH_DIGEST_MD5; in mod_auth_algorithm_parse()
295 ai->dlen = HTTP_AUTH_DIGEST_MD5_BINLEN; in mod_auth_algorithm_parse()
305 ai->dalgo = HTTP_AUTH_DIGEST_SESS; in mod_auth_algorithm_parse()
309 ai->dalgo = HTTP_AUTH_DIGEST_NONE; in mod_auth_algorithm_parse()
316 ai->dalgo |= HTTP_AUTH_DIGEST_MD5; in mod_auth_algorithm_parse()
317 ai->dlen = HTTP_AUTH_DIGEST_MD5_BINLEN; in mod_auth_algorithm_parse()
327 ai->dalgo |= HTTP_AUTH_DIGEST_SHA256; in mod_auth_algorithm_parse()
328 ai->dlen = HTTP_AUTH_DIGEST_SHA256_BINLEN; in mod_auth_algorithm_parse()
333 ai->dalgo |= HTTP_AUTH_DIGEST_SHA512_256; in mod_auth_algorithm_parse()
334 ai->dlen = HTTP_AUTH_DIGEST_SHA512_256_BINLEN; in mod_auth_algorithm_parse()
345 http_auth_info_t ai; in mod_auth_algorithms_parse() local
347 if (!mod_auth_algorithm_parse(&ai, s, p ? (size_t)(p - s) : strlen(s))) in mod_auth_algorithms_parse()
349 *algorithm |= ai.dalgo; in mod_auth_algorithms_parse()
888 mod_auth_digest_mutate (http_auth_info_t * const ai, const http_auth_digest_params_t * const dp, co… in mod_auth_digest_mutate() argument
894 if (ai->dalgo & HTTP_AUTH_DIGEST_SHA256) in mod_auth_digest_mutate()
897 else if (ai->dalgo & HTTP_AUTH_DIGEST_SHA512_256) in mod_auth_digest_mutate()
906 li_tohex(a1, sizeof(a1), (const char *)ai->digest, ai->dlen); in mod_auth_digest_mutate()
908 if (ai->dalgo & HTTP_AUTH_DIGEST_SESS) { in mod_auth_digest_mutate()
912 iov[0].iov_len = ai->dlen*2; in mod_auth_digest_mutate()
921 digest_iov(ai->digest, iov, 5); in mod_auth_digest_mutate()
922 li_tohex(a1, sizeof(a1), (const char *)ai->digest, ai->dlen); in mod_auth_digest_mutate()
940 iov[4].iov_len = ai->dlen*2; in mod_auth_digest_mutate()
944 digest_iov(ai->digest, iov, n); in mod_auth_digest_mutate()
945 li_tohex(a2, sizeof(a2), (const char *)ai->digest, ai->dlen); in mod_auth_digest_mutate()
949 iov[0].iov_len = ai->dlen*2; in mod_auth_digest_mutate()
973 iov[n].iov_len = ai->dlen*2; in mod_auth_digest_mutate()
974 digest_iov(ai->digest, iov, n+1); in mod_auth_digest_mutate()
1121 …e_t * const require, const struct http_auth_backend_t * const backend, http_auth_info_t * const ai) in mod_auth_digest_get() argument
1131 const char *user = ai->username; in mod_auth_digest_get()
1132 const uint32_t ulen = ai->ulen; in mod_auth_digest_get()
1133 char userbuf[sizeof(ai->userbuf)]; in mod_auth_digest_get()
1134 if (ai->userhash && ulen <= sizeof(userbuf)) { in mod_auth_digest_get()
1136 const char * const restrict s = ai->username; in mod_auth_digest_get()
1146 && ae->dalgo == ai->dalgo in mod_auth_digest_get()
1147 && ae->dlen == ai->dlen in mod_auth_digest_get()
1150 && (ae->k == ae->username || ai->userhash)) { in mod_auth_digest_get()
1151 memcpy(ai->digest, ae->pwdigest, ai->dlen); in mod_auth_digest_get()
1153 if (__builtin_expect( (ae->ulen <= sizeof(ai->userbuf)), 1)) { in mod_auth_digest_get()
1154 ai->ulen = ae->ulen; in mod_auth_digest_get()
1155 ai->username = memcpy(ai->userbuf, ae->username, ae->ulen); in mod_auth_digest_get()
1164 if (ai->userhash && ulen <= sizeof(ai->userbuf)) in mod_auth_digest_get()
1165 ai->username = memcpy(ai->userbuf, userbuf, ulen); in mod_auth_digest_get()
1167 rc = backend->digest(r, backend->p_d, ai); in mod_auth_digest_get()
1184 ae = http_auth_cache_entry_init(require, ai->dalgo, user, ulen, in mod_auth_digest_get()
1185 ai->username, ai->ulen, in mod_auth_digest_get()
1186 (char *)ai->digest, ai->dlen); in mod_auth_digest_get()
1283 …_userstar (request_st * const r, http_auth_digest_params_t * const dp, http_auth_info_t * const ai) in mod_auth_digest_validate_userstar() argument
1326 if (len > sizeof(ai->userbuf)) { in mod_auth_digest_validate_userstar()
1341 ai->ulen = len; in mod_auth_digest_validate_userstar()
1342 ai->username = memcpy(ai->userbuf, tb->ptr, len); in mod_auth_digest_validate_userstar()
1348 …_auth_require_t * const require, http_auth_digest_params_t * const dp, http_auth_info_t * const ai) in mod_auth_digest_validate_params() argument
1357 ai->username = dp->ptr[e_username]; in mod_auth_digest_validate_params()
1358 ai->ulen = dp->len[e_username]; in mod_auth_digest_validate_params()
1359 ai->realm = dp->ptr[e_realm]; in mod_auth_digest_validate_params()
1360 ai->rlen = dp->len[e_realm]; in mod_auth_digest_validate_params()
1361 ai->userhash = (dp->len[e_userhash]==4);/*("true", not "false",absent)*/ in mod_auth_digest_validate_params()
1362 if (!ai->username) { /* (dp->ptr[e_userstar]) */ in mod_auth_digest_validate_params()
1363 if (HANDLER_GO_ON != mod_auth_digest_validate_userstar(r, dp, ai)) in mod_auth_digest_validate_params()
1373 if (!buffer_eq_slen(require->realm, ai->realm, ai->rlen)) { in mod_auth_digest_validate_params()
1379 if (!mod_auth_algorithm_parse(ai,dp->ptr[e_algorithm],dp->len[e_algorithm]) in mod_auth_digest_validate_params()
1380 || !(require->algorithm & ai->dalgo & ~HTTP_AUTH_DIGEST_SESS)) { in mod_auth_digest_validate_params()
1388 if ((ai->dalgo & HTTP_AUTH_DIGEST_SESS) in mod_auth_digest_validate_params()
1398 || dp->len[e_response] != (ai->dlen << 1)) { in mod_auth_digest_validate_params()
1432 …_auth_require_t * const require, http_auth_digest_params_t * const dp, http_auth_info_t * const ai) in mod_auth_digest_validate_nonce() argument
1459 return mod_auth_send_401_unauthorized_digest(r, require, ai->dalgo); in mod_auth_digest_validate_nonce()
1479 mod_auth_append_nonce(tb, cur_ts, require, ai->dalgo, (int *)&rnd); in mod_auth_digest_validate_nonce()
1509 http_auth_info_t ai; in mod_auth_check_digest() local
1517 rc = mod_auth_digest_validate_params(r, require, &dp, &ai); in mod_auth_check_digest()
1521 rc = mod_auth_digest_validate_nonce(r, require, &dp, &ai); in mod_auth_check_digest()
1525 rc = mod_auth_digest_get(r, p_d, require, backend, &ai); in mod_auth_check_digest()
1529 mod_auth_digest_mutate(&ai, &dp, http_method_buf(r->http_method)); in mod_auth_check_digest()
1531 if (!ck_memeq_const_time_fixed_len(dp.rdigest, ai.digest, ai.dlen)) { in mod_auth_check_digest()
1536 (int)ai.ulen, ai.username, r->dst_addr_buf->ptr); in mod_auth_check_digest()
1544 buffer_copy_string_len(tb, ai.username, ai.ulen); in mod_auth_check_digest()
1553 dp.send_nextnonce_ts /*(cur_ts)*/, require, ai.dalgo); in mod_auth_check_digest()
1556 http_auth_setenv(r, ai.username, ai.ulen, CONST_STR_LEN("Digest")); in mod_auth_check_digest()