Lines Matching refs:sm

71 void eap_peer_config_deinit(struct eap_sm *sm);
72 void eap_peer_blob_deinit(struct eap_sm *sm);
73 void eap_deinit_prev_method(struct eap_sm *sm, const char *txt);
109 static int eap_config_allowed_method(struct eap_sm *sm, in eap_config_allowed_method() argument
149 int eap_allowed_method(struct eap_sm *sm, int vendor, u32 method) in eap_allowed_method() argument
151 return eap_config_allowed_method(sm, eap_get_config(sm), vendor, in eap_allowed_method()
265 bool eap_sm_allowMethod(struct eap_sm *sm, int vendor, in eap_sm_allowMethod() argument
268 if (!eap_allowed_method(sm, vendor, method)) { in eap_sm_allowMethod()
317 void eap_deinit_prev_method(struct eap_sm *sm, const char *txt) in eap_deinit_prev_method() argument
319 if (sm->m == NULL || sm->eap_method_priv == NULL) in eap_deinit_prev_method()
321 sm->m->deinit(sm, sm->eap_method_priv); in eap_deinit_prev_method()
322 sm->eap_method_priv = NULL; in eap_deinit_prev_method()
323 sm->m = NULL; in eap_deinit_prev_method()
326 static int eap_sm_set_scard_pin(struct eap_sm *sm, in eap_sm_set_scard_pin() argument
332 static int eap_sm_get_scard_identity(struct eap_sm *sm, in eap_sm_get_scard_identity() argument
350 struct wpabuf * eap_sm_buildIdentity(struct eap_sm *sm, int id, int encrypted) in eap_sm_buildIdentity() argument
352 struct eap_peer_config *config = eap_get_config(sm); in eap_sm_buildIdentity()
363 if (sm->m && sm->m->get_identity && in eap_sm_buildIdentity()
364 (identity = sm->m->get_identity(sm, sm->eap_method_priv, in eap_sm_buildIdentity()
384 if (eap_sm_get_scard_identity(sm, config) < 0) in eap_sm_buildIdentity()
391 eap_sm_request_identity(sm); in eap_sm_buildIdentity()
395 if (eap_sm_set_scard_pin(sm, config) < 0) in eap_sm_buildIdentity()
410 struct wpabuf * eap_sm_build_identity_resp(struct eap_sm *sm, u8 id, int encrypted) in eap_sm_build_identity_resp() argument
415 struct eap_peer_config *config = eap_get_config(sm); in eap_sm_build_identity_resp()
422 if (sm->m && sm->m->get_identity) { in eap_sm_build_identity_resp()
423 identity = sm->m->get_identity(sm, in eap_sm_build_identity_resp()
424 sm->eap_method_priv, in eap_sm_build_identity_resp()
449 struct wpabuf * eap_sm_build_nak(struct eap_sm *sm, EapType type, u8 id) in eap_sm_build_nak() argument
484 struct eap_peer_config *config = eap_get_config(sm); in eap_sm_build_nak()
511 struct eap_sm *sm, const u8 *private_key_passwd, in eap_peer_config_init() argument
514 if (!sm) in eap_peer_config_init()
517 sm->config.anonymous_identity = NULL; in eap_peer_config_init()
518 sm->config.identity = NULL; in eap_peer_config_init()
519 sm->config.password = NULL; in eap_peer_config_init()
520 sm->config.new_password = NULL; in eap_peer_config_init()
522 sm->config.private_key_passwd = private_key_passwd; in eap_peer_config_init()
523 sm->config.client_cert = (u8 *)sm->blob[0].name; in eap_peer_config_init()
524 sm->config.private_key = (u8 *)sm->blob[1].name; in eap_peer_config_init()
525 sm->config.ca_cert = (u8 *)sm->blob[2].name; in eap_peer_config_init()
526 sm->config.ca_path = NULL; in eap_peer_config_init()
528 sm->config.fragment_size = 1400; /* fragment size */ in eap_peer_config_init()
530 sm->config.pac_file = (char *) "blob://"; in eap_peer_config_init()
534 sm->config.anonymous_identity_len = g_wpa_anonymous_identity_len; in eap_peer_config_init()
535 sm->config.anonymous_identity = (u8 *)os_zalloc(sm->config.anonymous_identity_len); in eap_peer_config_init()
536 if (sm->config.anonymous_identity == NULL) in eap_peer_config_init()
538 … os_memcpy(sm->config.anonymous_identity, g_wpa_anonymous_identity, g_wpa_anonymous_identity_len); in eap_peer_config_init()
543 sm->config.identity_len = g_wpa_username_len; in eap_peer_config_init()
544 sm->config.identity = (u8 *)os_zalloc(sm->config.identity_len); in eap_peer_config_init()
545 if (sm->config.identity == NULL) { in eap_peer_config_init()
548 os_memcpy(sm->config.identity, g_wpa_username, g_wpa_username_len); in eap_peer_config_init()
552 sm->config.password_len = g_wpa_password_len; in eap_peer_config_init()
553 sm->config.password = (u8 *)os_zalloc(sm->config.password_len); in eap_peer_config_init()
554 if (sm->config.password == NULL) in eap_peer_config_init()
556 os_memcpy(sm->config.password, g_wpa_password, sm->config.password_len); in eap_peer_config_init()
560 sm->config.new_password_len = g_wpa_new_password_len; in eap_peer_config_init()
561 sm->config.new_password = (u8 *)os_zalloc(sm->config.new_password_len); in eap_peer_config_init()
562 if (sm->config.new_password == NULL) in eap_peer_config_init()
564 os_memcpy(sm->config.new_password, g_wpa_new_password, in eap_peer_config_init()
565 sm->config.new_password_len); in eap_peer_config_init()
569 sm->config.phase2 = g_wpa_ttls_phase2_type; in eap_peer_config_init()
572 sm->config.phase2 = "auth=MSCHAPV2"; in eap_peer_config_init()
576 sm->config.flags |= TLS_CONN_SUITEB; in eap_peer_config_init()
581 sm->config.flags |= TLS_CONN_USE_DEFAULT_CERT_BUNDLE; in eap_peer_config_init()
586 sm->config.phase1 = g_wpa_phase1_options; in eap_peer_config_init()
632 sm->config.eap_methods = config_methods; in eap_peer_config_init()
638 void eap_peer_config_deinit(struct eap_sm *sm) in eap_peer_config_deinit() argument
640 if (!sm) in eap_peer_config_deinit()
643 os_free(sm->config.anonymous_identity); in eap_peer_config_deinit()
644 os_free(sm->config.identity); in eap_peer_config_deinit()
645 os_free(sm->config.password); in eap_peer_config_deinit()
646 os_free(sm->config.new_password); in eap_peer_config_deinit()
647 os_free(sm->config.eap_methods); in eap_peer_config_deinit()
648 os_bzero(&sm->config, sizeof(struct eap_peer_config)); in eap_peer_config_deinit()
652 int eap_peer_blob_init(struct eap_sm *sm) in eap_peer_blob_init() argument
656 if (!sm) in eap_peer_blob_init()
660 sm->blob[0].name = (char *)os_zalloc(BLOB_NAME_LEN+1); in eap_peer_blob_init()
661 if (sm->blob[0].name == NULL) { in eap_peer_blob_init()
665 os_strlcpy(sm->blob[0].name, CLIENT_CERT_NAME, BLOB_NAME_LEN+1); in eap_peer_blob_init()
666 sm->blob[0].len = g_wpa_client_cert_len; in eap_peer_blob_init()
667 sm->blob[0].data = g_wpa_client_cert; in eap_peer_blob_init()
671 sm->blob[1].name = (char *)os_zalloc(BLOB_NAME_LEN+1); in eap_peer_blob_init()
672 if (sm->blob[1].name == NULL) { in eap_peer_blob_init()
676 os_strlcpy(sm->blob[1].name, PRIVATE_KEY_NAME, BLOB_NAME_LEN+1); in eap_peer_blob_init()
677 sm->blob[1].len = g_wpa_private_key_len; in eap_peer_blob_init()
678 sm->blob[1].data = g_wpa_private_key; in eap_peer_blob_init()
682 sm->blob[2].name = (char *)os_zalloc(BLOB_NAME_LEN+1); in eap_peer_blob_init()
683 if (sm->blob[2].name == NULL) { in eap_peer_blob_init()
687 os_strlcpy(sm->blob[2].name, CA_CERT_NAME, BLOB_NAME_LEN+1); in eap_peer_blob_init()
688 sm->blob[2].len = g_wpa_ca_cert_len; in eap_peer_blob_init()
689 sm->blob[2].data = g_wpa_ca_cert; in eap_peer_blob_init()
693 sm->blob[3].name = (char *)os_zalloc(sizeof(char) * 8); in eap_peer_blob_init()
694 if (sm->blob[3].name == NULL) { in eap_peer_blob_init()
698 os_strlcpy(sm->blob[3].name, "blob://", 8); in eap_peer_blob_init()
699 sm->blob[3].len = g_wpa_pac_file_len; in eap_peer_blob_init()
700 sm->blob[3].data = g_wpa_pac_file; in eap_peer_blob_init()
706 if (sm->blob[i].name) { in eap_peer_blob_init()
707 os_free(sm->blob[i].name); in eap_peer_blob_init()
708 sm->blob[i].name = NULL; in eap_peer_blob_init()
711 os_bzero(&sm->blob[0], sizeof(struct wpa_config_blob)*BLOB_NUM); in eap_peer_blob_init()
717 static void eap_sm_request(struct eap_sm *sm, enum wpa_ctrl_req_type field, in eap_sm_request() argument
722 if (sm == NULL) in eap_sm_request()
724 config = eap_get_config(sm); in eap_sm_request()
750 #define eap_sm_request(sm, type, msg, msglen) do { } while (0) argument
753 const char * eap_sm_get_method_name(struct eap_sm *sm) in eap_sm_get_method_name() argument
755 if (sm->m == NULL) in eap_sm_get_method_name()
757 return sm->m->name; in eap_sm_get_method_name()
770 void eap_sm_request_identity(struct eap_sm *sm) in eap_sm_request_identity() argument
772 eap_sm_request(sm, WPA_CTRL_REQ_EAP_IDENTITY, NULL, 0); in eap_sm_request_identity()
785 void eap_sm_request_password(struct eap_sm *sm) in eap_sm_request_password() argument
787 eap_sm_request(sm, WPA_CTRL_REQ_EAP_PASSWORD, NULL, 0); in eap_sm_request_password()
800 void eap_sm_request_new_password(struct eap_sm *sm) in eap_sm_request_new_password() argument
802 eap_sm_request(sm, WPA_CTRL_REQ_EAP_NEW_PASSWORD, NULL, 0); in eap_sm_request_new_password()
806 void eap_peer_blob_deinit(struct eap_sm *sm) in eap_peer_blob_deinit() argument
810 if (sm->blob[i].name) { in eap_peer_blob_deinit()
811 os_free(sm->blob[i].name); in eap_peer_blob_deinit()
812 sm->blob[i].name = NULL; in eap_peer_blob_deinit()
815 os_bzero(&sm->blob[0], sizeof(struct wpa_config_blob)*BLOB_NUM); in eap_peer_blob_deinit()
817 sm->config.client_cert = NULL; in eap_peer_blob_deinit()
818 sm->config.private_key = NULL; in eap_peer_blob_deinit()
819 sm->config.ca_cert = NULL; in eap_peer_blob_deinit()
820 sm->config.pac_file = NULL; in eap_peer_blob_deinit()
823 void eap_sm_abort(struct eap_sm *sm) in eap_sm_abort() argument
825 wpabuf_free(sm->lastRespData); in eap_sm_abort()
826 sm->lastRespData = NULL; in eap_sm_abort()
839 struct eap_peer_config * eap_get_config(struct eap_sm *sm) in eap_get_config() argument
841 return &sm->config; in eap_get_config()
851 const u8 * eap_get_config_identity(struct eap_sm *sm, size_t *len) in eap_get_config_identity() argument
853 struct eap_peer_config *config = eap_get_config(sm); in eap_get_config_identity()
867 const u8 * eap_get_config_password(struct eap_sm *sm, size_t *len) in eap_get_config_password() argument
869 struct eap_peer_config *config = eap_get_config(sm); in eap_get_config_password()
886 const u8 * eap_get_config_password2(struct eap_sm *sm, size_t *len, int *hash) in eap_get_config_password2() argument
888 struct eap_peer_config *config = eap_get_config(sm); in eap_get_config_password2()
905 const u8 * eap_get_config_new_password(struct eap_sm *sm, size_t *len) in eap_get_config_new_password() argument
907 struct eap_peer_config *config = eap_get_config(sm); in eap_get_config_new_password()
936 void eap_set_config_blob(struct eap_sm *sm, struct wpa_config_blob *blob) in eap_set_config_blob() argument
938 if (!sm) in eap_set_config_blob()
941 …if (eap_copy_buf((u8 **)&sm->blob[3].data, (size_t *)&sm->blob[3].len, blob->data, blob->len) < 0)… in eap_set_config_blob()
953 const struct wpa_config_blob * eap_get_config_blob(struct eap_sm *sm, in eap_get_config_blob() argument
958 if (!sm) in eap_get_config_blob()
962 if (sm->blob[i].name == NULL) in eap_get_config_blob()
964 if (os_strncmp(name, sm->blob[i].name, BLOB_NAME_LEN) == 0) { in eap_get_config_blob()
965 return &sm->blob[i]; in eap_get_config_blob()