iPXE
chap.h
Go to the documentation of this file.
1#ifndef _IPXE_CHAP_H
2#define _IPXE_CHAP_H
3
4/** @file
5 *
6 * CHAP protocol
7 *
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11FILE_SECBOOT ( PERMITTED );
12
13#include <stdint.h>
14#include <ipxe/md5.h>
15
16struct digest_algorithm;
17
18/** A CHAP response */
20 /** Digest algorithm used for the response */
22 /** Context used by the digest algorithm */
24 /** CHAP response */
26 /** Length of CHAP response */
28};
29
30extern int chap_init ( struct chap_response *chap,
31 struct digest_algorithm *digest );
32extern void chap_update ( struct chap_response *chap, const void *data,
33 size_t len );
34extern void chap_respond ( struct chap_response *chap );
35extern void chap_finish ( struct chap_response *chap );
36
37/**
38 * Add identifier data to the CHAP challenge
39 *
40 * @v chap CHAP response
41 * @v identifier CHAP identifier
42 *
43 * The CHAP identifier is the first byte of the CHAP challenge. This
44 * function is a notational convenience for calling chap_update() for
45 * the identifier byte.
46 */
47static inline void chap_set_identifier ( struct chap_response *chap,
48 unsigned int identifier ) {
49 uint8_t ident_byte = identifier;
50
51 chap_update ( chap, &ident_byte, sizeof ( ident_byte ) );
52}
53
54#endif /* _IPXE_CHAP_H */
unsigned char uint8_t
Definition stdint.h:10
void chap_respond(struct chap_response *chap)
Respond to the CHAP challenge.
Definition chap.c:105
static void chap_set_identifier(struct chap_response *chap, unsigned int identifier)
Add identifier data to the CHAP challenge.
Definition chap.h:47
void chap_update(struct chap_response *chap, const void *data, size_t len)
Add data to the CHAP challenge.
Definition chap.c:86
void chap_finish(struct chap_response *chap)
Free resources used by a CHAP response.
Definition chap.c:123
int chap_init(struct chap_response *chap, struct digest_algorithm *digest)
Initialise CHAP challenge/response.
Definition chap.c:52
ring len
Length.
Definition dwmac.h:226
uint8_t data[48]
Additional event data.
Definition ena.h:11
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
Definition compiler.h:926
MD5 algorithm.
A CHAP response.
Definition chap.h:19
uint8_t * digest_context
Context used by the digest algorithm.
Definition chap.h:23
uint8_t * response
CHAP response.
Definition chap.h:25
struct digest_algorithm * digest
Digest algorithm used for the response.
Definition chap.h:21
size_t response_len
Length of CHAP response.
Definition chap.h:27
A message digest algorithm.
Definition crypto.h:19