]> git.ipfire.org Git - thirdparty/hostap.git/blob - eap_example/eap_example.c
Crypto build cleanup: remove INTERNAL_SHA256
[thirdparty/hostap.git] / eap_example / eap_example.c
1 /*
2 * Example application showing how EAP peer and server code from
3 * wpa_supplicant/hostapd can be used as a library. This example program
4 * initializes both an EAP server and an EAP peer entities and then runs
5 * through an EAP-PEAP/MSCHAPv2 authentication.
6 * Copyright (c) 2007, Jouni Malinen <j@w1.fi>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * Alternatively, this software may be distributed under the terms of BSD
13 * license.
14 *
15 * See README and COPYING for more details.
16 */
17
18 #include "includes.h"
19
20 #include "common.h"
21
22
23 int eap_example_peer_init(void);
24 void eap_example_peer_deinit(void);
25 int eap_example_peer_step(void);
26
27 int eap_example_server_init(void);
28 void eap_example_server_deinit(void);
29 int eap_example_server_step(void);
30
31
32 extern int wpa_debug_level;
33
34 int main(int argc, char *argv[])
35 {
36 int res_s, res_p;
37
38 wpa_debug_level = 0;
39
40 if (eap_example_peer_init() < 0 ||
41 eap_example_server_init() < 0)
42 return -1;
43
44 do {
45 printf("---[ server ]--------------------------------\n");
46 res_s = eap_example_server_step();
47 printf("---[ peer ]----------------------------------\n");
48 res_p = eap_example_peer_step();
49 } while (res_s || res_p);
50
51 eap_example_peer_deinit();
52 eap_example_server_deinit();
53
54 return 0;
55 }