MCPcopy Create free account
hub / github.com/apache/httpd / gen_nonce_hash

Function gen_nonce_hash

modules/aaa/mod_auth_digest.c:1083–1105  ·  view source on GitHub ↗

Writes the hash part of the server nonce to hash, which must be of * minimum size (NONCE_HASH_LEN+1). */

Source from the content-addressed store, hash-verified

1081/* Writes the hash part of the server nonce to hash, which must be of
1082 * minimum size (NONCE_HASH_LEN+1). */
1083static void gen_nonce_hash(char hash[NONCE_HASH_LEN+1], const char *timestr, const char *opaque,
1084 const server_rec *server,
1085 const digest_config_rec *conf)
1086{
1087 unsigned char sha1[APR_SHA1_DIGESTSIZE];
1088 apr_sha1_ctx_t ctx;
1089
1090 memcpy(&ctx, &conf->nonce_ctx, sizeof(ctx));
1091 /*
1092 apr_sha1_update_binary(&ctx, (const unsigned char *) server->server_hostname,
1093 strlen(server->server_hostname));
1094 apr_sha1_update_binary(&ctx, (const unsigned char *) &server->port,
1095 sizeof(server->port));
1096 */
1097 apr_sha1_update_binary(&ctx, (const unsigned char *) timestr, strlen(timestr));
1098 if (opaque) {
1099 apr_sha1_update_binary(&ctx, (const unsigned char *) opaque,
1100 strlen(opaque));
1101 }
1102 apr_sha1_final(sha1, &ctx);
1103
1104 ap_bin2hex(sha1, APR_SHA1_DIGESTSIZE, hash);
1105}
1106
1107
1108/* The nonce has the format b64(time)+hash .

Callers 2

gen_nonceFunction · 0.85
check_nonceFunction · 0.85

Calls 1

ap_bin2hexFunction · 0.85

Tested by

no test coverage detected