Writes the hash part of the server nonce to hash, which must be of * minimum size (NONCE_HASH_LEN+1). */
| 1081 | /* Writes the hash part of the server nonce to hash, which must be of |
| 1082 | * minimum size (NONCE_HASH_LEN+1). */ |
| 1083 | static 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 . |
no test coverage detected