10 FILE_LICENCE ( GPL2_OR_LATER );
15 struct digest_algorithm;
17 /** A CHAP response */
18 struct chap_response {
19 /** Digest algorithm used for the response */
20 struct digest_algorithm *digest;
21 /** Context used by the digest algorithm */
22 uint8_t *digest_context;
25 /** Length of CHAP response */
29 extern int chap_init ( struct chap_response *chap,
30 struct digest_algorithm *digest );
31 extern void chap_update ( struct chap_response *chap, const void *data,
33 extern void chap_respond ( struct chap_response *chap );
34 extern void chap_finish ( struct chap_response *chap );
37 * Add identifier data to the CHAP challenge
39 * @v chap CHAP response
40 * @v identifier CHAP identifier
42 * The CHAP identifier is the first byte of the CHAP challenge. This
43 * function is a notational convenience for calling chap_update() for
44 * the identifier byte.
46 static inline void chap_set_identifier ( struct chap_response *chap,
47 unsigned int identifier ) {
48 uint8_t ident_byte = identifier;
50 chap_update ( chap, &ident_byte, sizeof ( ident_byte ) );
53 #endif /* _IPXE_CHAP_H */