6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 * Copyright 2001 hereUare Communications, Inc. <raghud@hereuare.com>
21 * Copyright 2003 Alan DeKok <aland@freeradius.org>
26 * TLS Packet Format in EAP
27 * --- ------ ------ -- ---
29 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
30 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
31 * | Code | Identifier | Length |
32 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
33 * | Type | Flags | TLS Message Length
34 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
35 * | TLS Message Length | TLS Data...
36 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
40 #include <freeradius-devel/autoconf.h>
45 * Allocate a new TLS_PACKET
47 EAPTLS_PACKET *eaptls_alloc(void)
51 if ((rp = malloc(sizeof(EAPTLS_PACKET))) == NULL) {
52 radlog(L_ERR, "rlm_eap_tls: out of memory");
55 memset(rp, 0, sizeof(EAPTLS_PACKET));
62 void eaptls_free(EAPTLS_PACKET **eaptls_packet_ptr)
64 EAPTLS_PACKET *eaptls_packet;
66 if (!eaptls_packet_ptr) return;
67 eaptls_packet = *eaptls_packet_ptr;
68 if (eaptls_packet == NULL) return;
70 if (eaptls_packet->data) {
71 free(eaptls_packet->data);
72 eaptls_packet->data = NULL;
76 *eaptls_packet_ptr = NULL;
80 The S flag is set only within the EAP-TLS start message
81 sent from the EAP server to the peer.
83 int eaptls_start(EAP_DS *eap_ds, int peap_flag)
87 reply.code = EAPTLS_START;
88 reply.length = TLS_HEADER_LEN + 1/*flags*/;
90 reply.flags = peap_flag;
91 reply.flags = SET_START(reply.flags);
96 eaptls_compose(eap_ds, &reply);
101 int eaptls_success(EAP_DS *eap_ds, int peap_flag)
105 reply.code = EAPTLS_SUCCESS;
106 reply.length = TLS_HEADER_LEN;
107 reply.flags = peap_flag;
111 eaptls_compose(eap_ds, &reply);
116 int eaptls_fail(EAP_DS *eap_ds, int peap_flag)
120 reply.code = EAPTLS_FAIL;
121 reply.length = TLS_HEADER_LEN;
122 reply.flags = peap_flag;
126 eaptls_compose(eap_ds, &reply);
132 A single TLS record may be up to 16384 octets in length, but a TLS
133 message may span multiple TLS records, and a TLS certificate message
134 may in principle be as long as 16MB.
138 * Frame the Dirty data that needs to be send to the client in an
139 * EAP-Request. We always embed the TLS-length in all EAP-TLS
140 * packets that we send, for easy reference purpose. Handle
141 * fragmentation and sending the next fragment etc.
143 int eaptls_request(EAP_DS *eap_ds, tls_session_t *ssn)
148 unsigned int lbit = 0;
150 /* This value determines whether we set (L)ength flag for
151 EVERY packet we send and add corresponding
152 "TLS Message Length" field.
155 This means we include L flag and "TLS Msg Len" in EVERY
159 This means we include L flag and "TLS Msg Len" **ONLY**
160 in First packet of a fragment series. We do not use
163 Having L flag in every packet is prefered.
166 if (ssn->length_flag) {
169 if (ssn->fragment == 0) {
170 ssn->tls_msg_len = ssn->dirty_out.used;
173 reply.code = EAPTLS_REQUEST;
174 reply.flags = ssn->peap_flag;
176 /* Send data, NOT more than the FRAGMENT size */
177 if (ssn->dirty_out.used > ssn->offset) {
179 reply.flags = SET_MORE_FRAGMENTS(reply.flags);
180 /* Length MUST be included if it is the First Fragment */
181 if (ssn->fragment == 0) {
186 size = ssn->dirty_out.used;
190 reply.dlen = lbit + size;
191 reply.length = TLS_HEADER_LEN + 1/*flags*/ + reply.dlen;
193 reply.data = malloc(reply.dlen);
195 nlen = htonl(ssn->tls_msg_len);
196 memcpy(reply.data, &nlen, lbit);
197 reply.flags = SET_LENGTH_INCLUDED(reply.flags);
199 (ssn->record_minus)(&ssn->dirty_out, reply.data + lbit, size);
201 eaptls_compose(eap_ds, &reply);
209 * Acknowledge received is for one of the following messages sent earlier
210 * 1. Handshake completed Message, so now send, EAP-Success
211 * 2. Alert Message, now send, EAP-Failure
212 * 3. Fragment Message, now send, next Fragment
214 static eaptls_status_t eaptls_ack_handler(EAP_HANDLER *handler)
216 tls_session_t *tls_session;
218 tls_session = (tls_session_t *)handler->opaque;
219 if (tls_session == NULL){
220 radlog(L_ERR, "rlm_eap_tls: Unexpected ACK received");
223 if (tls_session->info.initialized == 0) {
224 DEBUG(" rlm_eap_tls: No SSL info available. Waiting for more SSL data.");
225 return EAPTLS_REQUEST;
227 if (tls_session->info.origin == 0) {
228 radlog(L_ERR, "rlm_eap_tls: Unexpected ACK received");
232 switch (tls_session->info.content_type) {
234 DEBUG2(" rlm_eap_tls: ack alert");
235 eaptls_fail(handler->eap_ds, tls_session->peap_flag);
239 if (tls_session->info.handshake_type == finished) {
240 DEBUG2(" rlm_eap_tls: ack handshake is finished");
241 return EAPTLS_SUCCESS;
244 DEBUG2(" rlm_eap_tls: ack handshake fragment handler");
245 /* Fragmentation handler, send next fragment */
246 return EAPTLS_REQUEST;
249 * For the rest of the conditions, switch over
250 * to the default section below.
253 DEBUG2(" rlm_eap_tls: ack default");
254 radlog(L_ERR, "rlm_eap_tls: Invalid ACK received: %d",
255 tls_session->info.content_type);
261 * Similarly, when the EAP server receives an EAP-Response with
262 * the M bit set, it MUST respond with an EAP-Request with
263 * EAP-Type=EAP-TLS and no data. This serves as a fragment ACK.
265 * In order to prevent errors in the processing of fragments, the
266 * EAP server MUST use increment the Identifier value for each
267 * fragment ACK contained within an EAP-Request, and the peer
268 * MUST include this Identifier value in the subsequent fragment
269 * contained within an EAP- Reponse.
271 * EAP server sends an ACK when it determines there are More
272 * fragments to receive to make the complete
273 * TLS-record/TLS-Message
275 static int eaptls_send_ack(EAP_DS *eap_ds, int peap_flag)
279 reply.code = EAPTLS_ACK;
280 reply.length = TLS_HEADER_LEN + 1/*flags*/;
281 reply.flags = peap_flag;
285 eaptls_compose(eap_ds, &reply);
291 * The S flag is set only within the EAP-TLS start message sent
292 * from the EAP server to the peer.
294 * Similarly, when the EAP server receives an EAP-Response with
295 * the M bit set, it MUST respond with an EAP-Request with
296 * EAP-Type=EAP-TLS and no data. This serves as a fragment
297 * ACK. The EAP peer MUST wait.
299 static eaptls_status_t eaptls_verify(EAP_HANDLER *handler)
301 EAP_DS *eap_ds = handler->eap_ds;
302 EAP_DS *prev_eap_ds = handler->prev_eapds;
303 eaptls_packet_t *eaptls_packet, *eaptls_prev = NULL;
306 * We don't check ANY of the input parameters. It's all
307 * code which works together, so if something is wrong,
308 * we SHOULD core dump.
310 * e.g. if eap_ds is NULL, of if eap_ds->response is
311 * NULL, of if it's NOT an EAP-Response, or if the packet
312 * is too short. See eap_validation()., in ../../eap.c
314 * Also, eaptype_select() takes care of selecting the
315 * appropriate type, so we don't need to check
316 * eap_ds->response->type.type == PW_EAP_TLS, or anything
319 eaptls_packet = (eaptls_packet_t *)eap_ds->response->type.data;
320 if (prev_eap_ds && prev_eap_ds->response)
321 eaptls_prev = (eaptls_packet_t *)prev_eap_ds->response->type.data;
326 * If there's no TLS data, or there's 1 byte of TLS data,
327 * with the flags set to zero, then it's an ACK.
329 * Find if this is a reply to the previous request sent
331 if ((eaptls_packet == NULL) ||
332 ((eap_ds->response->length == EAP_HEADER_LEN + 2) &&
333 ((eaptls_packet->flags & 0xc0) == 0x00))) {
335 if (prev_eap_ds->request->id == eap_ds->response->id) {
337 * Run the ACK handler directly from here.
339 radlog(L_INFO, "rlm_eap_tls: Received EAP-TLS ACK message");
340 return eaptls_ack_handler(handler);
342 radlog(L_ERR, "rlm_eap_tls: Received Invalid EAP-TLS ACK message");
343 return EAPTLS_INVALID;
348 * We send TLS_START, but do not receive it.
350 if (TLS_START(eaptls_packet->flags)) {
351 radlog(L_ERR, "rlm_eap_tls: Received unexpected EAP-TLS Start message");
352 return EAPTLS_INVALID;
356 * The L bit (length included) is set to indicate the
357 * presence of the four octet TLS Message Length field,
358 * and MUST be set for the first fragment of a fragmented
359 * TLS message or set of messages.
361 * The M bit (more fragments) is set on all but the last
364 * The S bit (EAP-TLS start) is set in an EAP-TLS Start
365 * message. This differentiates the EAP-TLS Start message
366 * from a fragment acknowledgement.
368 if (TLS_LENGTH_INCLUDED(eaptls_packet->flags)) {
369 if (TLS_MORE_FRAGMENTS(eaptls_packet->flags)) {
371 * FIRST_FRAGMENT is identified
372 * 1. If there is no previous EAP-response received.
373 * 2. If EAP-response received, then its M bit not set.
374 * (It is because Last fragment will not have M bit set)
376 if ((prev_eap_ds->response == NULL) ||
377 (eaptls_prev == NULL) ||
378 !TLS_MORE_FRAGMENTS(eaptls_prev->flags)) {
380 radlog(L_INFO, "rlm_eap_tls: Received EAP-TLS First Fragment of the message");
381 return EAPTLS_FIRST_FRAGMENT;
384 radlog(L_INFO, "rlm_eap_tls: More Fragments with length included");
385 return EAPTLS_MORE_FRAGMENTS_WITH_LENGTH;
389 radlog(L_INFO, "rlm_eap_tls: Length Included");
390 return EAPTLS_LENGTH_INCLUDED;
394 if (TLS_MORE_FRAGMENTS(eaptls_packet->flags)) {
395 radlog(L_INFO, "rlm_eap_tls: More fragments to follow");
396 return EAPTLS_MORE_FRAGMENTS;
400 * None of the flags are set, but it's still a valid
410 * length = code + id + length + flags + tlsdata
411 * = 1 + 1 + 2 + 1 + X
412 * length = EAP-length - 1(EAP-Type = 1 octet)
413 * flags = EAP-typedata[0] (1 octet)
414 * dlen = EAP-typedata[1-4] (4 octets), if L flag set
415 * = length - 5(code+id+length+flags), otherwise
416 * data = EAP-typedata[5-n], if L flag set
417 * = EAP-typedata[1-n], otherwise
418 * packet = EAP-typedata (complete typedata)
420 * Points to consider during EAP-TLS data extraction
421 * 1. In the received packet, No data will be present incase of ACK-NAK
422 * 2. Incase if more fragments need to be received then ACK after retreiving this fragment.
424 * RFC 2716 Section 4.2. PPP EAP TLS Request Packet
427 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
428 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
429 * | Code | Identifier | Length |
430 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
431 * | Type | Flags | TLS Message Length
432 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
433 * | TLS Message Length | TLS Data...
434 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
436 * The Length field is two octets and indicates the length of the EAP
437 * packet including the Code, Identifir, Length, Type, and TLS data
440 static EAPTLS_PACKET *eaptls_extract(EAP_DS *eap_ds, eaptls_status_t status)
442 EAPTLS_PACKET *tlspacket;
443 uint32_t data_len = 0;
445 uint8_t *data = NULL;
447 if (status == EAPTLS_INVALID)
451 * The main EAP code & eaptls_verify() take care of
452 * ensuring that the packet is OK, and that we can
453 * extract the various fields we want.
455 * e.g. a TLS packet with zero data is allowed as an ACK,
456 * but we will never see it here, as we will simply
457 * send another fragment, instead of trying to extract
460 * MUST have TLS type octet, followed by flags, followed
463 assert(eap_ds->response->length > 2);
465 tlspacket = eaptls_alloc();
466 if (tlspacket == NULL) return NULL;
469 * Code & id for EAPTLS & EAP are same
470 * but eaptls_length = eap_length - 1(EAP-Type = 1 octet)
472 * length = code + id + length + type + tlsdata
473 * = 1 + 1 + 2 + 1 + X
475 tlspacket->code = eap_ds->response->code;
476 tlspacket->id = eap_ds->response->id;
477 tlspacket->length = eap_ds->response->length - 1; /* EAP type */
478 tlspacket->flags = eap_ds->response->type.data[0];
481 * A quick sanity check of the flags. If we've been told
482 * that there's a length, and there isn't one, then stop.
484 if (TLS_LENGTH_INCLUDED(tlspacket->flags) &&
485 (tlspacket->length < 5)) { /* flags + TLS message length */
486 radlog(L_ERR, "rlm_eap_tls: Invalid EAP-TLS packet received. (Length bit is set, but no length was found.)");
487 eaptls_free(&tlspacket);
492 * If the final TLS packet is larger than we can handle, die
495 * Likewise, if the EAP packet says N bytes, and the TLS
496 * packet says there's fewer bytes, it's a problem.
498 * FIXME: Try to ensure that the claimed length is
499 * consistent across multiple TLS fragments.
501 if (TLS_LENGTH_INCLUDED(tlspacket->flags)) {
502 memcpy(&data_len, &eap_ds->response->type.data[1], 4);
503 data_len = ntohl(data_len);
504 if (data_len > MAX_RECORD_SIZE) {
505 radlog(L_ERR, "rlm_eap_tls: The EAP-TLS packet will contain more data than we can process.");
506 eaptls_free(&tlspacket);
511 DEBUG2(" TLS: %d %d\n", data_len, tlspacket->length);
513 if (data_len < tlspacket->length) {
514 radlog(L_ERR, "rlm_eap_tls: EAP-TLS packet claims to be smaller than the encapsulating EAP packet.");
515 eaptls_free(&tlspacket);
523 * The TLS Message Length field is four octets, and
524 * provides the total length of the TLS message or set of
525 * messages that is being fragmented; this simplifies
528 * Dynamic allocation of buffers as & when we know the
529 * length should solve the problem.
531 case EAPTLS_FIRST_FRAGMENT:
532 case EAPTLS_LENGTH_INCLUDED:
533 case EAPTLS_MORE_FRAGMENTS_WITH_LENGTH:
534 if (tlspacket->length < 5) { /* flags + TLS message length */
535 radlog(L_ERR, "rlm_eap_tls: Invalid EAP-TLS packet received. (Expected length, got none.)");
536 eaptls_free(&tlspacket);
541 * Extract all the TLS fragments from the
542 * previous eap_ds Start appending this
543 * fragment to the above ds
545 memcpy(&data_len, &eap_ds->response->type.data[1], sizeof(uint32_t));
546 data_len = ntohl(data_len);
547 data = (eap_ds->response->type.data + 5/*flags+TLS-Length*/);
548 len = eap_ds->response->type.length - 5/*flags+TLS-Length*/;
551 * Hmm... this should be an error, too.
553 if (data_len > len) {
559 * Data length is implicit, from the EAP header.
561 case EAPTLS_MORE_FRAGMENTS:
563 data_len = eap_ds->response->type.length - 1/*flags*/;
564 data = eap_ds->response->type.data + 1/*flags*/;
568 radlog(L_ERR, "rlm_eap_tls: Invalid EAP-TLS packet received");
569 eaptls_free(&tlspacket);
573 tlspacket->dlen = data_len;
575 tlspacket->data = (unsigned char *)malloc(data_len);
576 if (tlspacket->data == NULL) {
577 radlog(L_ERR, "rlm_eap_tls: out of memory");
578 eaptls_free(&tlspacket);
581 memcpy(tlspacket->data, data, data_len);
590 * To process the TLS,
592 * 1. EAP-TLS should get the compelete TLS data from the peer.
593 * 2. Store that data in a data structure with any other required info
594 * 3. Handle that data structure to the TLS module.
595 * 4. TLS module will perform its operations on the data and
596 * handle back to EAP-TLS
599 * 1. EAP-TLS if necessary will fragment it and send it to the
602 * During EAP-TLS initialization, TLS Context object will be
603 * initialized and stored. For every new authentication
604 * requests, TLS will open a new session object and that session
605 * object should be maintained even after the session is
606 * completed for session resumption. (Probably later as a feature
607 * as we donot know who maintains these session objects ie,
608 * SSL_CTX (internally) or TLS module(explicitly). If TLS module,
609 * then how to let SSL API know about these sessions.)
611 static void eaptls_operation(EAPTLS_PACKET *eaptls_packet UNUSED,
612 eaptls_status_t status, EAP_HANDLER *handler)
614 tls_session_t *tls_session;
616 tls_session = (tls_session_t *)handler->opaque;
618 if ((status == EAPTLS_MORE_FRAGMENTS) ||
619 (status == EAPTLS_MORE_FRAGMENTS_WITH_LENGTH) ||
620 (status == EAPTLS_FIRST_FRAGMENT)) {
624 eaptls_send_ack(handler->eap_ds, tls_session->peap_flag);
627 * We have the complete TLS-data or TLS-message.
629 * Clean the dirty message.
631 * Authenticate the user and send
635 * is required then send another request. */
636 if (tls_handshake_recv(tls_session)) {
638 * FIXME: return success/fail.
640 * TLS proper can decide what to do, then.
642 eaptls_request(handler->eap_ds, tls_session);
644 eaptls_fail(handler->eap_ds, tls_session->peap_flag);
652 * In the actual authentication first verify the packet and then create the data structure
655 * To process the TLS,
657 * 1. EAP-TLS should get the compelete TLS data from the peer.
658 * 2. Store that data in a data structure with any other required info
659 * 3. Hand this data structure to the TLS module.
660 * 4. TLS module will perform its operations on the data and hands back to EAP-TLS
662 * 1. EAP-TLS if necessary will fragment it and send it to the destination.
664 * During EAP-TLS initialization, TLS Context object will be
665 * initialized and stored. For every new authentication
666 * requests, TLS will open a new session object and that
667 * session object SHOULD be maintained even after the session
668 * is completed, for session resumption. (Probably later as a
669 * feature, as we do not know who maintains these session
670 * objects ie, SSL_CTX (internally) or TLS module (explicitly). If
671 * TLS module, then how to let SSL API know about these
676 * Process an EAP request
678 eaptls_status_t eaptls_process(EAP_HANDLER *handler)
680 tls_session_t *tls_session = (tls_session_t *) handler->opaque;
681 EAPTLS_PACKET *tlspacket;
682 eaptls_status_t status;
684 DEBUG2(" rlm_eap_tls: processing TLS");
686 /* This case is when SSL generates Alert then we
687 * send that alert to the client and then send the EAP-Failure
689 status = eaptls_verify(handler);
690 DEBUG2(" eaptls_verify returned %d\n", status);
698 * Success means that we're done the initial
699 * handshake. For TTLS, this means send stuff
700 * back to the client, and the client sends us
701 * more tunneled data.
708 * Normal TLS request, continue with the "get rest
709 * of fragments" phase.
712 eaptls_request(handler->eap_ds, tls_session);
713 return EAPTLS_HANDLED;
717 * The handshake is done, and we're in the "tunnel
721 DEBUG2(" rlm_eap_tls: Done initial handshake");
724 * Get the rest of the fragments.
726 case EAPTLS_FIRST_FRAGMENT:
727 case EAPTLS_MORE_FRAGMENTS:
728 case EAPTLS_LENGTH_INCLUDED:
729 case EAPTLS_MORE_FRAGMENTS_WITH_LENGTH:
734 * Extract the TLS packet from the buffer.
736 if ((tlspacket = eaptls_extract(handler->eap_ds, status)) == NULL)
740 * Get the session struct from the handler
742 * update the dirty_in buffer
744 * NOTE: This buffer will contain partial data when M bit is set.
746 * CAUTION while reinitializing this buffer, it should be
747 * reinitialized only when this M bit is NOT set.
749 if (tlspacket->dlen !=
750 (tls_session->record_plus)(&tls_session->dirty_in, tlspacket->data, tlspacket->dlen)) {
751 eaptls_free(&tlspacket);
752 radlog(L_ERR, "rlm_eap_tls: Exceeded maximum record size");
757 * SSL initalization is done. Return.
759 * The TLS data will be in the tls_session structure.
761 if (SSL_is_init_finished(tls_session->ssl)) {
762 eaptls_free(&tlspacket);
767 * Continue the handshake.
769 eaptls_operation(tlspacket, status, handler);
771 eaptls_free(&tlspacket);
772 return EAPTLS_HANDLED;
777 * compose the TLS reply packet in the EAP reply typedata
779 int eaptls_compose(EAP_DS *eap_ds, EAPTLS_PACKET *reply)
784 * Don't set eap_ds->request->type.type, as the main EAP
785 * handler will do that for us. This allows the TLS
786 * module to be called from TTLS & PEAP.
790 * When the EAP server receives an EAP-Response with the
791 * M bit set, it MUST respond with an EAP-Request with
792 * EAP-Type=EAP-TLS and no data. This serves as a
793 * fragment ACK. The EAP peer MUST wait until it receives
794 * the EAP-Request before sending another fragment.
796 * In order to prevent errors in the processing of
797 * fragments, the EAP server MUST use increment the
798 * Identifier value for each fragment ACK contained
799 * within an EAP-Request, and the peer MUST include this
800 * Identifier value in the subsequent fragment contained
801 * within an EAP- Reponse.
803 eap_ds->request->type.data = malloc(reply->length - TLS_HEADER_LEN + 1);
804 if (eap_ds->request->type.data == NULL) {
805 radlog(L_ERR, "rlm_eap_tls: out of memory");
809 /* EAPTLS Header length is excluded while computing EAP typelen */
810 eap_ds->request->type.length = reply->length - TLS_HEADER_LEN;
812 ptr = eap_ds->request->type.data;
813 *ptr++ = (uint8_t)(reply->flags & 0xFF);
815 if (reply->dlen) memcpy(ptr, reply->data, reply->dlen);
817 switch (reply->code) {
821 eap_ds->request->code = PW_EAP_REQUEST;
824 eap_ds->request->code = PW_EAP_SUCCESS;
827 eap_ds->request->code = PW_EAP_FAILURE;
830 /* Should never enter here */
831 eap_ds->request->code = PW_EAP_FAILURE;