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 = os_memdup(supportedTypes,
131 if (imc->supported_types == NULL)
133 imc->num_supported_types = typeCount;
146 struct tnc_if_imc *imc;
163 imc = tnc_imc[imcID];
164 os_free(imc->imc_send);
165 imc->imc_send_len = 0;
166 imc->imc_send = os_zalloc(b64len + 100);
167 if (imc->imc_send == NULL) {
172 imc->imc_send_len =
173 os_snprintf((char *) imc->imc_send, b64len + 100,
174 "<IMC-IMV-Message><Type>%08X</Type>"
175 "<Base64>%s</Base64></IMC-IMV-Message>",
196 * require that the IMC continues to be loaded in memory afer
275 static int tncc_imc_resolve_funcs(struct tnc_if_imc *imc)
277 void *handle = imc->dlhandle;
279 /* Mandatory IMC functions */
280 imc->Initialize = tncc_get_sym(handle, "TNC_IMC_Initialize");
281 if (imc->Initialize == NULL) {
282 wpa_printf(MSG_ERROR, "TNC: IMC does not export "
287 imc->BeginHandshake = tncc_get_sym(handle, "TNC_IMC_BeginHandshake");
288 if (imc->BeginHandshake == NULL) {
289 wpa_printf(MSG_ERROR, "TNC: IMC does not export "
294 imc->ProvideBindFunction =
296 if (imc->ProvideBindFunction == NULL) {
297 wpa_printf(MSG_ERROR, "TNC: IMC does not export "
302 /* Optional IMC functions */
303 imc->NotifyConnectionChange =
305 imc->ReceiveMessage = tncc_get_sym(handle, "TNC_IMC_ReceiveMessage");
306 imc->BatchEnding = tncc_get_sym(handle, "TNC_IMC_BatchEnding");
307 imc->Terminate = tncc_get_sym(handle, "TNC_IMC_Terminate");
313 static int tncc_imc_initialize(struct tnc_if_imc *imc)
318 wpa_printf(MSG_DEBUG, "TNC: Calling TNC_IMC_Initialize for IMC '%s'",
319 imc->name);
320 res = imc->Initialize(imc->imcID, TNC_IFIMC_VERSION_1,
329 static int tncc_imc_terminate(struct tnc_if_imc *imc)
333 if (imc->Terminate == NULL)
336 wpa_printf(MSG_DEBUG, "TNC: Calling TNC_IMC_Terminate for IMC '%s'",
337 imc->name);
338 res = imc->Terminate(imc->imcID);
346 static int tncc_imc_provide_bind_function(struct tnc_if_imc *imc)
351 "IMC '%s'", imc->name);
352 res = imc->ProvideBindFunction(imc->imcID, TNC_TNCC_BindFunction);
360 static int tncc_imc_notify_connection_change(struct tnc_if_imc *imc,
365 if (imc->NotifyConnectionChange == NULL)
369 " for IMC '%s'", (int) state, imc->name);
370 res = imc->NotifyConnectionChange(imc->imcID, imc->connectionID,
379 static int tncc_imc_begin_handshake(struct tnc_if_imc *imc)
383 wpa_printf(MSG_DEBUG, "TNC: Calling TNC_IMC_BeginHandshake for IMC "
384 "'%s'", imc->name);
385 res = imc->BeginHandshake(imc->imcID, imc->connectionID);
393 static int tncc_load_imc(struct tnc_if_imc *imc)
395 if (imc->path == NULL) {
396 wpa_printf(MSG_DEBUG, "TNC: No IMC configured");
400 wpa_printf(MSG_DEBUG, "TNC: Opening IMC: %s (%s)",
401 imc->name, imc->path);
405 TCHAR *lib = wpa_strdup_tchar(imc->path);
408 imc->dlhandle = LoadLibrary(lib);
412 imc->dlhandle = LoadLibrary(imc->path);
414 if (imc->dlhandle == NULL) {
415 wpa_printf(MSG_ERROR, "TNC: Failed to open IMC '%s' (%s): %d",
416 imc->name, imc->path, (int) GetLastError());
420 imc->dlhandle = dlopen(imc->path, RTLD_LAZY);
421 if (imc->dlhandle == NULL) {
422 wpa_printf(MSG_ERROR, "TNC: Failed to open IMC '%s' (%s): %s",
423 imc->name, imc->path, dlerror());
428 if (tncc_imc_resolve_funcs(imc) < 0) {
429 wpa_printf(MSG_ERROR, "TNC: Failed to resolve IMC functions");
433 if (tncc_imc_initialize(imc) < 0 ||
434 tncc_imc_provide_bind_function(imc) < 0) {
435 wpa_printf(MSG_ERROR, "TNC: Failed to initialize IMC");
443 static void tncc_unload_imc(struct tnc_if_imc *imc)
445 tncc_imc_terminate(imc);
446 tnc_imc[imc->imcID] = NULL;
448 if (imc->dlhandle) {
450 FreeLibrary(imc->dlhandle);
452 dlclose(imc->dlhandle);
455 os_free(imc->name);
456 os_free(imc->path);
457 os_free(imc->supported_types);
458 os_free(imc->imc_send);
462 static int tncc_supported_type(struct tnc_if_imc *imc, unsigned int type)
467 if (imc == NULL || imc->supported_types == NULL)
473 for (i = 0; i < imc->num_supported_types; i++) {
475 svendor = imc->supported_types[i] >> 8;
476 ssubtype = imc->supported_types[i] & 0xff;
489 struct tnc_if_imc *imc;
492 wpa_hexdump_ascii(MSG_MSGDUMP, "TNC: Message to IMC(s)", msg, len);
494 for (imc = tncc->imc; imc; imc = imc->next) {
495 if (imc->ReceiveMessage == NULL ||
496 !tncc_supported_type(imc, type))
499 wpa_printf(MSG_DEBUG, "TNC: Call ReceiveMessage for IMC '%s'",
500 imc->name);
501 res = imc->ReceiveMessage(imc->imcID, imc->connectionID,
512 struct tnc_if_imc *imc;
514 for (imc = tncc->imc; imc; imc = imc->next) {
516 imc, TNC_CONNECTION_STATE_CREATE);
518 imc, TNC_CONNECTION_STATE_HANDSHAKE);
520 os_free(imc->imc_send);
521 imc->imc_send = NULL;
522 imc->imc_send_len = 0;
524 tncc_imc_begin_handshake(imc);
531 struct tnc_if_imc *imc;
534 for (imc = tncc->imc; imc; imc = imc->next)
535 len += imc->imc_send_len;
542 struct tnc_if_imc *imc;
544 for (imc = tncc->imc; imc; imc = imc->next) {
545 if (imc->imc_send == NULL)
548 os_memcpy(pos, imc->imc_send, imc->imc_send_len);
549 pos += imc->imc_send_len;
550 os_free(imc->imc_send);
551 imc->imc_send = NULL;
552 imc->imc_send_len = 0;
584 struct tnc_if_imc *imc;
601 for (imc = tncc->imc; imc; imc = imc->next)
602 tncc_imc_notify_connection_change(imc, state);
745 * <IMC-IMV-Message>
748 * </IMC-IMV-Message>
755 pos = os_strstr(start, "<IMC-IMV-Message>");
759 end = os_strstr(start, "</IMC-IMV-Message>");
771 wpa_printf(MSG_DEBUG, "TNC: IMC-IMV-Message Type 0x%x", type);
886 struct tnc_if_imc *imc, *last;
889 last = tncc->imc;
919 wpa_printf(MSG_DEBUG, "TNC: IMC '" TSTR "'", name);
923 wpa_printf(MSG_DEBUG, "Could not open IMC key '" TSTR
932 "IMC key '" TSTR "'", name);
954 wpa_printf(MSG_DEBUG, "TNC: IMC Path '%s'", (char *) val);
966 imc = os_zalloc(sizeof(*imc));
967 if (imc == NULL) {
972 imc->imcID = j;
975 imc->name = os_strdup((char *) name);
976 imc->path = os_strdup((char *) val);
981 tncc->imc = imc;
983 last->next = imc;
984 last = imc;
986 tnc_imc[imc->imcID] = imc;
1007 struct tnc_if_imc *imc;
1020 imc = os_zalloc(sizeof(*imc));
1021 if (imc == NULL) {
1026 imc->imcID = i;
1029 wpa_printf(MSG_DEBUG, "TNC: Configured IMC: %s", pos);
1031 wpa_printf(MSG_ERROR, "TNC: Ignoring invalid IMC line '%s' "
1033 os_free(imc);
1042 wpa_printf(MSG_ERROR, "TNC: Ignoring invalid IMC line '%s' "
1044 os_free(imc);
1049 imc->name = os_strdup(pos);
1053 wpa_printf(MSG_ERROR, "TNC: Ignoring invalid IMC line '%s' "
1055 os_free(imc->name);
1056 os_free(imc);
1061 wpa_printf(MSG_DEBUG, "TNC: IMC file: '%s'", pos);
1062 imc->path = os_strdup(pos);
1063 tnc_imc[imc->imcID] = imc;
1065 return imc;
1073 struct tnc_if_imc *imc, *last;
1092 if (os_strncmp(pos, "IMC ", 4) == 0) {
1095 imc = tncc_parse_imc(pos + 4, line_end, &error);
1100 if (imc) {
1102 tncc->imc = imc;
1104 last->next = imc;
1105 last = imc;
1121 struct tnc_if_imc *imc;
1137 for (imc = tncc->imc; imc; imc = imc->next) {
1138 if (tncc_load_imc(imc)) {
1139 wpa_printf(MSG_ERROR, "TNC: Failed to load IMC '%s'",
1140 imc->name);
1155 struct tnc_if_imc *imc, *prev;
1157 imc = tncc->imc;
1158 while (imc) {
1159 tncc_unload_imc(imc);
1161 prev = imc;
1162 imc = imc->next;