Home | History | Annotate | Download | only in eap_peer

Lines Matching refs:imc

2  * EAP-TNC - TNCC (IF-IMC and IF-TNCCS)
42 /* TNC IF-IMC */
97 struct tnc_if_imc *imc;
113 struct tnc_if_imc *imc;
127 imc = tnc_imc[imcID];
128 os_free(imc->supported_types);
129 imc->supported_types =
131 if (imc->supported_types == NULL)
133 os_memcpy(imc->supported_types, supportedTypes,
135 imc->num_supported_types = typeCount;
148 struct tnc_if_imc *imc;
165 imc = tnc_imc[imcID];
166 os_free(imc->imc_send);
167 imc->imc_send_len = 0;
168 imc->imc_send = os_zalloc(b64len + 100);
169 if (imc->imc_send == NULL) {
174 imc->imc_send_len =
175 os_snprintf((char *) imc->imc_send, b64len + 100,
176 "<IMC-IMV-Message><Type>%08X</Type>"
177 "<Base64>%s</Base64></IMC-IMV-Message>",
198 * require that the IMC continues to be loaded in memory afer
276 static int tncc_imc_resolve_funcs(struct tnc_if_imc *imc)
278 void *handle = imc->dlhandle;
280 /* Mandatory IMC functions */
281 imc->Initialize = tncc_get_sym(handle, "TNC_IMC_Initialize");
282 if (imc->Initialize == NULL) {
283 wpa_printf(MSG_ERROR, "TNC: IMC does not export "
288 imc->BeginHandshake = tncc_get_sym(handle, "TNC_IMC_BeginHandshake");
289 if (imc->BeginHandshake == NULL) {
290 wpa_printf(MSG_ERROR, "TNC: IMC does not export "
295 imc->ProvideBindFunction =
297 if (imc->ProvideBindFunction == NULL) {
298 wpa_printf(MSG_ERROR, "TNC: IMC does not export "
303 /* Optional IMC functions */
304 imc->NotifyConnectionChange =
306 imc->ReceiveMessage = tncc_get_sym(handle, "TNC_IMC_ReceiveMessage");
307 imc->BatchEnding = tncc_get_sym(handle, "TNC_IMC_BatchEnding");
308 imc->Terminate = tncc_get_sym(handle, "TNC_IMC_Terminate");
314 static int tncc_imc_initialize(struct tnc_if_imc *imc)
319 wpa_printf(MSG_DEBUG, "TNC: Calling TNC_IMC_Initialize for IMC '%s'",
320 imc->name);
321 res = imc->Initialize(imc->imcID, TNC_IFIMC_VERSION_1,
330 static int tncc_imc_terminate(struct tnc_if_imc *imc)
334 if (imc->Terminate == NULL)
337 wpa_printf(MSG_DEBUG, "TNC: Calling TNC_IMC_Terminate for IMC '%s'",
338 imc->name);
339 res = imc->Terminate(imc->imcID);
347 static int tncc_imc_provide_bind_function(struct tnc_if_imc *imc)
352 "IMC '%s'", imc->name);
353 res = imc->ProvideBindFunction(imc->imcID, TNC_TNCC_BindFunction);
361 static int tncc_imc_notify_connection_change(struct tnc_if_imc *imc,
366 if (imc->NotifyConnectionChange == NULL)
370 " for IMC '%s'", (int) state, imc->name);
371 res = imc->NotifyConnectionChange(imc->imcID, imc->connectionID,
380 static int tncc_imc_begin_handshake(struct tnc_if_imc *imc)
384 wpa_printf(MSG_DEBUG, "TNC: Calling TNC_IMC_BeginHandshake for IMC "
385 "'%s'", imc->name);
386 res = imc->BeginHandshake(imc->imcID, imc->connectionID);
394 static int tncc_load_imc(struct tnc_if_imc *imc)
396 if (imc->path == NULL) {
397 wpa_printf(MSG_DEBUG, "TNC: No IMC configured");
401 wpa_printf(MSG_DEBUG, "TNC: Opening IMC: %s (%s)",
402 imc->name, imc->path);
406 TCHAR *lib = wpa_strdup_tchar(imc->path);
409 imc->dlhandle = LoadLibrary(lib);
413 imc->dlhandle = LoadLibrary(imc->path);
415 if (imc->dlhandle == NULL) {
416 wpa_printf(MSG_ERROR, "TNC: Failed to open IMC '%s' (%s): %d",
417 imc->name, imc->path, (int) GetLastError());
421 imc->dlhandle = dlopen(imc->path, RTLD_LAZY);
422 if (imc->dlhandle == NULL) {
423 wpa_printf(MSG_ERROR, "TNC: Failed to open IMC '%s' (%s): %s",
424 imc->name, imc->path, dlerror());
429 if (tncc_imc_resolve_funcs(imc) < 0) {
430 wpa_printf(MSG_ERROR, "TNC: Failed to resolve IMC functions");
434 if (tncc_imc_initialize(imc) < 0 ||
435 tncc_imc_provide_bind_function(imc) < 0) {
436 wpa_printf(MSG_ERROR, "TNC: Failed to initialize IMC");
444 static void tncc_unload_imc(struct tnc_if_imc *imc)
446 tncc_imc_terminate(imc);
447 tnc_imc[imc->imcID] = NULL;
449 if (imc->dlhandle) {
451 FreeLibrary(imc->dlhandle);
453 dlclose(imc->dlhandle);
456 os_free(imc->name);
457 os_free(imc->path);
458 os_free(imc->supported_types);
459 os_free(imc->imc_send);
463 static int tncc_supported_type(struct tnc_if_imc *imc, unsigned int type)
468 if (imc == NULL || imc->supported_types == NULL)
474 for (i = 0; i < imc->num_supported_types; i++) {
476 svendor = imc->supported_types[i] >> 8;
477 ssubtype = imc->supported_types[i] & 0xff;
490 struct tnc_if_imc *imc;
493 wpa_hexdump_ascii(MSG_MSGDUMP, "TNC: Message to IMC(s)", msg, len);
495 for (imc = tncc->imc; imc; imc = imc->next) {
496 if (imc->ReceiveMessage == NULL ||
497 !tncc_supported_type(imc, type))
500 wpa_printf(MSG_DEBUG, "TNC: Call ReceiveMessage for IMC '%s'",
501 imc->name);
502 res = imc->ReceiveMessage(imc->imcID, imc->connectionID,
513 struct tnc_if_imc *imc;
515 for (imc = tncc->imc; imc; imc = imc->next) {
517 imc, TNC_CONNECTION_STATE_CREATE);
519 imc, TNC_CONNECTION_STATE_HANDSHAKE);
521 os_free(imc->imc_send);
522 imc->imc_send = NULL;
523 imc->imc_send_len = 0;
525 tncc_imc_begin_handshake(imc);
532 struct tnc_if_imc *imc;
535 for (imc = tncc->imc; imc; imc = imc->next)
536 len += imc->imc_send_len;
543 struct tnc_if_imc *imc;
545 for (imc = tncc->imc; imc; imc = imc->next) {
546 if (imc->imc_send == NULL)
549 os_memcpy(pos, imc->imc_send, imc->imc_send_len);
550 pos += imc->imc_send_len;
551 os_free(imc->imc_send);
552 imc->imc_send = NULL;
553 imc->imc_send_len = 0;
585 struct tnc_if_imc *imc;
602 for (imc = tncc->imc; imc; imc = imc->next)
603 tncc_imc_notify_connection_change(imc, state);
744 * <IMC-IMV-Message>
747 * </IMC-IMV-Message>
754 pos = os_strstr(start, "<IMC-IMV-Message>");
758 end = os_strstr(start, "</IMC-IMV-Message>");
770 wpa_printf(MSG_DEBUG, "TNC: IMC-IMV-Message Type 0x%x", type);
885 struct tnc_if_imc *imc, *last;
888 last = tncc->imc;
918 wpa_printf(MSG_DEBUG, "TNC: IMC '" TSTR "'", name);
922 wpa_printf(MSG_DEBUG, "Could not open IMC key '" TSTR
931 "IMC key '" TSTR "'", name);
953 wpa_printf(MSG_DEBUG, "TNC: IMC Path '%s'", (char *) val);
965 imc = os_zalloc(sizeof(*imc));
966 if (imc == NULL) {
971 imc->imcID = j;
974 imc->name = os_strdup((char *) name);
975 imc->path = os_strdup((char *) val);
980 tncc->imc = imc;
982 last->next = imc;
983 last = imc;
985 tnc_imc[imc->imcID] = imc;
1006 struct tnc_if_imc *imc;
1019 imc = os_zalloc(sizeof(*imc));
1020 if (imc == NULL) {
1025 imc->imcID = i;
1028 wpa_printf(MSG_DEBUG, "TNC: Configured IMC: %s", pos);
1030 wpa_printf(MSG_ERROR, "TNC: Ignoring invalid IMC line '%s' "
1032 os_free(imc);
1041 wpa_printf(MSG_ERROR, "TNC: Ignoring invalid IMC line '%s' "
1043 os_free(imc);
1048 imc->name = os_strdup(pos);
1052 wpa_printf(MSG_ERROR, "TNC: Ignoring invalid IMC line '%s' "
1054 os_free(imc->name);
1055 os_free(imc);
1060 wpa_printf(MSG_DEBUG, "TNC: IMC file: '%s'", pos);
1061 imc->path = os_strdup(pos);
1062 tnc_imc[imc->imcID] = imc;
1064 return imc;
1072 struct tnc_if_imc *imc, *last;
1091 if (os_strncmp(pos, "IMC ", 4) == 0) {
1094 imc = tncc_parse_imc(pos + 4, line_end, &error);
1099 if (imc) {
1101 tncc->imc = imc;
1103 last->next = imc;
1104 last = imc;
1120 struct tnc_if_imc *imc;
1136 for (imc = tncc->imc; imc; imc = imc->next) {
1137 if (tncc_load_imc(imc)) {
1138 wpa_printf(MSG_ERROR, "TNC: Failed to load IMC '%s'",
1139 imc->name);
1154 struct tnc_if_imc *imc, *prev;
1156 imc = tncc->imc;
1157 while (imc) {
1158 tncc_unload_imc(imc);
1160 prev = imc;
1161 imc = imc->next;