6 * Copyright (c) 2012, JANET(UK)
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of JANET(UK) nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
25 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
26 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
28 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
31 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 #include <freeradius-devel/ident.h>
41 RCSIDH(eap_chbind_h, "$Id$")
45 #include <sys/types.h>
48 #include <freeradius-devel/radiusd.h>
52 /* Structure to hold channel bindings req/resp information */
53 typedef struct CHBIND_REQ {
54 uint8_t *username; /* the username */
55 size_t username_len; /* length of the username */
56 uint8_t *chbind_req_pkt; /* channel binding request buffer */
57 size_t chbind_req_len; /* length of the request buffer */
58 uint8_t *chbind_resp; /* channel binding response buffer */
59 size_t chbind_resp_len; /* length of the response buffer */
62 /* Structure to represent eap channel binding packet format */
63 typedef struct chbind_packet_t {
68 /* Protocol constants */
69 #define CHBIND_NSID_RADIUS 1
71 #define CHBIND_CODE_REQUEST 1
72 #define CHBIND_CODE_SUCCESS 2
73 #define CHBIND_CODE_FAILURE 3
75 /* Channel binding function prototypes */
76 CHBIND_REQ *chbind_allocate(void);
77 void chbind_free(CHBIND_REQ *chbind);
78 int chbind_process(REQUEST *req, CHBIND_REQ *chbind_req);
79 size_t chbind_get_data(CHBIND_PACKET_T *chbind_packet, size_t chbind_packet_len, int desired_nsid, uint8_t **radbuf_data);
80 uint8_t *chbind_build_response(REQUEST *req, size_t *resp_len);
82 #endif /*_EAP_CHBIND_H*/