Generate a challenge buffer and return it base64-encoded. */
| 59 | |
| 60 | /* Generate a challenge buffer and return it base64-encoded. */ |
| 61 | static void gen_challenge(const char *addr, char *challenge) |
| 62 | { |
| 63 | char input[32]; |
| 64 | char digest[MAX_DIGEST_LEN]; |
| 65 | struct timeval tv; |
| 66 | int len; |
| 67 | |
| 68 | memset(input, 0, sizeof input); |
| 69 | |
| 70 | strlcpy(input, addr, 17); |
| 71 | sys_gettimeofday(&tv); |
| 72 | SIVAL(input, 16, tv.tv_sec); |
| 73 | SIVAL(input, 20, tv.tv_usec); |
| 74 | SIVAL(input, 24, getpid()); |
| 75 | |
| 76 | len = sum_init(valid_auth_checksums.negotiated_nni, 0); |
| 77 | sum_update(input, sizeof input); |
| 78 | sum_end(digest); |
| 79 | |
| 80 | base64_encode(digest, len, challenge, 0); |
| 81 | } |
| 82 | |
| 83 | /* Generate an MD4 hash created from the combination of the password |
| 84 | * and the challenge string and return it base64-encoded. */ |
no test coverage detected