Lines Matching defs:chap
32 __FBSDID("$FreeBSD: releng/10.2/usr.sbin/ctld/chap.c 274909 2014-11-23 04:17:39Z mav $");
234 struct chap *
237 struct chap *chap;
240 chap = calloc(sizeof(*chap), 1);
241 if (chap == NULL)
247 rv = RAND_bytes(chap->chap_challenge, sizeof(chap->chap_challenge));
252 rv = RAND_bytes(&chap->chap_id, sizeof(chap->chap_id));
258 return (chap);
262 chap_get_id(const struct chap *chap)
267 ret = asprintf(&chap_i, "%d", chap->chap_id);
275 chap_get_challenge(const struct chap *chap)
279 chap_c = chap_bin2hex(chap->chap_challenge,
280 sizeof(chap->chap_challenge));
286 chap_receive_bin(struct chap *chap, void *response, size_t response_len)
289 if (response_len != sizeof(chap->chap_response)) {
292 response_len, sizeof(chap->chap_response));
296 memcpy(chap->chap_response, response, response_len);
301 chap_receive(struct chap *chap, const char *response)
314 error = chap_receive_bin(chap, response_bin, response_bin_len);
321 chap_authenticate(struct chap *chap, const char *secret)
325 chap_compute_md5(chap->chap_id, secret,
326 chap->chap_challenge, sizeof(chap->chap_challenge),
329 if (memcmp(chap->chap_response,
338 chap_delete(struct chap *chap)
341 free(chap);