MCPcopy Index your code
hub / github.com/RsyncProject/rsync / gen_challenge

Function gen_challenge

authenticate.c:61–81  ·  view source on GitHub ↗

Generate a challenge buffer and return it base64-encoded. */

Source from the content-addressed store, hash-verified

59
60/* Generate a challenge buffer and return it base64-encoded. */
61static 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. */

Callers 1

auth_serverFunction · 0.85

Calls 7

strlcpyFunction · 0.85
sys_gettimeofdayFunction · 0.85
SIVALFunction · 0.85
sum_initFunction · 0.85
sum_updateFunction · 0.85
sum_endFunction · 0.85
base64_encodeFunction · 0.85

Tested by

no test coverage detected