[Coding Convention][3.0 Mobile/Wearable]fido-client 97/65197/17 accepted/tizen/mobile/20160415.084247 accepted/tizen/mobile/20160425.044313 accepted/tizen/wearable/20160415.084220 accepted/tizen/wearable/20160425.044317 submit/tizen_mobile/20160415.054709 submit/tizen_mobile/20160425.030319 submit/tizen_wearable/20160415.054731 submit/tizen_wearable/20160425.030336
authorjkjo92 <jkjo92@samsung.com>
Fri, 8 Apr 2016 01:05:08 +0000 (10:05 +0900)
committerjkjo92 <jkjo92@samsung.com>
Fri, 15 Apr 2016 02:12:04 +0000 (11:12 +0900)
Change-Id: Ia05f0003505967f9bebf01ce82e1d4abfa640d9e
Signed-off-by: jkjo92 <jkjo92@samsung.com>
39 files changed:
LICENSE.Apache-2.0
client/CMakeLists.txt
client/fido_uaf_client.c
common/dbus_interfaces/dummyasm.xml
common/dbus_interfaces/fido.xml
common/fido_b64_util.c
common/fido_internal_types.h
common/fido_keys.h
common/fido_tlv_util.c
common/fido_uaf_types.h
common/fido_uaf_utils.c
dummyasm.manifest
fido.manifest
fido_svc_ui/CMakeLists.txt
fido_svc_ui/fido_ui_server.c
fido_svc_ui/org.tizen.fidosvcui.xml.in
include/fido_uaf_authenticator.h
include/fido_uaf_client.h
org.tizen.fidosvcui.manifest
server/CMakeLists.txt [changed mode: 0644->0755]
server/fido_app_id_handler.c
server/fido_asm_plugin_manager.c
server/fido_privilege_checker.c
server/fido_selection_ui_adaptor.c
server/fido_server.c
server/fido_uaf_policy_checker.c
test/Dummy_ASM_DBUS/CMakeLists.txt [changed mode: 0644->0755]
test/Dummy_ASM_DBUS/dummy_asm.json
test/Dummy_ASM_DBUS/dummy_asm_server.c
test/FIDOSample/src/main.c
test/Fido_Sample_RPM/CMakeLists.txt [changed mode: 0644->0755]
test/Fido_Sample_RPM/org.tizen.FidoSample.xml.in
test/Fido_Sample_RPM/res/auth_req.json
test/Fido_Sample_RPM/res/dereg_req.json
test/Fido_Sample_RPM/res/reg_req.json
test/Fido_Sample_RPM/src/main.c
test/shell_tc/CMakeLists.txt
test/shell_tc/fido_shell_tc.c
test/shell_tc/fido_shell_tc_util.h

index d645695..5d37849 100644 (file)
 
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
+                               Apache License
+                       Version 2.0, January 2004
+                       http://www.apache.org/licenses/
+
+       TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+       1. Definitions.
+
+               "License" shall mean the terms and conditions for use, reproduction,
+               and distribution as defined by Sections 1 through 9 of this document.
+
+               "Licensor" shall mean the copyright owner or entity authorized by
+               the copyright owner that is granting the License.
+
+               "Legal Entity" shall mean the union of the acting entity and all
+               other entities that control, are controlled by, or are under common
+               control with that entity. For the purposes of this definition,
+               "control" means (i) the power, direct or indirect, to cause the
+               direction or management of such entity, whether by contract or
+               otherwise, or (ii) ownership of fifty percent (50%) or more of the
+               outstanding shares, or (iii) beneficial ownership of such entity.
+
+               "You" (or "Your") shall mean an individual or Legal Entity
+               exercising permissions granted by this License.
+
+               "Source" form shall mean the preferred form for making modifications,
+               including but not limited to software source code, documentation
+               source, and configuration files.
+
+               "Object" form shall mean any form resulting from mechanical
+               transformation or translation of a Source form, including but
+               not limited to compiled object code, generated documentation,
+               and conversions to other media types.
+
+               "Work" shall mean the work of authorship, whether in Source or
+               Object form, made available under the License, as indicated by a
+               copyright notice that is included in or attached to the work
+               (an example is provided in the Appendix below).
+
+               "Derivative Works" shall mean any work, whether in Source or Object
+               form, that is based on (or derived from) the Work and for which the
+               editorial revisions, annotations, elaborations, or other modifications
+               represent, as a whole, an original work of authorship. For the purposes
+               of this License, Derivative Works shall not include works that remain
+               separable from, or merely link (or bind by name) to the interfaces of,
+               the Work and Derivative Works thereof.
+
+               "Contribution" shall mean any work of authorship, including
+               the original version of the Work and any modifications or additions
+               to that Work or Derivative Works thereof, that is intentionally
+               submitted to Licensor for inclusion in the Work by the copyright owner
+               or by an individual or Legal Entity authorized to submit on behalf of
+               the copyright owner. For the purposes of this definition, "submitted"
+               means any form of electronic, verbal, or written communication sent
+               to the Licensor or its representatives, including but not limited to
+               communication on electronic mailing lists, source code control systems,
+               and issue tracking systems that are managed by, or on behalf of, the
+               Licensor for the purpose of discussing and improving the Work, but
+               excluding communication that is conspicuously marked or otherwise
+               designated in writing by the copyright owner as "Not a Contribution."
+
+               "Contributor" shall mean Licensor and any individual or Legal Entity
+               on behalf of whom a Contribution has been received by Licensor and
+               subsequently incorporated within the Work.
+
+       2. Grant of Copyright License. Subject to the terms and conditions of
+               this License, each Contributor hereby grants to You a perpetual,
+               worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+               copyright license to reproduce, prepare Derivative Works of,
+               publicly display, publicly perform, sublicense, and distribute the
+               Work and such Derivative Works in Source or Object form.
+
+       3. Grant of Patent License. Subject to the terms and conditions of
+               this License, each Contributor hereby grants to You a perpetual,
+               worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+               (except as stated in this section) patent license to make, have made,
+               use, offer to sell, sell, import, and otherwise transfer the Work,
+               where such license applies only to those patent claims licensable
+               by such Contributor that are necessarily infringed by their
+               Contribution(s) alone or by combination of their Contribution(s)
+               with the Work to which such Contribution(s) was submitted. If You
+               institute patent litigation against any entity (including a
+               cross-claim or counterclaim in a lawsuit) alleging that the Work
+               or a Contribution incorporated within the Work constitutes direct
+               or contributory patent infringement, then any patent licenses
+               granted to You under this License for that Work shall terminate
+               as of the date such litigation is filed.
+
+       4. Redistribution. You may reproduce and distribute copies of the
+               Work or Derivative Works thereof in any medium, with or without
+               modifications, and in Source or Object form, provided that You
+               meet the following conditions:
+
+               (a) You must give any other recipients of the Work or
+                       Derivative Works a copy of this License; and
+
+               (b) You must cause any modified files to carry prominent notices
+                       stating that You changed the files; and
+
+               (c) You must retain, in the Source form of any Derivative Works
+                       that You distribute, all copyright, patent, trademark, and
+                       attribution notices from the Source form of the Work,
+                       excluding those notices that do not pertain to any part of
+                       the Derivative Works; and
+
+               (d) If the Work includes a "NOTICE" text file as part of its
+                       distribution, then any Derivative Works that You distribute must
+                       include a readable copy of the attribution notices contained
+                       within such NOTICE file, excluding those notices that do not
+                       pertain to any part of the Derivative Works, in at least one
+                       of the following places: within a NOTICE text file distributed
+                       as part of the Derivative Works; within the Source form or
+                       documentation, if provided along with the Derivative Works; or,
+                       within a display generated by the Derivative Works, if and
+                       wherever such third-party notices normally appear. The contents
+                       of the NOTICE file are for informational purposes only and
+                       do not modify the License. You may add Your own attribution
+                       notices within Derivative Works that You distribute, alongside
+                       or as an addendum to the NOTICE text from the Work, provided
+                       that such additional attribution notices cannot be construed
+                       as modifying the License.
+
+               You may add Your own copyright statement to Your modifications and
+               may provide additional or different license terms and conditions
+               for use, reproduction, or distribution of Your modifications, or
+               for any such Derivative Works as a whole, provided Your use,
+               reproduction, and distribution of the Work otherwise complies with
+               the conditions stated in this License.
+
+       5. Submission of Contributions. Unless You explicitly state otherwise,
+               any Contribution intentionally submitted for inclusion in the Work
+               by You to the Licensor shall be under the terms and conditions of
+               this License, without any additional terms or conditions.
+               Notwithstanding the above, nothing herein shall supersede or modify
+               the terms of any separate license agreement you may have executed
+               with Licensor regarding such Contributions.
+
+       6. Trademarks. This License does not grant permission to use the trade
+               names, trademarks, service marks, or product names of the Licensor,
+               except as required for reasonable and customary use in describing the
+               origin of the Work and reproducing the content of the NOTICE file.
+
+       7. Disclaimer of Warranty. Unless required by applicable law or
+               agreed to in writing, Licensor provides the Work (and each
+               Contributor provides its Contributions) on an "AS IS" BASIS,
+               WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+               implied, including, without limitation, any warranties or conditions
+               of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+               PARTICULAR PURPOSE. You are solely responsible for determining the
+               appropriateness of using or redistributing the Work and assume any
+               risks associated with Your exercise of permissions under this License.
+
+       8. Limitation of Liability. In no event and under no legal theory,
+               whether in tort (including negligence), contract, or otherwise,
+               unless required by applicable law (such as deliberate and grossly
+               negligent acts) or agreed to in writing, shall any Contributor be
+               liable to You for damages, including any direct, indirect, special,
+               incidental, or consequential damages of any character arising as a
+               result of this License or out of the use or inability to use the
+               Work (including but not limited to damages for loss of goodwill,
+               work stoppage, computer failure or malfunction, or any and all
+               other commercial damages or losses), even if such Contributor
+               has been advised of the possibility of such damages.
+
+       9. Accepting Warranty or Additional Liability. While redistributing
+               the Work or Derivative Works thereof, You may choose to offer,
+               and charge a fee for, acceptance of support, warranty, indemnity,
+               or other liability obligations and/or rights consistent with this
+               License. However, in accepting such obligations, You may act only
+               on Your own behalf and on Your sole responsibility, not on behalf
+               of any other Contributor, and only if You agree to indemnify,
+               defend, and hold each Contributor harmless for any liability
+               incurred by, or claims asserted against, such Contributor by reason
+               of your accepting any such warranty or additional liability.
+
+       END OF TERMS AND CONDITIONS
+
+       APPENDIX: How to apply the Apache License to your work.
+
+               To apply the Apache License to your work, attach the following
+               boilerplate notice, with the fields enclosed by brackets "[]"
+               replaced with your own identifying information. (Don't include
+               the brackets!)  The text should be enclosed in the appropriate
+               comment syntax for the file format. We also recommend that a
+               file or class name and description of purpose be included on the
+               same "printed page" as the copyright notice for easier
+               identification within third-party archives.
+
+       Copyright [yyyy] [name of copyright owner]
+
+       Licensed under the Apache License, Version 2.0 (the "License");
+       you may not use this file except in compliance with the License.
+       You may obtain a copy of the License at
+
+               http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+       See the License for the specific language governing permissions and
+       limitations under the License.
index c3c0fcc..c732b74 100644 (file)
@@ -3,9 +3,9 @@ SET(CLIENT_SRCS
        fido_uaf_client.c
        fido_uaf_authenticator.c
        ../common/fido_json_handler.c
-        ../common/fido_b64_util.c
-    ../common/fido_tlv_util.c
-    ../common/fido_uaf_utils.c
+       ../common/fido_b64_util.c
+       ../common/fido_tlv_util.c
+       ../common/fido_uaf_utils.c
 )
 
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
index 204ec8a..1b1ca27 100755 (executable)
 static Fido *_fido_dbus_obj = NULL;
 
 typedef struct _fido_process_cb_data {
-    fido_uaf_response_message_cb cb;
-    void *user_data;
+       fido_uaf_response_message_cb cb;
+       void *user_data;
 } _fido_process_cb_data_s;
 
 
 static void
 init_dbus(void)
 {
-    _INFO("init_dbus");
-#if !GLIB_CHECK_VERSION(2,35,0)
-    g_type_init();
+       _INFO("init_dbus");
+#if !GLIB_CHECK_VERSION(2, 35, 0)
+       g_type_init();
 #endif
 
-    GDBusConnection *connection = NULL;
-    GError *error = NULL;
+       GDBusConnection *connection = NULL;
+       GError *error = NULL;
 
-    connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+       connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
 
-    _INFO("after g_bus_get_sync");
+       _INFO("after g_bus_get_sync");
 
-
-    /* Create the object */
-    _fido_dbus_obj = fido_proxy_new_sync(connection,
-                                         G_DBUS_PROXY_FLAGS_NONE,
-                                         _FIDO_DBUS_NAME,
-                                         _FIDO_DBUS_PATH,
-                                         NULL,
-                                         &error);
+       /* Create the object */
+       _fido_dbus_obj = fido_proxy_new_sync(connection,
+                                               G_DBUS_PROXY_FLAGS_NONE,
+                                               _FIDO_DBUS_NAME,
+                                               _FIDO_DBUS_PATH,
+                                               NULL,
+                                               &error);
 }
 
 Fido *
 _dbus_proxy_get_instance(int time_out)
 {
-    _INFO("_dbus_proxy_get_instance singleton");
-
-    static pthread_once_t onceBlock = PTHREAD_ONCE_INIT;
-    if (_fido_dbus_obj == NULL) {
-        pthread_once(&onceBlock, init_dbus);
-        if (_fido_dbus_obj == NULL) {
-            _ERR("init_dbus failed");
-            onceBlock = PTHREAD_ONCE_INIT;
-        }
-    }
-    _INFO("_dbus_proxy_get_instance end");
+       _INFO("_dbus_proxy_get_instance singleton");
+
+       static pthread_once_t onceBlock = PTHREAD_ONCE_INIT;
+       if (_fido_dbus_obj == NULL) {
+               pthread_once(&onceBlock, init_dbus);
+               if (_fido_dbus_obj == NULL) {
+                       _ERR("init_dbus failed");
+                       onceBlock = PTHREAD_ONCE_INIT;
+               }
+       }
+       _INFO("_dbus_proxy_get_instance end");
 
-    g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(_fido_dbus_obj), time_out);
+       g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(_fido_dbus_obj), time_out);
 
-    return _fido_dbus_obj;
+       return _fido_dbus_obj;
 }
 
 static void
 _fido_uaf_process_operation_reply(GObject *object, GAsyncResult *res, gpointer user_data)
 {
-    _INFO("_fido_uaf_process_operation_reply");
+       _INFO("_fido_uaf_process_operation_reply");
 
-    GError *dbus_err = NULL;
+       GError *dbus_err = NULL;
 
-    if (user_data == NULL) {
-        _ERR("Can not proceed since callback data is NULL");
-        return;
-    }
+       if (user_data == NULL) {
+               _ERR("Can not proceed since callback data is NULL");
+       return;
+       }
 
-    _fido_process_cb_data_s *cb_data = (_fido_process_cb_data_s *)user_data;
-    if (cb_data == NULL) {
-        _ERR("Can not proceed since callback data is NULL");
-        return;
-    }
+       _fido_process_cb_data_s *cb_data = (_fido_process_cb_data_s *)user_data;
+       if (cb_data == NULL) {
+               _ERR("Can not proceed since callback data is NULL");
+               return;
+       }
 
-    if (cb_data->cb == NULL) {
-        _ERR("Can not proceed since callback data's cb part is NULL");
-        SAFE_DELETE(cb_data);
-        return;
-    }
+       if (cb_data->cb == NULL) {
+               _ERR("Can not proceed since callback data's cb part is NULL");
+               SAFE_DELETE(cb_data);
+               return;
+       }
 
-    int tizen_err = FIDO_ERROR_NONE;
+       int tizen_err = FIDO_ERROR_NONE;
 
-    char *uaf_response_json = NULL;
+       char *uaf_response_json = NULL;
 
-    fido_call_fido_uaf_process_operation_finish(_fido_dbus_obj, &tizen_err, &uaf_response_json,
-                                           res, &dbus_err);
+       fido_call_fido_uaf_process_operation_finish(_fido_dbus_obj, &tizen_err, &uaf_response_json,
+               res, &dbus_err);
 
-    if (dbus_err) {
-        _ERR("fido_foreach_authenticator failed [%s]", dbus_err->message);
-        if (tizen_err == FIDO_ERROR_NONE)
-            tizen_err = FIDO_ERROR_PERMISSION_DENIED;
-        /* Error is notified via tizen_err and/or fido_err, so no need to get dbus error*/
-    }
+       if (dbus_err) {
+               _ERR("fido_foreach_authenticator failed [%s]", dbus_err->message);
+               if (tizen_err == FIDO_ERROR_NONE)
+               tizen_err = FIDO_ERROR_PERMISSION_DENIED;
+               /* Error is notified via tizen_err and/or fido_err, so no need to get dbus error*/
+       }
 
-    g_clear_error(&dbus_err);
+       g_clear_error(&dbus_err);
 
-    if (strcmp(uaf_response_json, _EMPTY_JSON_STRING) == 0)
-        (cb_data->cb)(tizen_err, NULL, cb_data->user_data);
-    else
-        (cb_data->cb)(tizen_err, uaf_response_json, cb_data->user_data);
+       if (strcmp(uaf_response_json, _EMPTY_JSON_STRING) == 0)
+               (cb_data->cb)(tizen_err, NULL, cb_data->user_data);
+       else
+               (cb_data->cb)(tizen_err, uaf_response_json, cb_data->user_data);
 
-    _INFO("After calling fido_uaf_response_message_cb");
+       _INFO("After calling fido_uaf_response_message_cb");
 
-    SAFE_DELETE(cb_data);
-    SAFE_DELETE(uaf_response_json);
+       SAFE_DELETE(cb_data);
+       SAFE_DELETE(uaf_response_json);
 }
 
 EXPORT_API int
 fido_foreach_authenticator(fido_authenticator_cb callback, void *user_data)
 {
-    if (callback == NULL) {
-        _ERR("callback can not be NULL [FIDO_ERROR_INVALID_PARAMETER]");
-        return FIDO_ERROR_INVALID_PARAMETER;
-    }
+       if (callback == NULL) {
+               _ERR("callback can not be NULL [FIDO_ERROR_INVALID_PARAMETER]");
+               return FIDO_ERROR_INVALID_PARAMETER;
+       }
 
-    Fido *dbus_proxy = _dbus_proxy_get_instance(_DBUS_TIMEOUT_USE_DEFAULT);
-    if (dbus_proxy == NULL) {
-        _ERR("DBus proxy failed");
-        return FIDO_ERROR_NOT_SUPPORTED;
-    }
+       Fido *dbus_proxy = _dbus_proxy_get_instance(_DBUS_TIMEOUT_USE_DEFAULT);
+       if (dbus_proxy == NULL) {
+               _ERR("DBus proxy failed");
+               return FIDO_ERROR_NOT_SUPPORTED;
+       }
 
        gchar **discovery_data_json = NULL;
        int discovery_data_json_list_len = 0;
        int tz_err = 0;
        GError *dbus_err = NULL;
-       fido_call_fido_uaf_discover_sync(dbus_proxy, &tz_err, &discovery_data_json, &discovery_data_json_list_len,
-                                                                        NULL, &dbus_err);
-
+       fido_call_fido_uaf_discover_sync(dbus_proxy, &tz_err, &discovery_data_json,
+               &discovery_data_json_list_len, NULL, &dbus_err);
 
        if (dbus_err != NULL) {
                _ERR("fido_call_fido_uaf_discover_sync failed [%s]", dbus_err->message);
@@ -170,17 +168,15 @@ fido_foreach_authenticator(fido_authenticator_cb callback, void *user_data)
 
        int parser_err = 0;
        GList *auth_list = _uaf_parser_parse_asm_response_discover_client(discovery_data_json,
-                                                                                                                                                 discovery_data_json_list_len, &parser_err);
+                                               discovery_data_json_list_len, &parser_err);
        if ((auth_list == NULL) &&
                        (parser_err != FIDO_ERROR_NONE)) {
                tz_err = _convert_asm_status_code_to_uaf_error(parser_err);
-       }
-       else {
+       } else {
 
                if (g_list_length(auth_list) <= 0) {
                        tz_err = FIDO_ERROR_NOT_SUPPORTED;
-               }
-               else {
+               } else {
 
                        GList *auth_list_iter = g_list_first(auth_list);
                        while (auth_list_iter != NULL) {
@@ -199,7 +195,7 @@ fido_foreach_authenticator(fido_authenticator_cb callback, void *user_data)
        SAFE_DELETE(discovery_data_json);
 
        /*Items are deleted after callback is done for elements, so apps must make a local copy of elements if they
-         want to use them later*/
+       want to use them later*/
        g_list_free_full(auth_list, _free_asm_auth_list);
 
        return tz_err;
@@ -234,21 +230,20 @@ fido_get_client_version(int *client_major_version, int *client_minor_version)
 EXPORT_API int
 fido_uaf_is_supported(const char *uaf_message_json, bool *is_supported)
 {
-    if (uaf_message_json == NULL) {
-        _ERR("uaf_message_json can not be NULL [FIDO_ERROR_INVALID_PARAMETER]");
-        return FIDO_ERROR_INVALID_PARAMETER;
-    }
+       if (uaf_message_json == NULL) {
+               _ERR("uaf_message_json can not be NULL [FIDO_ERROR_INVALID_PARAMETER]");
+               return FIDO_ERROR_INVALID_PARAMETER;
+       }
 
-    Fido *dbus_proxy = _dbus_proxy_get_instance(_DBUS_TIMEOUT_USE_DEFAULT);
-    if (dbus_proxy == NULL) {
-        _ERR("DBus proxy failed");
-        return FIDO_ERROR_NOT_SUPPORTED;
-    }
+       Fido *dbus_proxy = _dbus_proxy_get_instance(_DBUS_TIMEOUT_USE_DEFAULT);
+       if (dbus_proxy == NULL) {
+               _ERR("DBus proxy failed");
+               return FIDO_ERROR_NOT_SUPPORTED;
+       }
 
        int tz_err = FIDO_ERROR_NONE;
        GError *dbus_err = NULL;
-       fido_call_fido_uaf_check_policy_sync(dbus_proxy, uaf_message_json, &tz_err,
-                                                                                NULL, &dbus_err);
+       fido_call_fido_uaf_check_policy_sync(dbus_proxy, uaf_message_json, &tz_err, NULL, &dbus_err);
 
        if (dbus_err != NULL) {
                _ERR("fido_call_fido_uaf_check_policy_sync failed [%s]", dbus_err->message);
@@ -261,105 +256,101 @@ fido_uaf_is_supported(const char *uaf_message_json, bool *is_supported)
        else
                *is_supported = false;
 
-    return FIDO_ERROR_NONE;
+       return FIDO_ERROR_NONE;
 }
 
 EXPORT_API int
 fido_uaf_get_response_message(const char *uaf_request_json, const char *channel_binding_json,
-                           fido_uaf_response_message_cb callback, void *user_data)
+       fido_uaf_response_message_cb callback, void *user_data)
 {
-    if (callback == NULL) {
-        _ERR("callback can not be NULL [FIDO_ERROR_INVALID_PARAMETER]");
-        return FIDO_ERROR_INVALID_PARAMETER;
-    }
-    if (uaf_request_json == NULL) {
-        _ERR("uaf_request_json can not be NULL [FIDO_ERROR_INVALID_PARAMETER]");
-        return FIDO_ERROR_INVALID_PARAMETER;
-    }
-
-    Fido *dbus_proxy = _dbus_proxy_get_instance(_DBUS_TIMEOUT_INFINITE);
-    if (dbus_proxy == NULL) {
-        _ERR("DBus proxy failed");
-        return FIDO_ERROR_NOT_SUPPORTED;
-    }
-
-    _fido_process_cb_data_s *cb_data = (_fido_process_cb_data_s *) calloc(1, sizeof(_fido_process_cb_data_s));
-    cb_data->cb = callback;
-    cb_data->user_data = user_data;
-
-    if (channel_binding_json != NULL) {
+       if (callback == NULL) {
+               _ERR("callback can not be NULL [FIDO_ERROR_INVALID_PARAMETER]");
+               return FIDO_ERROR_INVALID_PARAMETER;
+       }
+       if (uaf_request_json == NULL) {
+               _ERR("uaf_request_json can not be NULL [FIDO_ERROR_INVALID_PARAMETER]");
+               return FIDO_ERROR_INVALID_PARAMETER;
+       }
+
+       Fido *dbus_proxy = _dbus_proxy_get_instance(_DBUS_TIMEOUT_INFINITE);
+       if (dbus_proxy == NULL) {
+               _ERR("DBus proxy failed");
+               return FIDO_ERROR_NOT_SUPPORTED;
+       }
+
+       _fido_process_cb_data_s *cb_data = (_fido_process_cb_data_s *) calloc(1, sizeof(_fido_process_cb_data_s));
+       cb_data->cb = callback;
+       cb_data->user_data = user_data;
+
+       if (channel_binding_json != NULL) {
                fido_call_fido_uaf_process_operation(dbus_proxy, uaf_request_json, channel_binding_json,
-                                             NULL, _fido_uaf_process_operation_reply, cb_data);
-    }
-    else {
+                       NULL, _fido_uaf_process_operation_reply, cb_data);
+       } else {
                fido_call_fido_uaf_process_operation(dbus_proxy, uaf_request_json,
-                                                                                        _FIDO_NO_CHANNEL_BINDING_DBUS_STRING,
-                                             NULL, _fido_uaf_process_operation_reply, cb_data);
+                       _FIDO_NO_CHANNEL_BINDING_DBUS_STRING, NULL, _fido_uaf_process_operation_reply, cb_data);
        }
 
-    return FIDO_ERROR_NONE;
+       return FIDO_ERROR_NONE;
 }
 
 EXPORT_API int
 fido_uaf_set_server_result(int response_code, const char *uaf_response_json)
 {
-    if (uaf_response_json == NULL) {
-        _ERR("uaf_response_json can not be NULL [FIDO_ERROR_INVALID_PARAMETER]");
-        return FIDO_ERROR_INVALID_PARAMETER;
-    }
-
-    Fido *dbus_proxy = _dbus_proxy_get_instance(_DBUS_TIMEOUT_USE_DEFAULT);
-    if (dbus_proxy == NULL) {
-        _ERR("DBus proxy failed");
-        return FIDO_ERROR_NOT_SUPPORTED;
-    }
+       if (uaf_response_json == NULL) {
+               _ERR("uaf_response_json can not be NULL [FIDO_ERROR_INVALID_PARAMETER]");
+               return FIDO_ERROR_INVALID_PARAMETER;
+       }
 
-    GError *dbus_err = NULL;
+       Fido *dbus_proxy = _dbus_proxy_get_instance(_DBUS_TIMEOUT_USE_DEFAULT);
+       if (dbus_proxy == NULL) {
+               _ERR("DBus proxy failed");
+               return FIDO_ERROR_NOT_SUPPORTED;
+       }
 
-    int tizen_error_code = FIDO_ERROR_NONE;
+       GError *dbus_err = NULL;
 
-    _response_t *uaf_res_data = _uaf_parser_parse_uaf_response(uaf_response_json);
-    if (uaf_res_data == NULL)
-        return FIDO_ERROR_PROTOCOL_ERROR;
+       int tizen_error_code = FIDO_ERROR_NONE;
 
-    if (response_code == FIDO_SERVER_STATUS_CODE_OK) {
-        _free_response(uaf_res_data);
-        return FIDO_ERROR_NONE;
-    }
+       _response_t *uaf_res_data = _uaf_parser_parse_uaf_response(uaf_response_json);
+       if (uaf_res_data == NULL)
+               return FIDO_ERROR_PROTOCOL_ERROR;
 
+       if (response_code == FIDO_SERVER_STATUS_CODE_OK) {
+               _free_response(uaf_res_data);
+               return FIDO_ERROR_NONE;
+       }
 
-    _INFO("before checking operation name");
-    if (strcmp(uaf_res_data->header->operation, _UAF_OPERATION_NAME_KEY_REG) != 0) {
-        _free_response(uaf_res_data);
-        return FIDO_ERROR_NONE;
-    }
+       _INFO("before checking operation name");
+       if (strcmp(uaf_res_data->header->operation, _UAF_OPERATION_NAME_KEY_REG) != 0) {
+               _free_response(uaf_res_data);
+               return FIDO_ERROR_NONE;
+       }
 
-    /*Only for reg response, if not success code, then delete the reg*/
+       /*Only for reg response, if not success code, then delete the reg*/
 
-    _INFO("before calling _uaf_composer_compose_dereg_request");
-    char *uaf_dereg_json = _uaf_composer_compose_dereg_request(uaf_res_data);
+       _INFO("before calling _uaf_composer_compose_dereg_request");
+       char *uaf_dereg_json = _uaf_composer_compose_dereg_request(uaf_res_data);
 
-    _free_response(uaf_res_data);
+       _free_response(uaf_res_data);
 
-    if (uaf_dereg_json == NULL)
-        return FIDO_ERROR_PROTOCOL_ERROR;
+       if (uaf_dereg_json == NULL)
+       return FIDO_ERROR_PROTOCOL_ERROR;
 
-    int tz_err = FIDO_ERROR_NONE;
-    char *resp = 0;
+       int tz_err = FIDO_ERROR_NONE;
+       char *resp = 0;
 
-    GError *err = NULL;
-       gboolean is_success = fido_call_fido_uaf_process_operation_sync(dbus_proxy,
-                                                                                                                                       uaf_dereg_json,
-                                                                    _FIDO_NO_CHANNEL_BINDING_DBUS_STRING, &tz_err,
-                                                                    &resp, NULL, &err);
+       GError *err = NULL;
+       gboolean is_success = fido_call_fido_uaf_process_operation_sync(dbus_proxy, uaf_dereg_json,
+                                                       _FIDO_NO_CHANNEL_BINDING_DBUS_STRING,
+                                                       &tz_err, &resp, NULL, &err);
 
-    if (is_success == FALSE) {
-        _ERR("fido_call_fido_uaf_notify_result_sync failed [%d]", tizen_error_code);
-        if (dbus_err) {
-            _ERR("GError = [%s]", dbus_err->message);
-        }
-        return FIDO_ERROR_PROTOCOL_ERROR;
-    }
+       if (is_success == FALSE) {
+               _ERR("fido_call_fido_uaf_notify_result_sync failed [%d]", tizen_error_code);
+               if (dbus_err) {
+                       _ERR("GError = [%s]", dbus_err->message);
+               }
+               return FIDO_ERROR_PROTOCOL_ERROR;
+       }
 
-    return tz_err;
+       return tz_err;
 }
index a54a108..db71da0 100644 (file)
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <node name="/org/tizen/dummyasm">
-  <interface name="org.tizen.dummyasm">
-    <method name="asm_request">
-      <arg type="s" name="uaf_request_json" direction="in" />
-      <arg type="i" name="tizen_error_code" direction="out" />
-      <arg type="s" name="uaf_response_json" direction="out" />
-    </method>
-  </interface>
+       <interface name="org.tizen.dummyasm">
+       <method name="asm_request">
+               <arg type="s" name="uaf_request_json" direction="in" />
+               <arg type="i" name="tizen_error_code" direction="out" />
+               <arg type="s" name="uaf_response_json" direction="out" />
+       </method>
+       </interface>
 </node>
index 912ad15..6b8b56d 100644 (file)
@@ -1,35 +1,35 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <node name="/org/tizen/fido">
-  <interface name="org.tizen.fido">
-    <method name="fido_uaf_init">
-      <arg type="i" name="tizen_error_code" direction="out" />
-    </method>
-    <method name="fido_uaf_deinit">
-      <arg type="i" name="tizen_error_code" direction="out" />
-    </method>
-    <method name="fido_uaf_discover">
-      <arg type="i" name="tizen_error_code" direction="out" />
-      <arg type="as" name="asm_response_list" direction="out" />
-      <arg type="i" name="data_len" direction="out" />
-    </method>
-    <method name="fido_uaf_check_policy">
-      <arg type="s" name="uaf_message_json" direction="in" />
-      <arg type="i" name="tizen_error_code" direction="out" />
-    </method>
-    <method name="fido_uaf_process_operation">
-      <arg type="s" name="uaf_request_json" direction="in" />
-      <arg type="s" name="channel_binding_json" direction="in" />
-      <arg type="i" name="tizen_error_code" direction="out" />
-      <arg type="s" name="uaf_response_json" direction="out" />
-    </method>
-    <method name="fido_uaf_notify_result">
-      <arg type="i" name="respose_code" direction="in" />
-      <arg type="s" name="uaf_response_json" direction="in" />
-      <arg type="i" name="tizen_error_code" direction="out" />
-    </method>
-    <method name="ui_response">
-      <arg type="i" name="error" direction="in" />
-      <arg type="s" name="ui_response_json" direction="in" />
-    </method>
-  </interface>
+       <interface name="org.tizen.fido">
+               <method name="fido_uaf_init">
+                       <arg type="i" name="tizen_error_code" direction="out" />
+               </method>
+               <method name="fido_uaf_deinit">
+                       <arg type="i" name="tizen_error_code" direction="out" />
+               </method>
+               <method name="fido_uaf_discover">
+                       <arg type="i" name="tizen_error_code" direction="out" />
+                       <arg type="as" name="asm_response_list" direction="out" />
+                       <arg type="i" name="data_len" direction="out" />
+               </method>
+               <method name="fido_uaf_check_policy">
+                       <arg type="s" name="uaf_message_json" direction="in" />
+                       <arg type="i" name="tizen_error_code" direction="out" />
+               </method>
+               <method name="fido_uaf_process_operation">
+                       <arg type="s" name="uaf_request_json" direction="in" />
+                       <arg type="s" name="channel_binding_json" direction="in" />
+                       <arg type="i" name="tizen_error_code" direction="out" />
+                       <arg type="s" name="uaf_response_json" direction="out" />
+               </method>
+               <method name="fido_uaf_notify_result">
+                       <arg type="i" name="respose_code" direction="in" />
+                       <arg type="s" name="uaf_response_json" direction="in" />
+                       <arg type="i" name="tizen_error_code" direction="out" />
+               </method>
+               <method name="ui_response">
+                       <arg type="i" name="error" direction="in" />
+                       <arg type="s" name="ui_response_json" direction="in" />
+               </method>
+       </interface>
 </node>
index 914e66e..22baaa1 100644 (file)
 int
 _fido_b64url_encode(const unsigned char *input,  int inlen, unsigned char *output, int *outlen)
 {
-    _INFO("_fido_b64url_encode start");
-
-    BIO * bmem = NULL;
-    BIO * b64 = NULL;
-    BUF_MEM * bptr = NULL;
-    b64 = BIO_new(BIO_f_base64());
-    if(b64 == NULL) {
-        _ERR("BIO_new with BIO_f_base64 failed ");
-        return -1;
-    }
-
-    BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
-
-    bmem = BIO_new(BIO_s_mem());
-    b64 = BIO_push(b64, bmem);
-    BIO_write(b64, input, inlen);
-    BIO_flush(b64);
-    BIO_get_mem_ptr(b64, &bptr);
-
-    memcpy(output, bptr->data, bptr->length);
-    output[bptr->length] = 0;
-    *outlen = bptr->length;
-
-    int i;
-    for(i =0; i < *outlen ; i++) {
-        if(output[i] == '+')
-            output[i] = '-';
-
-        else if(output[i] == '/')
-            output[i] = '_';
-
-        else if(output[i] == '=') {
-            *outlen = i ;
-            output[i] = '\0';
-            break;
-        }
-    }
-
-    BIO_free_all(b64);
-
-    _INFO("%s", output);
-    _INFO("_fido_b64url_encode end");
-
-    return 0;
+       _INFO("_fido_b64url_encode start");
+
+       BIO * bmem = NULL;
+       BIO * b64 = NULL;
+       BUF_MEM * bptr = NULL;
+       b64 = BIO_new(BIO_f_base64());
+       if(b64 == NULL) {
+               _ERR("BIO_new with BIO_f_base64 failed ");
+               return -1;
+       }
+
+       BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
+
+       bmem = BIO_new(BIO_s_mem());
+       b64 = BIO_push(b64, bmem);
+       BIO_write(b64, input, inlen);
+       BIO_flush(b64);
+       BIO_get_mem_ptr(b64, &bptr);
+
+       memcpy(output, bptr->data, bptr->length);
+       output[bptr->length] = 0;
+       *outlen = bptr->length;
+
+       int i;
+       for(i =0; i < *outlen ; i++) {
+               if(output[i] == '+')
+                       output[i] = '-';
+
+               else if(output[i] == '/')
+                       output[i] = '_';
+
+               else if(output[i] == '=') {
+                       *outlen = i ;
+                       output[i] = '\0';
+               break;
+               }
+       }
+
+       BIO_free_all(b64);
+
+       _INFO("%s", output);
+       _INFO("_fido_b64url_encode end");
+
+       return 0;
 }
 
 int
-_fido_b64url_decode(const unsigned char *in,  int inlen,
-                        unsigned char *out, int *outlen)
+_fido_b64url_decode(const unsigned char *in,  int inlen, unsigned char *out, int *outlen)
 {
-    _INFO("_fido_b64url_decode start");
-
-    int npadChars = (inlen %4) == 0 ? 0 : (4 - (inlen%4));
-    unsigned char *base64 = (unsigned char *) malloc(inlen + npadChars);
-    if(base64 == NULL) {
-        _ERR("malloc failed");
-        return -1;
-    }
-
-    memcpy(base64, in, inlen);
-
-    int i;
-    for(i =0; i < inlen ; i++) {
-        if(base64[i] == '-')
-            base64[i] = '+';
-
-        else if(base64[i] == '_')
-            base64[i] = '/';
-
-    }
-
-    if(npadChars != 0)
-        memset(base64 + inlen, '=', npadChars);
-
-    BIO * b64 = NULL;
-    BIO * bmem = NULL;
-    b64 = BIO_new(BIO_f_base64());
-    if(b64 == NULL) {
-        _ERR("BIO_new with BIO_f_base64 failed");
-
-        SAFE_DELETE(base64);
-        return -1;
-    }
-    BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
-    bmem = BIO_new_mem_buf(base64, inlen);
-    if(bmem == NULL) {
-        _ERR("BIO_new_mem_buf failed");
-
-        SAFE_DELETE(base64);
-        return -1;
-    }
-
-    bmem = BIO_push(b64, bmem);
-    *outlen = BIO_read(bmem, out, inlen);
-    if(*outlen <= 0) {
-        _ERR("BIO_read failed");
-
-        SAFE_DELETE(base64);
-        return -1;
-    }
-
-    if(bmem)
-        BIO_free_all(bmem);
-
-    _INFO("_fido_b64url_decode end");
-
-    return 0;
+       _INFO("_fido_b64url_decode start");
+
+       int npadChars = (inlen %4) == 0 ? 0 : (4 - (inlen%4));
+       unsigned char *base64 = (unsigned char *) malloc(inlen + npadChars);
+       if(base64 == NULL) {
+       _ERR("malloc failed");
+       return -1;
+       }
+
+       memcpy(base64, in, inlen);
+
+       int i;
+       for (i = 0; i < inlen ; i++) {
+               if (base64[i] == '-')
+                       base64[i] = '+';
+
+               else if (base64[i] == '_')
+                       base64[i] = '/';
+       }
+
+       if (npadChars != 0)
+               memset(base64 + inlen, '=', npadChars);
+
+       BIO * b64 = NULL;
+       BIO * bmem = NULL;
+       b64 = BIO_new(BIO_f_base64());
+       if (b64 == NULL) {
+               _ERR("BIO_new with BIO_f_base64 failed");
+
+               SAFE_DELETE(base64);
+               return -1;
+       }
+       BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
+       bmem = BIO_new_mem_buf(base64, inlen);
+       if (bmem == NULL) {
+               _ERR("BIO_new_mem_buf failed");
+
+               SAFE_DELETE(base64);
+               return -1;
+       }
+
+       bmem = BIO_push(b64, bmem);
+       *outlen = BIO_read(bmem, out, inlen);
+       if (*outlen <= 0) {
+               _ERR("BIO_read failed");
+
+               SAFE_DELETE(base64);
+               return -1;
+       }
+
+       if (bmem)
+               BIO_free_all(bmem);
+
+       _INFO("_fido_b64url_decode end");
+
+       return 0;
 }
index e6f290e..8109920 100644 (file)
 #include "fido_uaf_types.h"
 
 #define RET_IF_FAIL_VOID(cond) do {\
-        if (!(cond)){\
-            return;\
-        }\
-} while(0)
+       if (!(cond)) {\
+               return;\
+       \
+} while (0)
 
 #define RET_IF_FAIL(cond, err) do {\
-        if (!(cond)){\
-            return err;\
-        }\
-} while(0)
+       if (!(cond)) {\
+               return err;\
+       \
+} while (0)
 
 #define CATCH_IF_FAIL(cond) do {\
-        if (!(cond)){\
-            goto CATCH;\
-        }\
-} while(0)
+       if (!(cond)) {\
+               goto CATCH;\
+       \
+} while (0)
 
 #define CATCH_IF_FAIL_X(cond, expr) do {\
-        if (!(cond)){\
-            expr;\
-            goto CATCH;\
-        }\
-} while(0)
+       if (!(cond)) {\
+               expr;\
+               goto CATCH;\
+       \
+} while (0)
 
 #define GOTO_IF_FAIL(cond, catch_block) do {\
-        if (!(cond)){\
-            goto catch_block;\
-        }\
-} while(0)
+       if (!(cond)) {\
+       goto catch_block;\
+       \
+} while (0)
 
 #define SAFE_DELETE(x) do {\
-    if (x != NULL) {\
-        free(x);    \
-        x = NULL;\
-    }\
-} while(0)
+       if (x != NULL) {\
+       free(x);    \
+       x = NULL;\
+       } \
+} while (0)
 
 #define _SAFE_DUP(x) ((x) ? strdup(x) : NULL)
 
  *  @since_tizen 3.0
  */
 typedef struct _fido_version_s {
-    int major;/** Major version **/
-    int minor;/** Minor version **/
+       int major;/** Major version **/
+       int minor;/** Minor version **/
 } fido_version_s;
 
 typedef struct _fido_rgb_pallette_entry_s {
-    unsigned short r;/** Red component**/
-    unsigned short g;/** Green component**/
-    unsigned short b;/** Blue component**/
+       unsigned short r;/** Red component**/
+       unsigned short g;/** Green component**/
+       unsigned short b;/** Blue component**/
 } fido_rgb_pallette_entry_s;
 
 typedef struct  _fido_display_png_characteristics_descriptor_s {
-    unsigned long width;/** Width**/
-    unsigned long height;/** Height**/
-    uint8_t    bit_depth;/** Bit depth**/
-    uint8_t color_type;/** Color type**/
-    uint8_t compression;/** Compression**/
-    uint8_t filter;/** Filter**/
-    uint8_t interlace;/** Interlace**/
-    GList *plte;/** Pallete entry list of type @c List of @c fido_rgb_pallette_entry_t elements **/
+       unsigned long width;/** Width**/
+       unsigned long height;/** Height**/
+       uint8_t bit_depth;/** Bit depth**/
+       uint8_t color_type;/** Color type**/
+       uint8_t compression;/** Compression**/
+       uint8_t filter;/** Filter**/
+       uint8_t interlace;/** Interlace**/
+       GList *plte;/** Pallete entry list of type @c List of @c fido_rgb_pallette_entry_t elements **/
 } fido_display_png_characteristics_descriptor_s;
 
 void _free_display_png_characteristics_descriptor(fido_display_png_characteristics_descriptor_s *data);
 
-
 /* UAF API structures end */
 
-
 typedef struct _version {
-    int major;
-    int minor;
+       int major;
+       int minor;
 } _version_t;
 
 typedef struct _extension {
-    char *id;
-    char *data;
-    bool fail_if_unknown;
+       char *id;
+       char *data;
+       bool fail_if_unknown;
 } _extension_t;
 
 void _free_extension(_extension_t *data);
 
 typedef struct _match_criteria {
-    GList *aaid_list;
-    GList *vendor_list;
-    GList *key_id_list;
-    long long int user_verification;
-    int key_protection;
-    int matcher_protection;
-    long long int attachement_hint;
-    int tc_display;
-    GList *auth_algo_list;
-    GList *assertion_scheme_list;
-    GList *attestation_type_list;
-    int auth_version;
-    GList *extension_list;
+       GList *aaid_list;
+       GList *vendor_list;
+       GList *key_id_list;
+       long long int user_verification;
+       int key_protection;
+       int matcher_protection;
+       long long int attachement_hint;
+       int tc_display;
+       GList *auth_algo_list;
+       GList *assertion_scheme_list;
+       GList *attestation_type_list;
+       int auth_version;
+       GList *extension_list;
 
 } _match_criteria_t;
 
 void _free_match_criteria(_match_criteria_t *data);
 
 typedef struct _policy {
-    GList *accepted_list;//2d array
-    GList *disallowed_list;
-    bool is_keyid_present; /*Only call GetRegistrations ASM call if atleast one match criteria contains keyIDs*/
+       GList *accepted_list;//2d array
+       GList *disallowed_list;
+       bool is_keyid_present; /*Only call GetRegistrations ASM call if atleast one match criteria contains keyIDs*/
 } _policy_t;
 
 void _free_policy(_policy_t *data);
 
 typedef struct _op_header {
-    _version_t *version;
-    char *operation;
-    char *app_id;
-    char *server_data;
-    GList *ext_list;
-}_op_header_t;
+       _version_t *version;
+       char *operation;
+       char *app_id;
+       char *server_data;
+       GList *ext_list;
+} _op_header_t;
 
 void _free_op_header(_op_header_t *data);
 
 typedef enum {
-    _MESSAGE_TYPE_MIN = -1,
-    _MESSAGE_TYPE_REG,
-    _MESSAGE_TYPE_AUTH,
-    _MESSAGE_TYPE_DEREG,
-    _MESSAGE_TYPE_MAX
-}_message_type_e;
+       _MESSAGE_TYPE_MIN = -1,
+       _MESSAGE_TYPE_REG,
+       _MESSAGE_TYPE_AUTH,
+       _MESSAGE_TYPE_DEREG,
+       _MESSAGE_TYPE_MAX
+} _message_type_e;
 
 typedef struct _message {
-    char *facet_id;
-    _op_header_t *header;
-    char *channel_binding;
-    _message_type_e type;
-    void *data;/* type can be _reg_request_t / _auth_request_t / _dereg_request_t depending on header->operation */
+       char *facet_id;
+       _op_header_t *header;
+       char *channel_binding;
+       _message_type_e type;
+       void *data;/* type can be _reg_request_t / _auth_request_t / _dereg_request_t depending on header->operation */
 } _message_t;
 
 void _free_message(_message_t *data);
@@ -176,150 +174,148 @@ typedef struct _reg_request {
 void _free_reg_request(_reg_request_t *data);
 
 typedef struct _auth_transaction {
-    char *content_type;
-    char *content;
-    fido_display_png_characteristics_descriptor_s *display_charac;
-}_auth_transaction_t;
+       char *content_type;
+       char *content;
+       fido_display_png_characteristics_descriptor_s *display_charac;
+} _auth_transaction_t;
 
 void _free_auth_transaction(_auth_transaction_t *data);
 
 typedef struct _auth_request {
-    char *challenge;
-    GList *transaction_list;
-    _policy_t *policy;
+       char *challenge;
+       GList *transaction_list;
+       _policy_t *policy;
 } _auth_request_t;
 
 void _free_auth_request(_auth_request_t *data);
 
 typedef struct _dereg_auth_info {
-    char *aaid;
-    char *key_id;
+       char *aaid;
+       char *key_id;
 } _dereg_auth_info_t;
 
 void _free_dereg_auth_info(_dereg_auth_info_t *data);
 
 typedef struct _dereg_request {
-    GList *auth_info_list;
+       GList *auth_info_list;
 } _dereg_request_t;
 
 void _free_dereg_request(_dereg_request_t *data);
 
 typedef struct _fido_asm_version {
-    int major;
-    int minor;
+       int major;
+       int minor;
 } _fido_asm_version_t;
 
-
 typedef struct _fido_asm_rgb_pallette_entry {
-    unsigned short r;
-    unsigned short g;
-    unsigned short b;
+       unsigned short r;
+       unsigned short g;
+       unsigned short b;
 } _fido_asm_rgb_pallette_entry_t;
 
-
 typedef struct  _fido_asm_display_png_characteristics_descriptor {
-    unsigned long width;
-    unsigned long height;
-    int        bit_depth;
-    int color_type;
-    int compression;
-    int filter;
-    int interlace;
-    GList *plte;
+       unsigned long width;
+       unsigned long height;
+       int     bit_depth;
+       int color_type;
+       int compression;
+       int filter;
+       int interlace;
+       GList *plte;
 } _fido_asm_display_png_characteristics_descriptor_t;
 
 void _free_asm_display_png_characteristics_descriptor_t(_fido_asm_display_png_characteristics_descriptor_t *data);
 
 typedef struct _fido_asm_proxy {
-    char *asm_id;
-    char *vendor;
-    char *bin_path;
-    char *dbus_info;
-    char *dbus_obj_path;
-    char *dbus_interface_name;
-    char *dbus_method_name;
-    GDBusProxy *dbus_proxy;
+       char *asm_id;
+       char *vendor;
+       char *bin_path;
+       char *dbus_info;
+       char *dbus_obj_path;
+       char *dbus_interface_name;
+       char *dbus_method_name;
+       GDBusProxy *dbus_proxy;
 } _fido_asm_proxy_t;
 
 void _free_fido_asm_proxy(void *data);
 
 typedef struct _asm_discover_response {
        int error_code;
-    char *asm_id;
+       char *asm_id;
        char *asm_response_json;
 } _asm_discover_response_t;
 
 void _free_asm_discover_response(_asm_discover_response_t *data);
 
 typedef struct _fido_asm_authenticator {
-    GList *supported_versions;
-    char *asm_id;
-    char *auth_index;
-    GList *key_ids;//filled up from GetRegistrations request to ASM
-    GList *asm_versions;
-    bool is_user_enrolled;
-    bool has_settings;
-    char *aaid;
-    char *assertion_scheme;
-    int authentication_algorithm;
-    GList *attestation_types;
-    unsigned long user_verification;
-    int key_protection;
-    int matcher_protection;
-    unsigned long attachment_hint;
-    bool is_second_factor_only;
-    bool is_roaming;
-    GList *supported_extension_IDs;
-    int tc_display;
-    char *tc_display_content_type;
-    GList *tc_display_png_characteristics;
-    char *title;
-    char *description;
-    char *icon;
+       GList *supported_versions;
+       char *asm_id;
+       char *auth_index;
+       GList *key_ids;//filled up from GetRegistrations request to ASM
+       GList *asm_versions;
+       bool is_user_enrolled;
+       bool has_settings;
+       char *aaid;
+       char *assertion_scheme;
+       int authentication_algorithm;
+       GList *attestation_types;
+       unsigned long user_verification;
+       int key_protection;
+       int matcher_protection;
+       unsigned long attachment_hint;
+       bool is_second_factor_only;
+       bool is_roaming;
+       GList *supported_extension_IDs;
+       int tc_display;
+       char *tc_display_content_type;
+       GList *tc_display_png_characteristics;
+       char *title;
+       char *description;
+       char *icon;
 } fido_authenticator_s;
 
 void _free_fido_asm_authenticator(fido_authenticator_s *data);
 void _free_fido_asm_authenticator_list_item(gpointer data);
 
 typedef struct _fido_asm_reg_in {
-    char *app_id;
-    char *user_name;
-    char *final_challenge;
-    int attestation_type;
-}_fido_asm_reg_in_t;
+       char *app_id;
+       char *user_name;
+       char *final_challenge;
+       int attestation_type;
+} _fido_asm_reg_in_t;
 
 void _free_fido_asm_reg_in(_fido_asm_reg_in_t *data);
 
 typedef struct _fido_asm_transaction {
-    char *content_type;
-    char *content;
-    _fido_asm_display_png_characteristics_descriptor_t *display_charac;
-}_fido_asm_transaction_t;
+       char *content_type;
+       char *content;
+       _fido_asm_display_png_characteristics_descriptor_t *display_charac;
+} _fido_asm_transaction_t;
 
 void _free_fido_asm_transaction(_fido_asm_transaction_t *data);
 
 typedef struct _fido_asm_auth_in {
-    char *app_id;
-    GList *key_ids;
-    char *final_challenge;
-    GList *trans_list;//_fido_asm_transaction_t list
-}_fido_asm_auth_in_t;
+       char *app_id;
+       GList *key_ids;
+       char *final_challenge;
+       GList *trans_list;//_fido_asm_transaction_t list
+} _fido_asm_auth_in_t;
 
 void _free_fido_asm_auth_in(_fido_asm_auth_in_t *data);
 
 typedef struct _fido_asm_dereg_in {
-    char *app_id;
-    char *key_id;
-}_fido_asm_dereg_in_t;
+       char *app_id;
+       char *key_id;
+} _fido_asm_dereg_in_t;
 
 void _free_fido_asm_dereg_in(_fido_asm_dereg_in_t *data);
 
 /* client sends list of this type to ui adaptor*/
 typedef struct _ui_auth_data {
-    char *asm_id;
-    char *auth_index;
-    char *label;
-    int att_type;
+       char *asm_id;
+       char *auth_index;
+       char *label;
+       int att_type;
 } _ui_auth_data_t;
 
 void _free_ui_auth_data(_ui_auth_data_t *data);
@@ -328,125 +324,125 @@ typedef struct _auth_reg_assertion {
        char *assertion_schm;
        char *assertion;
        GList *tc_disp_char_list;/*fido_display_png_characteristics_descriptor_s list*/
-    //GList *ext_list;
+       /*TODO : Extension */
 } _auth_reg_assertion_t;
 
 void _free_auth_reg_assertion(_auth_reg_assertion_t *data);
 void _free_auth_reg_assertion_list_item(gpointer data);
 
 typedef enum {
-    _ASM_OUT_TYPE_MIN = -1,
-    _ASM_OUT_TYPE_REG,
-    _ASM_OUT_TYPE_AUTH,
-    _ASM_OUT_TYPE_MAX
-}_asm_out_type_e;
+       _ASM_OUT_TYPE_MIN = -1,
+       _ASM_OUT_TYPE_REG,
+       _ASM_OUT_TYPE_AUTH,
+       _ASM_OUT_TYPE_MAX
+} _asm_out_type_e;
 
 typedef struct _asm_out {
-    int status_code;
-    _asm_out_type_e type;
-    void *response_data;/*type can be : _asm_reg_out_t, _asm_auth_out_t*/
-    GList *ext_list;
-}_asm_out_t;
+       int status_code;
+       _asm_out_type_e type;
+       void *response_data;/*type can be : _asm_reg_out_t, _asm_auth_out_t*/
+       GList *ext_list;
+} _asm_out_t;
 
 void _free_asm_out(_asm_out_t *data);
 
 typedef struct _asm_reg_out {
-    char *assertion;
-    char *assertion_schm;
+       char *assertion;
+       char *assertion_schm;
 } _asm_reg_out_t;
 
 void _free_asm_reg_out(_asm_reg_out_t *data);
 
 typedef struct _asm_auth_out {
-    char *assertion;
-    char *assertion_scheme;
+       char *assertion;
+       char *assertion_scheme;
 } _asm_auth_out_t;
 
 void _free_asm_auth_out(_asm_auth_out_t *data);
 
 typedef struct _matched_auth_data {
-    char *asm_id;
-    char *auth_index;
-    int att_type;
-    char *label;
-    GList *key_ids;
+       char *asm_id;
+       char *auth_index;
+       int att_type;
+       char *label;
+       GList *key_ids;
        GList *tc_display_png_characteristics;
 } _matched_auth_data_t;
 
 void _free_matched_auth_data(gpointer data);
 
 typedef struct _matched_auth_dereg {
-    char *asm_id;
-    char *auth_index;
-    char *app_id;
-    char *key_id;
+       char *asm_id;
+       char *auth_index;
+       char *app_id;
+       char *key_id;
 } _matched_auth_dereg_t;
 
 void _free_matched_auth_dereg(_matched_auth_dereg_t *data);
 
 typedef struct _asm_dereg_out {
-    int status_code; /* 0 signifies success.*/
+       int status_code; /* 0 signifies success.*/
 } _asm_dereg_out_t;
 
 typedef struct _asm_app_reg {
-    char *app_id;
-    GList *key_id_list;
+       char *app_id;
+       GList *key_id_list;
 } _asm_app_reg_t;
 
 void _free_asm_app_reg(_asm_app_reg_t *data);
 
 typedef struct _asm_get_reg_out {
-    int status_code;
-    GList *app_reg_list;/*_asm_app_reg_t list*/
+       int status_code;
+       GList *app_reg_list;/*_asm_app_reg_t list*/
 } _asm_get_reg_out_t;
 
 void _free_asm_get_reg_out(_asm_get_reg_out_t *data);
 
 typedef struct _dereg_q {
-    GQueue *dereg_asm_in_q;
-    void *cb_data;
+       GQueue *dereg_asm_in_q;
+       void *cb_data;
 } _dereg_q_t;
 
 typedef void (*_fido_discover_asm_cb) (int tz_error_code, int fido_error_code, GList *asm_auth_info_list, void *user_data);
 
 typedef struct __attribute__((packed)) _tlv {
-    uint16_t type;
-    uint16_t len;
-    uint8_t *val;
+       uint16_t type;
+       uint16_t len;
+       uint8_t *val;
 } _tlv_t;
 
 void _free_tlv(_tlv_t *data);
 
 typedef struct _auth_reg_assertion_tlv {
-    char *aaid;
-    unsigned char *key_id;
-    int key_id_len;
-}_auth_reg_assertion_tlv_t;
+       char *aaid;
+       unsigned char *key_id;
+       int key_id_len;
+} _auth_reg_assertion_tlv_t;
 
 void _free_auth_reg_assertion_tlv(_auth_reg_assertion_tlv_t *data);
 
 typedef struct _response_ {
-    _op_header_t *header;
-    char *fcp;
-    GList *assertion_list;
-}_response_t;
+       _op_header_t *header;
+       char *fcp;
+       GList *assertion_list;
+} _response_t;
 
 void _free_response(_response_t *data);
 
 typedef enum {
-    _DBUS_OP_TYPE_INIT,
-    _DBUS_OP_TYPE_DE_INIT,
-    _DBUS_OP_TYPE_DISCOVER,
-    _DBUS_OP_TYPE_CHECK_POLICY,
-    _DBUS_OP_TYPE_PROCESS,
-    _DBUS_OP_TYPE_NOTIFY
+       _DBUS_OP_TYPE_INIT,
+       _DBUS_OP_TYPE_DE_INIT,
+       _DBUS_OP_TYPE_DISCOVER,
+       _DBUS_OP_TYPE_CHECK_POLICY,
+       _DBUS_OP_TYPE_PROCESS,
+       _DBUS_OP_TYPE_NOTIFY
 } _dbus_op_type_e;
 
 typedef enum {
-    _ASM_STATUS_OK = 0x00,
-    _ASM_STATUS_ERROR = 0x01,
-    _ASM_STATUS_ACCESS_DENIED = 0x02,
-    _ASM_STATUS_USER_CANCELLED = 0x03
+       _ASM_STATUS_OK = 0x00,
+       _ASM_STATUS_ERROR = 0x01,
+       _ASM_STATUS_ACCESS_DENIED = 0x02,
+       _ASM_STATUS_USER_CANCELLED = 0x03
 } _asm_status_e;
 
 void _free_tc_disp_png_char(gpointer data);
index 9b1e629..2a15d60 100644 (file)
 #include <tizen.h>
 
 typedef enum {
-    _USER_VER_METHOD_MIN = -1,
-    _USER_VER_METHOD_PRESENCE = 0X01,
-    _USER_VER_METHOD_FINGERPRINT = 0X02,
-    _USER_VER_METHOD_PASSCODE = 0X04,
-    _USER_VER_METHOD_VOICE_PRINT = 0X08,
-    _USER_VER_METHOD_FACE_PRINT = 0X10,
-    _USER_VER_METHOD_LOCATION = 0X20,
-    _USER_VER_METHOD_EYE_PRINT = 0X40,
-    _USER_VER_METHOD_PATTERN = 0X80,
-    _USER_VER_METHOD_HAND_PRINT = 0X100,
-    _USER_VER_METHOD_NONE = 0X200,
-    _USER_VER_METHOD_ALL = 0X400,
-    _USER_VER_METHOD_MAX
-}_user_verification_method_e;
+       _USER_VER_METHOD_MIN = -1,
+       _USER_VER_METHOD_PRESENCE = 0X01,
+       _USER_VER_METHOD_FINGERPRINT = 0X02,
+       _USER_VER_METHOD_PASSCODE = 0X04,
+       _USER_VER_METHOD_VOICE_PRINT = 0X08,
+       _USER_VER_METHOD_FACE_PRINT = 0X10,
+       _USER_VER_METHOD_LOCATION = 0X20,
+       _USER_VER_METHOD_EYE_PRINT = 0X40,
+       _USER_VER_METHOD_PATTERN = 0X80,
+       _USER_VER_METHOD_HAND_PRINT = 0X100,
+       _USER_VER_METHOD_NONE = 0X200,
+       _USER_VER_METHOD_ALL = 0X400,
+       _USER_VER_METHOD_MAX
+} _user_verification_method_e;
 
 #define _UAF_OPERATION_NAME_KEY_REG "Reg"
 
index c84b2a4..5060fe9 100644 (file)
 static _tlv_t*
 __get_tlv_pack_by_type(const guchar *tlv_buffer_in, uint16_t type_in, int max_len_in)
 {
-    //_INFO("__get_tlv_pack_by_type [%u]", type_in);
+       //_INFO("__get_tlv_pack_by_type [%u]", type_in);
 
-    int i = 0;
+       int i = 0;
 
-    while (1) {
-        uint16_t lb = tlv_buffer_in[i + 0];
-        uint16_t  hb = tlv_buffer_in[i + 1];
+       while (1) {
+               uint16_t lb = tlv_buffer_in[i + 0];
+               uint16_t  hb = tlv_buffer_in[i + 1];
 
-        uint16_t val = hb << 8;
-        val = val | lb;
+               uint16_t val = hb << 8;
+               val = val | lb;
 
-        uint16_t type = val;
+               uint16_t type = val;
 
-        lb = 0;
-        hb = 0;
-        val = 0;
+               lb = 0;
+               hb = 0;
+               val = 0;
 
-        lb = tlv_buffer_in[i + 2];
-        hb = tlv_buffer_in[i + 3];
+               lb = tlv_buffer_in[i + 2];
+               hb = tlv_buffer_in[i + 3];
 
-        val = hb << 8;
-        val = val | lb;
+               val = hb << 8;
+               val = val | lb;
 
-        uint16_t length = val;
+               uint16_t length = val;
 
-        if (type == type_in) {
-            _tlv_t *tlv = (_tlv_t*)calloc(1, sizeof(_tlv_t));
-            tlv->type = type;
-            tlv->len = length;
-            if (tlv->len > 0) {
-                tlv->val = (uint8_t *)calloc(1, tlv->len);
-                memcpy(tlv->val, tlv_buffer_in + i + 2 + 2, tlv->len);
-            }
-            //_INFO("Found key");
-            return tlv;
-        }
+               if (type == type_in) {
+                       _tlv_t *tlv = (_tlv_t*)calloc(1, sizeof(_tlv_t));
+                       tlv->type = type;
+                       tlv->len = length;
+                       if (tlv->len > 0) {
+                               tlv->val = (uint8_t *)calloc(1, tlv->len);
+                               memcpy(tlv->val, tlv_buffer_in + i + 2 + 2, tlv->len);
+                       }
+                       //_INFO("Found key");
+                       return tlv;
+               }
 
-        i += 2 + 2 + length;
-        if (i >= max_len_in)
-            break;
-    }
+               i += 2 + 2 + length;
+               if (i >= max_len_in)
+                       break;
+       }
 
-    return NULL;
+       return NULL;
 }
 
 
index 65c2312..a6977c1 100755 (executable)
@@ -46,24 +46,20 @@ typedef struct fido_authenticator_s* fido_authenticator_h;
  *  @brief    Enumerations of error codes for FIDO APIs.
  *  @since_tizen 3.0
  */
-typedef enum
-{
-    FIDO_ERROR_NONE                  = TIZEN_ERROR_NONE,                   /**< Successful. */
-    FIDO_ERROR_OUT_OF_MEMORY             = TIZEN_ERROR_OUT_OF_MEMORY,              /**< Out of memory. */
-    FIDO_ERROR_INVALID_PARAMETER         = TIZEN_ERROR_INVALID_PARAMETER,        /**< Invalid parameter. */
-    FIDO_ERROR_NO_DATA  = TIZEN_ERROR_NO_DATA, /**< Empty data. */
-    FIDO_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission Denied. */
-
-    FIDO_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< FIDO is unsupported. */
-    FIDO_ERROR_USER_ACTION_IN_PROGRESS = TIZEN_ERROR_FIDO | 0x01, /**< User action is in progress. */
-    FIDO_ERROR_USER_CANCELLED = TIZEN_ERROR_FIDO | 0x02, /**< User has canceled the operation. */
-    FIDO_ERROR_UNSUPPORTED_VERSION = TIZEN_ERROR_FIDO | 0x03, /**< UAF message's version is not supported. */
-    FIDO_ERROR_NO_SUITABLE_AUTHENTICATOR = TIZEN_ERROR_FIDO | 0x04, /**< No suitable authenticators found. */
-    FIDO_ERROR_PROTOCOL_ERROR = TIZEN_ERROR_FIDO | 0x05, /**< Protocol error, the interaction may have timed out, or
-                                                              the UAF message is malformed. */
-    FIDO_ERROR_UNTRUSTED_FACET_ID = TIZEN_ERROR_FIDO | 0x06, /**< The caller's id is not allowed to use this operation. */
-    FIDO_ERROR_UNKNOWN = TIZEN_ERROR_UNKNOWN /**< Unknown system error.*/
-
+typedef enum {
+       FIDO_ERROR_NONE                  = TIZEN_ERROR_NONE,                   /**< Successful. */
+       FIDO_ERROR_OUT_OF_MEMORY             = TIZEN_ERROR_OUT_OF_MEMORY,              /**< Out of memory. */
+       FIDO_ERROR_INVALID_PARAMETER         = TIZEN_ERROR_INVALID_PARAMETER,        /**< Invalid parameter. */
+       FIDO_ERROR_NO_DATA  = TIZEN_ERROR_NO_DATA, /**< Empty data. */
+       FIDO_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission Denied. */
+       FIDO_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< FIDO is unsupported. */
+       FIDO_ERROR_USER_ACTION_IN_PROGRESS = TIZEN_ERROR_FIDO | 0x01, /**< User action is in progress. */
+       FIDO_ERROR_USER_CANCELLED = TIZEN_ERROR_FIDO | 0x02, /**< User has canceled the operation. */
+       FIDO_ERROR_UNSUPPORTED_VERSION = TIZEN_ERROR_FIDO | 0x03, /**< UAF message's version is not supported. */
+       FIDO_ERROR_NO_SUITABLE_AUTHENTICATOR = TIZEN_ERROR_FIDO | 0x04, /**< No suitable authenticators found. */
+       FIDO_ERROR_PROTOCOL_ERROR = TIZEN_ERROR_FIDO | 0x05, /**< Protocol error, the interaction may have timed out, or the UAF message is malformed. */
+       FIDO_ERROR_UNTRUSTED_FACET_ID = TIZEN_ERROR_FIDO | 0x06, /**< The caller's id is not allowed to use this operation. */
+       FIDO_ERROR_UNKNOWN = TIZEN_ERROR_UNKNOWN /**< Unknown system error.*/
 } fido_error_e;
 
 /**
@@ -71,8 +67,7 @@ typedef enum
  *  @remarks Refer to FIDO UAF Registry document for more details.
  *  @since_tizen 3.0
  */
-typedef enum
-{
+typedef enum {
        FIDO_AUTH_ALGO_SECP256R1_ECDSA_SHA256_RAW = 0X01, /**< SECP256R1 ECDSA SHA256 Raw */
        FIDO_AUTH_ALGO_SECP256R1_ECDSA_SHA256_DER = 0X02, /**< SECP256R1 ECDSA SHA256 DER*/
        FIDO_AUTH_ALGO_RSASSA_PSS_SHA256_RAW = 0x03, /**< RSA PSS SHA256 Raw*/
@@ -86,8 +81,7 @@ typedef enum
  *  @remarks Refer to FIDO UAF Registry document for more details.
  *  @since_tizen 3.0
  */
-typedef enum
-{
+typedef enum {
        FIDO_AUTH_ATT_TYPE_BASIC_FULL = 0x3E07, /**< Full basic attestation. */
        FIDO_AUTH_ATT_TYPE_BASIC_SURROGATE = 0x3E08 /**< Surrogate basic attestation. */
 } fido_auth_attestation_type_e;
@@ -97,8 +91,7 @@ typedef enum
  *  @remarks Refer to FIDO UAF Registry document for more details.
  *  @since_tizen 3.0
  */
-typedef enum
-{
+typedef enum {
        FIDO_AUTH_USR_VERIFY_TYPE_PRESENCE = 0x01, /**< User presence verification. */
        FIDO_AUTH_USR_VERIFY_TYPE_FINGERPRINT = 0x02, /**< User fingerprint verification. */
        FIDO_AUTH_USR_VERIFY_TYPE_PASSCODE = 0x04, /**< User passcode verification. */
@@ -122,15 +115,14 @@ typedef enum
  *  @remarks Refer to FIDO UAF Registry document for more details.
  *  @since_tizen 3.0
  */
-typedef enum
-{
+typedef enum {
        FIDO_AUTH_KEY_PROT_TYPE_SOFTWARE = 0x01, /**< Software based key management. */
        FIDO_AUTH_KEY_PROT_TYPE_HARDWARE = 0x02, /**< Hardware based key management. */
        FIDO_AUTH_KEY_PROT_TYPE_TEE = 0x04, /**< Trusted Execution Environment based key management. */
        FIDO_AUTH_KEY_PROT_TYPE_SECURE_ELEMENT = 0x08, /**< Secure Element based key management. */
        FIDO_AUTH_KEY_PROT_TYPE_REMOTE_HANDLE  = 0x10 /**< Authenticator does not store (wrapped) UAuth keys at the client,
-                                                                                                  * but relies on a server-provided key handle.
-                                                                                                  */
+                                                                                                       * but relies on a server-provided key handle.
+                                                                                                       */
 } fido_auth_key_protection_type_e;
 
 /**
@@ -138,8 +130,7 @@ typedef enum
  *  @remarks Refer to FIDO UAF Registry document for more details.
  *  @since_tizen 3.0
  */
-typedef enum
-{
+typedef enum {
        FIDO_AUTH_MATCH_PROT_TYPE_SOFTWARE = 0x01, /**< Authenticator's matcher is running in software. */
        FIDO_AUTH_MATCH_PROT_TYPE_TEE = 0x02, /**< Authenticator's matcher is running inside the Trusted Execution Environment. */
        FIDO_AUTH_MATCH_PROT_TYPE_ON_CHIP  = 0x04 /**< Aauthenticator's matcher is running on the chip. */
@@ -150,8 +141,7 @@ typedef enum
  *  @remarks Refer to FIDO UAF Registry document for more details.
  *  @since_tizen 3.0
  */
-typedef enum
-{
+typedef enum {
        FIDO_AUTH_ATTACH_HINT_INTERNAL = 0x01, /**< Authenticator is permanently attached to the FIDO User Device. */
        FIDO_AUTH_ATTACH_HINT_EXTERNAL = 0x02, /**< Authenticator is removable or remote from the FIDO User Device. */
        FIDO_AUTH_ATTACH_HINT_WIRED = 0x04, /**< The external authenticator currently has an exclusive wired connection. */
@@ -160,12 +150,12 @@ typedef enum
        FIDO_AUTH_ATTACH_HINT_NFC = 0x10, /**< Authenticator is able to communicate by NFC to the FIDO User Device. */
        FIDO_AUTH_ATTACH_HINT_BT = 0x20, /**< Authenticator is able to communicate by Bluetooth to the FIDO User Device. */
        FIDO_AUTH_ATTACH_HINT_NW = 0x40, /**< Authenticator is connected to the FIDO User Device ver a non-exclusive network
-                                                                         * (e.g. over a TCP/IP LAN or WAN, as opposed to a PAN or point-to-point connection).
-                                                                         */
+                                                                               * (e.g. over a TCP/IP LAN or WAN, as opposed to a PAN or point-to-point connection).
+                                                                               */
        FIDO_AUTH_ATTACH_HINT_READY = 0x80, /**< The external authenticator is in a "ready" state. */
        FIDO_AUTH_ATTACH_HINT_WIFI_DIRECT = 0x100 /**< The external authenticator is able to
-                                                                                          * communicate using WiFi Direct with the FIDO User Device.
-                                                                                          */
+                                                                                               * communicate using WiFi Direct with the FIDO User Device.
+                                                                                               */
 } fido_auth_attachment_hint_e;
 
 /**
@@ -173,8 +163,7 @@ typedef enum
  *  @remarks Refer to FIDO UAF Registry document for more details.
  *  @since_tizen 3.0
  */
-typedef enum
-{
+typedef enum {
        FIDO_AUTH_TC_DISP_TYPE_ANY = 0x01, /**< Some form of transaction confirmation display is available on this authenticator. */
        FIDO_AUTH_TC_DISP_TYPE_PRIVILEGED_SOFTWARE = 0x02, /**< Software-based transaction confirmation display operating in a
                                                                                                                * privileged context is available on this authenticator.
@@ -184,7 +173,6 @@ typedef enum
        FIDO_AUTH_TC_DISP_TYPE_REMOTE = 0x10 /**< Transaction confirmation display is provided on a distinct device from the FIDO User Device. */
 } fido_auth_tc_display_type_e;
 
-
 /**
  * @brief  The FIDO Server response for successfull interaction.
  * @since_tizen  3.0
index d440f30..6aa5769 100644 (file)
 void
 _free_extension(_extension_t *data)
 {
-    _INFO("");
+       _INFO("");
 
-    RET_IF_FAIL_VOID(data != NULL);
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->id);
-    SAFE_DELETE(data->data);
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data->id);
+       SAFE_DELETE(data->data);
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 static void
 _free_extension_list_item(gpointer data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    _free_extension((_extension_t*)data);
-    _INFO("");
+       _free_extension((_extension_t*)data);
+       _INFO("");
 }
 
 void
 _free_match_criteria(_match_criteria_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    if (data->aaid_list != NULL)
-        g_list_free_full(data->aaid_list, free);
+       if (data->aaid_list != NULL)
+               g_list_free_full(data->aaid_list, free);
 
-    if (data->vendor_list != NULL)
-        g_list_free_full(data->vendor_list, free);
+       if (data->vendor_list != NULL)
+               g_list_free_full(data->vendor_list, free);
 
-    if (data->key_id_list != NULL)
-        g_list_free_full(data->key_id_list, free);
+       if (data->key_id_list != NULL)
+               g_list_free_full(data->key_id_list, free);
 
-    if (data->auth_algo_list != NULL)
-        g_list_free(data->auth_algo_list);
+       if (data->auth_algo_list != NULL)
+               g_list_free(data->auth_algo_list);
 
-    if (data->assertion_scheme_list != NULL)
-        g_list_free_full(data->assertion_scheme_list, free);
+       if (data->assertion_scheme_list != NULL)
+               g_list_free_full(data->assertion_scheme_list, free);
 
-    if (data->attestation_type_list != NULL)
-        g_list_free_full(data->attestation_type_list, free);
+       if (data->attestation_type_list != NULL)
+               g_list_free_full(data->attestation_type_list, free);
 
-    if (data->extension_list != NULL)
-        g_list_free_full(data->extension_list, _free_extension_list_item);
+       if (data->extension_list != NULL)
+               g_list_free_full(data->extension_list, _free_extension_list_item);
 
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 static void
 _free_uaf_accepted_list_inner_item(gpointer data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    _free_match_criteria((_match_criteria_t*)data);
-    _INFO("");
+       _free_match_criteria((_match_criteria_t*)data);
+       _INFO("");
 }
 
 static void
 _free_uaf_accepted_list_outer_item(gpointer data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    GList *list = (GList*)data;
-    if (list != NULL)
-        g_list_free_full(list, _free_uaf_accepted_list_inner_item);
-    _INFO("");
+       GList *list = (GList*)data;
+       if (list != NULL)
+               g_list_free_full(list, _free_uaf_accepted_list_inner_item);
+       _INFO("");
 }
 
 static void
 _free_uaf_disallowed_list_item(gpointer data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    _free_match_criteria((_match_criteria_t*)data);
-    _INFO("");
+       _free_match_criteria((_match_criteria_t*)data);
+       _INFO("");
 }
 
 void
 _free_policy(_policy_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    if (data->accepted_list != NULL)
-        g_list_free_full(data->accepted_list, _free_uaf_accepted_list_outer_item);
+       if (data->accepted_list != NULL)
+               g_list_free_full(data->accepted_list, _free_uaf_accepted_list_outer_item);
 
-    if (data->disallowed_list != NULL)
-        g_list_free_full(data->disallowed_list, _free_uaf_disallowed_list_item);
+       if (data->disallowed_list != NULL)
+               g_list_free_full(data->disallowed_list, _free_uaf_disallowed_list_item);
 
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 void
 _free_op_header(_op_header_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->version);
-    SAFE_DELETE(data->operation);
-    SAFE_DELETE(data->app_id);
-    SAFE_DELETE(data->server_data);
+       SAFE_DELETE(data->version);
+       SAFE_DELETE(data->operation);
+       SAFE_DELETE(data->app_id);
+       SAFE_DELETE(data->server_data);
 
-    if (data->ext_list != NULL)
-        g_list_free_full(data->ext_list, _free_extension_list_item);
+       if (data->ext_list != NULL)
+               g_list_free_full(data->ext_list, _free_extension_list_item);
 
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 void
 _free_message(_message_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->facet_id);
+       SAFE_DELETE(data->facet_id);
 
-    _free_op_header(data->header);
+       _free_op_header(data->header);
 
-    SAFE_DELETE(data->channel_binding);
+       SAFE_DELETE(data->channel_binding);
 
-    switch (data->type) {
+       switch (data->type) {
 
-    case _MESSAGE_TYPE_REG:
-        _free_reg_request((_reg_request_t*)(data->data));
-        break;
+       case _MESSAGE_TYPE_REG:
+               _free_reg_request((_reg_request_t*)(data->data));
+               break;
 
-    case _MESSAGE_TYPE_AUTH:
-        _free_auth_request((_auth_request_t*)(data->data));
-        break;
+       case _MESSAGE_TYPE_AUTH:
+               _free_auth_request((_auth_request_t*)(data->data));
+               break;
 
-    case _MESSAGE_TYPE_DEREG:
-        _free_dereg_request((_dereg_request_t*)(data->data));
-        break;
+       case _MESSAGE_TYPE_DEREG:
+               _free_dereg_request((_dereg_request_t*)(data->data));
+               break;
 
-    default:
-        SAFE_DELETE(data->data);
+       default:
+               SAFE_DELETE(data->data);
     }
 
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 void
 _free_reg_request(_reg_request_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->challenge);
-    SAFE_DELETE(data->user_name);
+       SAFE_DELETE(data->challenge);
+       SAFE_DELETE(data->user_name);
 
-    _free_policy(data->policy);
+       _free_policy(data->policy);
 
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 void
 _free_display_png_characteristics_descriptor(fido_display_png_characteristics_descriptor_s *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    if (data->plte != NULL)
-        g_list_free_full(data->plte, free);
+       if (data->plte != NULL)
+               g_list_free_full(data->plte, free);
 
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 void
 _free_auth_transaction(_auth_transaction_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->content);
-    SAFE_DELETE(data->content_type);
+       SAFE_DELETE(data->content);
+       SAFE_DELETE(data->content_type);
 
-    _free_display_png_characteristics_descriptor(data->display_charac);
+       _free_display_png_characteristics_descriptor(data->display_charac);
 
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 static void
 __free_auth_transaction_list_item(gpointer data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    _free_auth_transaction((_auth_transaction_t*)data);
-    _INFO("");
+       _free_auth_transaction((_auth_transaction_t*)data);
+       _INFO("");
 }
 
 void
 _free_auth_request(_auth_request_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->challenge);
+       SAFE_DELETE(data->challenge);
 
-    _free_policy(data->policy);
+       _free_policy(data->policy);
 
-    if (data->transaction_list != NULL)
-        g_list_free_full(data->transaction_list, __free_auth_transaction_list_item);
+       if (data->transaction_list != NULL)
+               g_list_free_full(data->transaction_list, __free_auth_transaction_list_item);
 
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 void
 _free_dereg_auth_info(_dereg_auth_info_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->aaid);
-    SAFE_DELETE(data->key_id);
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data->aaid);
+       SAFE_DELETE(data->key_id);
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 static void
 __free_dereg_auth_info_list_item(gpointer data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    _free_dereg_auth_info((_dereg_auth_info_t*)data);
-    _INFO("");
+       _free_dereg_auth_info((_dereg_auth_info_t*)data);
+       _INFO("");
 }
 
 void
 _free_dereg_request(_dereg_request_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    if (data->auth_info_list != NULL)
-        g_list_free_full(data->auth_info_list, __free_dereg_auth_info_list_item);
+       if (data->auth_info_list != NULL)
+               g_list_free_full(data->auth_info_list, __free_dereg_auth_info_list_item);
 
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 void
 _free_asm_display_png_characteristics_descriptor_t(_fido_asm_display_png_characteristics_descriptor_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    if (data->plte != NULL)
-        g_list_free_full(data->plte, free);
+       if (data->plte != NULL)
+               g_list_free_full(data->plte, free);
 
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 void
 _free_fido_asm_proxy(void *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    _fido_asm_proxy_t *data_impl = (_fido_asm_proxy_t*)data;
-    SAFE_DELETE(data_impl->asm_id);
-    SAFE_DELETE(data_impl->vendor);
-    SAFE_DELETE(data_impl->bin_path);
-    SAFE_DELETE(data_impl->dbus_info);
-    SAFE_DELETE(data_impl->dbus_obj_path);
-    SAFE_DELETE(data_impl->dbus_interface_name);
-    SAFE_DELETE(data_impl->dbus_method_name);
+       _fido_asm_proxy_t *data_impl = (_fido_asm_proxy_t*)data;
+       SAFE_DELETE(data_impl->asm_id);
+       SAFE_DELETE(data_impl->vendor);
+       SAFE_DELETE(data_impl->bin_path);
+       SAFE_DELETE(data_impl->dbus_info);
+       SAFE_DELETE(data_impl->dbus_obj_path);
+       SAFE_DELETE(data_impl->dbus_interface_name);
+       SAFE_DELETE(data_impl->dbus_method_name);
 
-    g_object_unref(data_impl->dbus_proxy);
+       g_object_unref(data_impl->dbus_proxy);
 
-    SAFE_DELETE(data_impl);
+       SAFE_DELETE(data_impl);
 
-    _INFO("");
+       _INFO("");
 }
 
 void
 _free_asm_discover_response(_asm_discover_response_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->asm_id);
-    SAFE_DELETE(data->asm_response_json);
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data->asm_id);
+       SAFE_DELETE(data->asm_response_json);
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 void
 _free_fido_asm_authenticator(fido_authenticator_s *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->asm_id);
+       SAFE_DELETE(data->asm_id);
 
-    _INFO("");
+       _INFO("");
 
-    SAFE_DELETE(data->auth_index);
+       SAFE_DELETE(data->auth_index);
 
-    _INFO("");
+       _INFO("");
 
-    if (data->key_ids != NULL)
-        g_list_free_full(data->key_ids, free);
-    _INFO("");
+       if (data->key_ids != NULL)
+               g_list_free_full(data->key_ids, free);
+       _INFO("");
 
-    /*TODO : asm_versions is not used anywhere*/
+       /*TODO : asm_versions is not used anywhere*/
 
-    SAFE_DELETE(data->aaid);
-    _INFO("");
+       SAFE_DELETE(data->aaid);
+       _INFO("");
 
-    SAFE_DELETE(data->assertion_scheme);
-    _INFO("");
+       SAFE_DELETE(data->assertion_scheme);
+       _INFO("");
 
-    if (data->attestation_types != NULL)
-        g_list_free(data->attestation_types);
-    _INFO("");
+       if (data->attestation_types != NULL)
+               g_list_free(data->attestation_types);
+       _INFO("");
 
-    if (data->supported_extension_IDs != NULL)
-        g_list_free_full(data->supported_extension_IDs, free);
-    _INFO("");
+       if (data->supported_extension_IDs != NULL)
+               g_list_free_full(data->supported_extension_IDs, free);
+       _INFO("");
 
-    SAFE_DELETE(data->tc_display_content_type);
-    _INFO("");
+       SAFE_DELETE(data->tc_display_content_type);
+       _INFO("");
 
-    if (data->tc_display_png_characteristics != NULL)
-        g_list_free_full(data->tc_display_png_characteristics, _free_tc_disp_png_char);
-    _INFO("");
+       if (data->tc_display_png_characteristics != NULL)
+               g_list_free_full(data->tc_display_png_characteristics, _free_tc_disp_png_char);
+       _INFO("");
 
-    SAFE_DELETE(data->title);
-    _INFO("");
+       SAFE_DELETE(data->title);
+       _INFO("");
 
-    SAFE_DELETE(data->description);
-    _INFO("");
+       SAFE_DELETE(data->description);
+       _INFO("");
 
-    SAFE_DELETE(data->icon);
-    _INFO("");
+       SAFE_DELETE(data->icon);
+       _INFO("");
 
-    if (data->supported_versions != NULL)
-        g_list_free_full(data->supported_versions, free);
+       if (data->supported_versions != NULL)
+               g_list_free_full(data->supported_versions, free);
 
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 void
 _free_fido_asm_authenticator_list_item(gpointer data)
 {
-    RET_IF_FAIL_VOID(data != NULL);
+       RET_IF_FAIL_VOID(data != NULL);
 
-    fido_authenticator_s *data_impl = (fido_authenticator_s*)data;
+       fido_authenticator_s *data_impl = (fido_authenticator_s*)data;
 
-    _free_fido_asm_authenticator(data_impl);
+       _free_fido_asm_authenticator(data_impl);
 }
 
 void
 _free_fido_asm_reg_in(_fido_asm_reg_in_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->app_id);
-    SAFE_DELETE(data->user_name);
-    SAFE_DELETE(data->final_challenge);
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data->app_id);
+       SAFE_DELETE(data->user_name);
+       SAFE_DELETE(data->final_challenge);
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 void
 _free_fido_asm_transaction(_fido_asm_transaction_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->content);
-    SAFE_DELETE(data->content_type);
-    _free_asm_display_png_characteristics_descriptor_t(data->display_charac);
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data->content);
+       SAFE_DELETE(data->content_type);
+       _free_asm_display_png_characteristics_descriptor_t(data->display_charac);
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 static void
 __free_fido_asm_transaction_list_item(gpointer data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    _free_fido_asm_transaction((_fido_asm_transaction_t *)data);
-    _INFO("");
+       _free_fido_asm_transaction((_fido_asm_transaction_t *)data);
+       _INFO("");
 }
 
 void
 _free_fido_asm_auth_in(_fido_asm_auth_in_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->app_id);
-    SAFE_DELETE(data->final_challenge);
-    if (data->key_ids != NULL)
-        g_list_free_full(data->key_ids, free);
+       SAFE_DELETE(data->app_id);
+       SAFE_DELETE(data->final_challenge);
+       if (data->key_ids != NULL)
+               g_list_free_full(data->key_ids, free);
 
-    if (data->trans_list != NULL)
-        g_list_free_full(data->trans_list, __free_fido_asm_transaction_list_item);
+       if (data->trans_list != NULL)
+               g_list_free_full(data->trans_list, __free_fido_asm_transaction_list_item);
 
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 void
 _free_fido_asm_dereg_in(_fido_asm_dereg_in_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->app_id);
-    SAFE_DELETE(data->key_id);
+       SAFE_DELETE(data->app_id);
+       SAFE_DELETE(data->key_id);
 
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 void
 _free_ui_auth_data(_ui_auth_data_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->asm_id);
-    SAFE_DELETE(data->auth_index);
-    SAFE_DELETE(data->label);
+       SAFE_DELETE(data->asm_id);
+       SAFE_DELETE(data->auth_index);
+       SAFE_DELETE(data->label);
 
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 void
 _free_auth_reg_assertion(_auth_reg_assertion_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->assertion_schm);
-    SAFE_DELETE(data->assertion);
+       SAFE_DELETE(data->assertion_schm);
+       SAFE_DELETE(data->assertion);
 
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 void
 _free_auth_reg_assertion_list_item(gpointer data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    _free_auth_reg_assertion((_auth_reg_assertion_t*)data);
-    _INFO("");
+       _free_auth_reg_assertion((_auth_reg_assertion_t*)data);
+       _INFO("");
 }
 
 void
 _free_asm_out(_asm_out_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    switch (data->type) {
+       switch (data->type) {
 
-    case _ASM_OUT_TYPE_REG:
-        _free_asm_reg_out((_asm_reg_out_t*)(data->response_data));
-        break;
+       case _ASM_OUT_TYPE_REG:
+               _free_asm_reg_out((_asm_reg_out_t*)(data->response_data));
+               break;
 
-    case _ASM_OUT_TYPE_AUTH:
-        _free_asm_auth_out((_asm_auth_out_t*)(data->response_data));
-        break;
+       case _ASM_OUT_TYPE_AUTH:
+               _free_asm_auth_out((_asm_auth_out_t*)(data->response_data));
+               break;
 
-    default:
-        SAFE_DELETE(data->response_data);
-    }
+       default:
+               SAFE_DELETE(data->response_data);
+       }
 
-    if (data->ext_list != NULL) {
-        _INFO("Freeing ext list");
-        g_list_free_full(data->ext_list, free);
-        _INFO("After Freeing ext list");
+       if (data->ext_list != NULL) {
+               _INFO("Freeing ext list");
+               g_list_free_full(data->ext_list, free);
+               _INFO("After Freeing ext list");
     }
 
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 void
 _free_asm_reg_out(_asm_reg_out_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->assertion);
-    SAFE_DELETE(data->assertion_schm);
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data->assertion);
+       SAFE_DELETE(data->assertion_schm);
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 void
 _free_asm_auth_out(_asm_auth_out_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->assertion);
-    SAFE_DELETE(data->assertion_scheme);
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data->assertion);
+       SAFE_DELETE(data->assertion_scheme);
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 void
 _free_tlv(_tlv_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->val);
-    SAFE_DELETE(data);
+       SAFE_DELETE(data->val);
+       SAFE_DELETE(data);
 
-    _INFO("");
+       _INFO("");
 }
 
 void
 _free_tc_disp_png_char(gpointer data)
 {
-    _INFO("");
-    if (data == NULL)
-        return;
+       _INFO("");
+       if (data == NULL)
+               return;
 
-    fido_display_png_characteristics_descriptor_s *png = (fido_display_png_characteristics_descriptor_s*)data;
-    if (png->plte != NULL)
-        g_list_free_full(png->plte, free);
+       fido_display_png_characteristics_descriptor_s *png = (fido_display_png_characteristics_descriptor_s*)data;
+       if (png->plte != NULL)
+               g_list_free_full(png->plte, free);
 
-    SAFE_DELETE(png);
-    _INFO("");
+       SAFE_DELETE(png);
+       _INFO("");
 }
 
 void
 _free_asm_auth_list(gpointer data)
 {
-    _INFO("_free_asm_auth_list start");
+       _INFO("_free_asm_auth_list start");
 
-    if (data == NULL)
-        return;
+       if (data == NULL)
+               return;
 
-    _free_fido_asm_authenticator((fido_authenticator_s*)data);
+       _free_fido_asm_authenticator((fido_authenticator_s*)data);
 
-    _INFO("_free_asm_auth_list end");
+       _INFO("_free_asm_auth_list end");
 
 }
 
 void
 _free_matched_auth_dereg(_matched_auth_dereg_t *data)
 {
-    _INFO("_free_matched_auth_dereg start");
-    if (data == NULL)
-        return;
+       _INFO("_free_matched_auth_dereg start");
+       if (data == NULL)
+               return;
 
-    SAFE_DELETE(data->asm_id);
-    SAFE_DELETE(data->auth_index);
-    SAFE_DELETE(data->app_id);
-    SAFE_DELETE(data->key_id);
+       SAFE_DELETE(data->asm_id);
+       SAFE_DELETE(data->auth_index);
+       SAFE_DELETE(data->app_id);
+       SAFE_DELETE(data->key_id);
 
-    SAFE_DELETE(data);
-    _INFO("_free_matched_auth_dereg end");
+       SAFE_DELETE(data);
+       _INFO("_free_matched_auth_dereg end");
 }
 
 void
 _free_asm_app_reg(_asm_app_reg_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->app_id);
+       SAFE_DELETE(data->app_id);
 
-    if (data->key_id_list != NULL)
-        g_list_free_full(data->key_id_list, free);
+       if (data->key_id_list != NULL)
+               g_list_free_full(data->key_id_list, free);
 
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 static void
 __free_asm_app_reg_list_item(gpointer data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    _free_asm_app_reg((_asm_app_reg_t*)data);
-    _INFO("");
+       _free_asm_app_reg((_asm_app_reg_t*)data);
+       _INFO("");
 }
 
 void
 _free_asm_get_reg_out(_asm_get_reg_out_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    if (data->app_reg_list != NULL)
-        g_list_free_full(data->app_reg_list, __free_asm_app_reg_list_item);
+       if (data->app_reg_list != NULL)
+               g_list_free_full(data->app_reg_list, __free_asm_app_reg_list_item);
 
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 void
 _free_auth_reg_assertion_tlv(_auth_reg_assertion_tlv_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->aaid);
-    SAFE_DELETE(data->key_id);
+       SAFE_DELETE(data->aaid);
+       SAFE_DELETE(data->key_id);
 
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 void
 _free_response(_response_t *data)
 {
-    _INFO("");
-    RET_IF_FAIL_VOID(data != NULL);
+       _INFO("");
+       RET_IF_FAIL_VOID(data != NULL);
 
-    _free_op_header(data->header);
-    SAFE_DELETE(data->fcp);
+       _free_op_header(data->header);
+       SAFE_DELETE(data->fcp);
 
-    if (data->assertion_list != NULL)
-        g_list_free_full(data->assertion_list, _free_auth_reg_assertion_list_item);
+       if (data->assertion_list != NULL)
+               g_list_free_full(data->assertion_list, _free_auth_reg_assertion_list_item);
 
-    SAFE_DELETE(data);
-    _INFO("");
+       SAFE_DELETE(data);
+       _INFO("");
 }
 
 void
 _free_matched_auth_data(gpointer data)
 {
-    _INFO("_free_matched_auth_data start");
-    if (data == NULL)
-        return;
+       _INFO("_free_matched_auth_data start");
+       if (data == NULL)
+               return;
 
-    _matched_auth_data_t *match_auth_data = (_matched_auth_data_t*)data;
+       _matched_auth_data_t *match_auth_data = (_matched_auth_data_t*)data;
 
-    SAFE_DELETE(match_auth_data->asm_id);
-    SAFE_DELETE(match_auth_data->auth_index);
-    SAFE_DELETE(match_auth_data->label);
-    SAFE_DELETE(match_auth_data);
+       SAFE_DELETE(match_auth_data->asm_id);
+       SAFE_DELETE(match_auth_data->auth_index);
+       SAFE_DELETE(match_auth_data->label);
+       SAFE_DELETE(match_auth_data);
 
-    _INFO("_free_matched_auth_data end");
+       _INFO("_free_matched_auth_data end");
 }
index 75b0fa5..97e8c31 100644 (file)
@@ -1,5 +1,5 @@
 <manifest>
-    <request>
-        <domain name="_"/>
-    </request>
+       <request>
+               <domain name="_"/>
+       </request>
 </manifest>
index dc03798..5e2a41f 100644 (file)
@@ -1,9 +1,9 @@
 <manifest>
-    <request>
-        <domain name="_"/>
-    </request>
-    <assign>
+       <request>
+               <domain name="_"/>
+       </request>
+       <assign>
        <filesystem path="/usr/lib/fido/" label="_"/>
        <filesystem path="/usr/lib/fido/asm/" label="_"/>
-    </assign>
+       </assign>
 </manifest>
index 39c7762..a58e072 100644 (file)
@@ -1,35 +1,35 @@
 IF(NOT DEFINED UI_PACKAGE_NAME)
-    SET(UI_PACKAGE_NAME "org.tizen.fidosvcui")
+       SET(UI_PACKAGE_NAME "org.tizen.fidosvcui")
 ENDIF(NOT DEFINED UI_PACKAGE_NAME)
 
 SET(UI_PREFIX "/usr/apps/${UI_PACKAGE_NAME}")
 
 IF(NOT DEFINED UI_BINDIR)
-    SET(UI_BINDIR "${UI_PREFIX}/bin")
+       SET(UI_BINDIR "${UI_PREFIX}/bin")
 ENDIF(NOT DEFINED UI_BINDIR)
 
 IF(NOT DEFINED UI_RESDIR)
-    SET(UI_RESDIR "${UI_PREFIX}/res")
+       SET(UI_RESDIR "${UI_PREFIX}/res")
 ENDIF(NOT DEFINED UI_RESDIR)
 
 IF(NOT DEFINED UI_LOCALEDIR)
-    SET(UI_LOCALEDIR "${UI_PREFIX}/res/locale")
+       SET(UI_LOCALEDIR "${UI_PREFIX}/res/locale")
 ENDIF(NOT DEFINED UI_LOCALEDIR)
 
 IF(NOT DEFINED UI_MANIFESTDIR)
-    SET(UI_MANIFESTDIR "/usr/share/packages")
+       SET(UI_MANIFESTDIR "/usr/share/packages")
 ENDIF(NOT DEFINED UI_MANIFESTDIR)
 
 IF(NOT DEFINED UI_DESKTOP_ICONDIR)
-    SET(UI_DESKTOP_ICONDIR "/usr/share/icons/default/small")
+       SET(UI_DESKTOP_ICONDIR "/usr/share/icons/default/small")
 ENDIF(NOT DEFINED UI_DESKTOP_ICONDIR)
 
 IF(NOT DEFINED UI_DESKTOP_ICON)
-    SET(UI_DESKTOP_ICON ${UI_PACKAGE_NAME}.png)
+       SET(UI_DESKTOP_ICON ${UI_PACKAGE_NAME}.png)
 ENDIF(NOT DEFINED UI_DESKTOP_ICON)
 
 SET(UI_SRCS
-    ${CMAKE_SOURCE_DIR}/fido_svc_ui/fido_ui_server.c
+       ${CMAKE_SOURCE_DIR}/fido_svc_ui/fido_ui_server.c
 )
 
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common)
@@ -51,7 +51,7 @@ pkg_check_modules(UI_PKGS REQUIRED
 )
 
 FOREACH(flag ${UI_PKGS_CFLAGS})
-    SET(EXTRA_CFLGAS "${EXTRA_CFLGAS} ${flag}")
+       SET(EXTRA_CFLGAS "${EXTRA_CFLGAS} ${flag}")
 ENDFOREACH(flag)
 
 ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_SOURCE_DIR}/common/fido-stub.c ${CMAKE_SOURCE_DIR}/common/fido-stub.h
index b97016a..7064e50 100644 (file)
@@ -22,7 +22,7 @@
 #include <sys/stat.h>
 #include <signal.h>
 #include <glib.h>
-#if !GLIB_CHECK_VERSION (2, 31, 0)
+#if !GLIB_CHECK_VERSION(2, 31, 0)
 #include <glib/gmacros.h>
 #endif
 
@@ -55,7 +55,7 @@ static bool auth_option_selected = FALSE;
 static Fido *_fido_dbus_obj = NULL;
 
 typedef struct _ui_data_s {
-    char *asm_id;
+       char *asm_id;
        char *auth_index;
        char *label;
        int att_t;
@@ -80,399 +80,397 @@ static appdata_s *ad = NULL;
 static void
 __free_ui_data(ui_data_s *data)
 {
-    RET_IF_FAIL_VOID(data != NULL);
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->asm_id);
-    SAFE_DELETE(data->auth_index);
-    SAFE_DELETE(data->label);
+       SAFE_DELETE(data->asm_id);
+       SAFE_DELETE(data->auth_index);
+       SAFE_DELETE(data->label);
 
-    SAFE_DELETE(data);
+       SAFE_DELETE(data);
 }
 
 #ifdef WITH_JSON_BUILDER
 static void
 __add_string_to_json_object(JsonBuilder *json_obj, const char *key, const char *val)
 {
-    if (key == NULL || val == NULL)
-        return;
+       if (key == NULL || val == NULL)
+               return;
 
-    json_builder_set_member_name(json_obj, key);
-    json_builder_add_string_value(json_obj, val);
+       json_builder_set_member_name(json_obj, key);
+       json_builder_add_string_value(json_obj, val);
 }
 
 static void
 __add_int_to_json_object(JsonBuilder *json_obj, const char *key, int val)
 {
-    if (key == NULL || val == _INVALID_INT)
-        return;
+       if (key == NULL || val == _INVALID_INT)
+               return;
 
-    json_builder_set_member_name(json_obj, key);
-    json_builder_add_int_value(json_obj, val);
+       json_builder_set_member_name(json_obj, key);
+       json_builder_add_int_value(json_obj, val);
 }
 #endif
 
 static void
 __init_dbus(void)
 {
-    _INFO("init_dbus");
-#if !GLIB_CHECK_VERSION(2,35,0)
+       _INFO("init_dbus");
+#if !GLIB_CHECK_VERSION(2, 35, 0)
     g_type_init();
 #endif
 
-    GDBusConnection *connection = NULL;
-    GError *error = NULL;
+       GDBusConnection *connection = NULL;
+       GError *error = NULL;
 
-    connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+       connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
 
-    _INFO("after g_bus_get_sync");
+       _INFO("after g_bus_get_sync");
 
 
-    /* Create the object */
-    _fido_dbus_obj = fido_proxy_new_sync(connection,
-                                         G_DBUS_PROXY_FLAGS_NONE,
-                                         _FIDO_DBUS_NAME,
-                                         _FIDO_DBUS_PATH,
-                                         NULL,
-                                         &error);
+       /* Create the object */
+       _fido_dbus_obj = fido_proxy_new_sync(connection,
+                                               G_DBUS_PROXY_FLAGS_NONE,
+                                                _FIDO_DBUS_NAME,
+                                               _FIDO_DBUS_PATH,
+                                               NULL,
+                                               &error);
 }
 
 static Fido *
 __dbus_proxy_get_instance(int time_out)
 {
-    _INFO("_dbus_proxy_get_instance singleton");
-
-    static pthread_once_t onceBlock = PTHREAD_ONCE_INIT;
-    if (_fido_dbus_obj == NULL) {
-        pthread_once(&onceBlock, __init_dbus);
-        if (_fido_dbus_obj == NULL) {
-            _ERR("init_dbus failed");
-            onceBlock = PTHREAD_ONCE_INIT;
-        }
-    }
-    _INFO("_dbus_proxy_get_instance end");
+       _INFO("_dbus_proxy_get_instance singleton");
+
+       static pthread_once_t onceBlock = PTHREAD_ONCE_INIT;
+       if (_fido_dbus_obj == NULL) {
+               pthread_once(&onceBlock, __init_dbus);
+               if (_fido_dbus_obj == NULL) {
+                       _ERR("init_dbus failed");
+                       onceBlock = PTHREAD_ONCE_INIT;
+               }
+       }
+       _INFO("_dbus_proxy_get_instance end");
 
-    g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(_fido_dbus_obj), time_out);
+       g_dbus_proxy_set_default_timeout(G_DBUS_PROXY(_fido_dbus_obj), time_out);
 
-    return _fido_dbus_obj;
+       return _fido_dbus_obj;
 }
 
 static void
 __send_response_to_fido_svc(int error, const char *ui_resp)
 {
-    auth_option_selected = FALSE;
+       auth_option_selected = FALSE;
 
-    Fido *dbus_proxy = __dbus_proxy_get_instance(_DBUS_TIMEOUT_USE_DEFAULT);
-    if (dbus_proxy == NULL) {
-        _ERR("DBus proxy failed");
-        return;
-    }
+       Fido *dbus_proxy = __dbus_proxy_get_instance(_DBUS_TIMEOUT_USE_DEFAULT);
+       if (dbus_proxy == NULL) {
+               _ERR("DBus proxy failed");
+               return;
+       }
 
-    _INFO("Sending to FIDO Service");
+       _INFO("Sending to FIDO Service");
 
-    GError *dbus_err = NULL;
-    if (ui_resp == NULL)
-        fido_call_ui_response_sync(dbus_proxy, FIDO_ERROR_USER_CANCELLED, _EMPTY_JSON_STRING, NULL, &dbus_err);
-    else
-        fido_call_ui_response_sync(dbus_proxy, error, ui_resp, NULL, &dbus_err);
+       GError *dbus_err = NULL;
+       if (ui_resp == NULL)
+               fido_call_ui_response_sync(dbus_proxy, FIDO_ERROR_USER_CANCELLED, _EMPTY_JSON_STRING, NULL, &dbus_err);
+       else
+               fido_call_ui_response_sync(dbus_proxy, error, ui_resp, NULL, &dbus_err);
 
-    if (dbus_err != NULL)
-        g_error_free(dbus_err);
+       if (dbus_err != NULL)
+               g_error_free(dbus_err);
 
-    _INFO("UI end");
+       _INFO("UI end");
 }
 
 char*
 _create_json_response(ui_data_s *selected_auth)
 {
-    _INFO("_create_json_response");
+       _INFO("_create_json_response");
 
 #ifdef WITH_JSON_BUILDER
 
-    /*Builder start*/
-    JsonBuilder *builder = json_builder_new();
-    json_builder_begin_object(builder);
+       /*Builder start*/
+       JsonBuilder *builder = json_builder_new();
+       json_builder_begin_object(builder);
 
-    /*requestType*/
-    __add_string_to_json_object(builder, UI_DATA_ASM_ID, selected_auth->asm_id);
-    __add_string_to_json_object(builder, UI_DATA_AUTH_INDEX, selected_auth->auth_index);
-    __add_string_to_json_object(builder, UI_DATA_LABEL, selected_auth->label);
-    __add_int_to_json_object(builder, UI_DATA_ATT_TYPE, selected_auth->att_t);
+       /*requestType*/
+       __add_string_to_json_object(builder, UI_DATA_ASM_ID, selected_auth->asm_id);
+       __add_string_to_json_object(builder, UI_DATA_AUTH_INDEX, selected_auth->auth_index);
+       __add_string_to_json_object(builder, UI_DATA_LABEL, selected_auth->label);
+       __add_int_to_json_object(builder, UI_DATA_ATT_TYPE, selected_auth->att_t);
 
-    json_builder_end_object(builder);
-    /*Builder end*/
+       json_builder_end_object(builder);
+       /*Builder end*/
 
-    JsonGenerator *gen = json_generator_new();
-    JsonNode *root_builder = json_builder_get_root(builder);
-    json_generator_set_root(gen, root_builder);
+       JsonGenerator *gen = json_generator_new();
+       JsonNode *root_builder = json_builder_get_root(builder);
+       json_generator_set_root(gen, root_builder);
 
-    json_node_free(root_builder);
-    g_object_unref(builder);
+       json_node_free(root_builder);
+       g_object_unref(builder);
 
-    gsize len = 0;
-    char *json = json_generator_to_data(gen, &len);
-    if (json != NULL) {
+       gsize len = 0;
+       char *json = json_generator_to_data(gen, &len);
+       if (json != NULL) {
 
-        if (gen != NULL)
-            g_object_unref(gen);
+               if (gen != NULL)
+                       g_object_unref(gen);
 
-        _INFO("%s", json);
-        _INFO("_create_json_response end");
+               _INFO("%s", json);
+               _INFO("_create_json_response end");
 
-        return json;
+               return json;
     }
 
-    g_object_unref(gen);
+       g_object_unref(gen);
 
-    _INFO("_create_json_response fail");
-    return NULL;
+       _INFO("_create_json_response fail");
+       return NULL;
 
 #else
 
-    /*Builder start*/
-    JsonGenerator *generator = NULL;
-    JsonObject *root_obj = NULL;
-    JsonNode *root_node = NULL;
+       /*Builder start*/
+       JsonGenerator *generator = NULL;
+       JsonObject *root_obj = NULL;
+       JsonNode *root_node = NULL;
 
-    generator = json_generator_new();
-    if(generator == NULL) {
-        _INFO("json_generator_new is NULL");
-        goto CATCH;
-    }
+       generator = json_generator_new();
+       if (generator == NULL) {
+               _INFO("json_generator_new is NULL");
+               goto CATCH;
+       }
 
-    root_obj = json_object_new();
-    if(root_obj == NULL) {
-        _INFO("json_object_new in NULL");
-        goto CATCH;
-    }
+       root_obj = json_object_new();
+       if (root_obj == NULL) {
+               _INFO("json_object_new in NULL");
+               goto CATCH;
+       }
 
-    root_node = json_node_new(JSON_NODE_OBJECT);
-    if (root_node == NULL) {
-        _INFO("*json_node_new is NULL");
-        goto CATCH;
-    }
+       root_node = json_node_new(JSON_NODE_OBJECT);
+       if (root_node == NULL) {
+               _INFO("*json_node_new is NULL");
+               goto CATCH;
+       }
 
-    /*requestType*/
-    json_object_set_string_member(root_obj, UI_DATA_ASM_ID, selected_auth->asm_id);
-    json_object_set_string_member(root_obj, UI_DATA_AUTH_INDEX, selected_auth->auth_index);
-    json_object_set_string_member(root_obj, UI_DATA_LABEL, selected_auth->label);
-    json_object_set_int_member(root_obj, UI_DATA_ATT_TYPE, selected_auth->att_t);
+       /*requestType*/
+       json_object_set_string_member(root_obj, UI_DATA_ASM_ID, selected_auth->asm_id);
+       json_object_set_string_member(root_obj, UI_DATA_AUTH_INDEX, selected_auth->auth_index);
+       json_object_set_string_member(root_obj, UI_DATA_LABEL, selected_auth->label);
+       json_object_set_int_member(root_obj, UI_DATA_ATT_TYPE, selected_auth->att_t);
 
-    json_node_take_object(root_node, root_obj);
-    json_generator_set_root(generator, root_node);
-    /*Builder end*/
+       json_node_take_object(root_node, root_obj);
+       json_generator_set_root(generator, root_node);
+       /*Builder end*/
 
-    char *json = json_generator_to_data(generator, NULL);
+       char *json = json_generator_to_data(generator, NULL);
 
-    if (json != NULL) {
+       if (json != NULL) {
 
-        if (generator != NULL)
-            g_object_unref(generator);
+               if (generator != NULL)
+                       g_object_unref(generator);
 
-        _INFO("%s", json);
-        _INFO("_create_json_response end");
+               _INFO("%s", json);
+               _INFO("_create_json_response end");
 
-        return json;
+               return json;
     }
 
 CATCH:
-    if (generator != NULL) {
-        g_object_unref(generator);
-        generator = NULL;
-    }
+       if (generator != NULL) {
+               g_object_unref(generator);
+               generator = NULL;
+       }
 
-    if (root_node != NULL) {
-        json_node_free(root_node);
-        root_node = NULL;
-    }
+       if (root_node != NULL) {
+               json_node_free(root_node);
+               root_node = NULL;
+       }
 
-    if (root_obj != NULL) {
-        g_object_unref(root_obj);
-        root_obj = NULL;
-    }
-    return NULL;
+       if (root_obj != NULL) {
+               g_object_unref(root_obj);
+               root_obj = NULL;
+       }
+       return NULL;
 #endif
 
-    return NULL;
+       return NULL;
 }
 
 void
 _list_destroy(gpointer data)
 {
-    ui_data_s *list_data = (ui_data_s *) data;
-    SAFE_DELETE(list_data->auth_index);
-    SAFE_DELETE(list_data->label);
+       ui_data_s *list_data = (ui_data_s *) data;
+       SAFE_DELETE(list_data->auth_index);
+       SAFE_DELETE(list_data->label);
 }
 
 void
 _hide_ui(void)
 {
-    elm_genlist_clear(ad->genlist);
-    g_list_free_full(ad->ui_data_list, (GDestroyNotify) _list_destroy);
-    ad->ui_data_list = NULL;
-    evas_object_hide(ad->win);
+       elm_genlist_clear(ad->genlist);
+       g_list_free_full(ad->ui_data_list, (GDestroyNotify) _list_destroy);
+       ad->ui_data_list = NULL;
+       evas_object_hide(ad->win);
 }
 
 void genlist_select_cb(void *data, Evas_Object *obj, void *event_info)
 {
-    _INFO("genlist_select_cb");
+       _INFO("genlist_select_cb");
 
-    if (data == NULL) {
-        _INFO("data is NULL");
-        return;
-    }
+       if (data == NULL) {
+               _INFO("data is NULL");
+               return;
+       }
 
-    if (event_info == NULL) {
-        _INFO("event_info is NULL");
-        return;
-    }
+       if (event_info == NULL) {
+               _INFO("event_info is NULL");
+               return;
+       }
 
-    ui_data_s *selected_auth = (ui_data_s*) data;
-    auth_option_selected = TRUE;
+       ui_data_s *selected_auth = (ui_data_s*) data;
+       auth_option_selected = TRUE;
 
-    Elm_Object_Item *item = (Elm_Object_Item *) event_info;
-    char *sel_txt = (char *) elm_object_item_data_get(item);
+       Elm_Object_Item *item = (Elm_Object_Item *) event_info;
+       char *sel_txt = (char *) elm_object_item_data_get(item);
 
-    if (!strcmp(sel_txt, selected_auth->label)) {
-        char *response = _create_json_response(selected_auth);
-        if (response != NULL) {
-            _hide_ui();
+       if (!strcmp(sel_txt, selected_auth->label)) {
+               char *response = _create_json_response(selected_auth);
+               if (response != NULL) {
+                       _hide_ui();
 
-            _INFO("sending response to ui adaptor");
-            __send_response_to_fido_svc(FIDO_ERROR_NONE, response);
+                       _INFO("sending response to ui adaptor");
+                       __send_response_to_fido_svc(FIDO_ERROR_NONE, response);
 
-            SAFE_DELETE(response);
-        }
-    }
+                       SAFE_DELETE(response);
+               }
+       }
 }
 
 static char*
 _item_label_get(void *data, Evas_Object *obj, const char *part)
 {
-    char buf[256];
-    snprintf(buf, sizeof(buf), "%s", (char*) data);
-    return strdup(buf);
+       char buf[256];
+       snprintf(buf, sizeof(buf), "%s", (char*) data);
+       return strdup(buf);
 }
 
 void
 _auth_arr_cb(JsonArray *array, guint index, JsonNode *element_node, gpointer user_data)
 {
-    _INFO("_auth_arr_cb");
+       _INFO("_auth_arr_cb");
 
-    JsonObject *obj = NULL;
-    obj = json_node_get_object(element_node);
-    if (!obj) {
-        _ERR("json_node_get_object() failed");
-        return;
+       JsonObject *obj = NULL;
+       obj = json_node_get_object(element_node);
+       if (!obj) {
+               _ERR("json_node_get_object() failed");
+               return;
     }
 
-    ui_data_s *ui_data = (ui_data_s *) calloc(1, sizeof(ui_data_s));
-    if (!ui_data) {
-        _ERR("Out of memory");
-        return;
-    }
+       ui_data_s *ui_data = (ui_data_s *) calloc(1, sizeof(ui_data_s));
+       if (!ui_data) {
+               _ERR("Out of memory");
+               return;
+       }
 
-    const char *asm_id = json_object_get_string_member(obj, UI_DATA_ASM_ID);
-    if (!asm_id) {
-        _ERR("json_object_get_string_member() failed");
+       const char *asm_id = json_object_get_string_member(obj, UI_DATA_ASM_ID);
+       if (!asm_id) {
+               _ERR("json_object_get_string_member() failed");
 
-        __free_ui_data(ui_data);
-        return;
+               __free_ui_data(ui_data);
+               return;
     }
 
-    const char *auth_idx = NULL;
-    auth_idx = json_object_get_string_member(obj, UI_DATA_AUTH_INDEX);
-    if (!auth_idx) {
-        _ERR("json_object_get_string_member() failed");
+       const char *auth_idx = NULL;
+       auth_idx = json_object_get_string_member(obj, UI_DATA_AUTH_INDEX);
+       if (!auth_idx) {
+               _ERR("json_object_get_string_member() failed");
 
-        __free_ui_data(ui_data);
-        return;
-    }
+               __free_ui_data(ui_data);
+               return;
+       }
 
-    const char *label = NULL;
-    label = json_object_get_string_member(obj, UI_DATA_LABEL);
+       const char *label = NULL;
+       label = json_object_get_string_member(obj, UI_DATA_LABEL);
 
-    int att = -1;
-    att = json_object_get_int_member(obj, UI_DATA_ATT_TYPE);
+       int att = -1;
+       att = json_object_get_int_member(obj, UI_DATA_ATT_TYPE);
 
-    ui_data->asm_id = strdup(asm_id);
+       ui_data->asm_id = strdup(asm_id);
 
-    ui_data->auth_index = strdup(auth_idx);
-    if (label == NULL) {
-        ui_data->label = calloc(1, 128);
-        snprintf(ui_data->label, 127, "%s", "Unknown Authenticator");
-    }
-    else
-        ui_data->label = strdup(label);
+       ui_data->auth_index = strdup(auth_idx);
+       if (label == NULL) {
+               ui_data->label = calloc(1, 128);
+               snprintf(ui_data->label, 127, "%s", "Unknown Authenticator");
+       } else
+               ui_data->label = strdup(label);
 
-    ui_data->att_t = att;
-    ad->ui_data_list = g_list_append(ad->ui_data_list, ui_data);
+       ui_data->att_t = att;
+       ad->ui_data_list = g_list_append(ad->ui_data_list, ui_data);
 
-    _INFO("Adding to ui_data list | auth_index %s | label %s | att_type %d",
-                                            auth_idx, ui_data->label, att);
+       _INFO("Adding to ui_data list | auth_index %s | label %s | att_type %d", auth_idx, ui_data->label, att);
 
-    elm_genlist_item_append(ad->genlist, ad->itc, ui_data->label, NULL,
-                ELM_GENLIST_ITEM_NONE, genlist_select_cb, ui_data);
+       elm_genlist_item_append(ad->genlist, ad->itc, ui_data->label, NULL,
+               ELM_GENLIST_ITEM_NONE, genlist_select_cb, ui_data);
 
 }
 
 static void
 _parse_json_ui_in(const char *ui_auth_json)
 {
-    _INFO("_parse_json_ui_in data %s", ui_auth_json);
-
-    char * ui_auth = strdup(ui_auth_json);
-    GError *parse_err = NULL;
-    JsonParser *parser = NULL;
-    JsonNode *root = NULL;
-    JsonArray *auth_data_arr = NULL;
-
-    parser = json_parser_new();
-    if (!parser) {
-        _ERR("json_parser_new failed");
-        goto CATCH;
-    }
+       _INFO("_parse_json_ui_in data %s", ui_auth_json);
+
+       char * ui_auth = strdup(ui_auth_json);
+       GError *parse_err = NULL;
+       JsonParser *parser = NULL;
+       JsonNode *root = NULL;
+       JsonArray *auth_data_arr = NULL;
+
+       parser = json_parser_new();
+       if (!parser) {
+               _ERR("json_parser_new failed");
+               goto CATCH;
+       }
 
-    json_parser_load_from_data(parser, ui_auth, -1, &parse_err);
-    if (parse_err != NULL) {
-        _ERR("json parse failure");
-        goto CATCH;
-    }
+       json_parser_load_from_data(parser, ui_auth, -1, &parse_err);
+       if (parse_err != NULL) {
+               _ERR("json parse failure");
+               goto CATCH;
+       }
 
-    root = json_parser_get_root(parser);
-    if (!root) {
-        _ERR("json_parser_get_root() failed");
-        goto CATCH;
-    }
+       root = json_parser_get_root(parser);
+       if (!root) {
+               _ERR("json_parser_get_root() failed");
+               goto CATCH;
+       }
 
-    auth_data_arr = json_node_get_array(root);
-    if (!auth_data_arr) {
-        _ERR("json_node_get_array() failed");
-        goto CATCH;
-    }
+       auth_data_arr = json_node_get_array(root);
+       if (!auth_data_arr) {
+               _ERR("json_node_get_array() failed");
+               goto CATCH;
+       }
 
-    /* Genlist Item */
-    ad->itc = elm_genlist_item_class_new();
-    ad->itc->item_style = "default";
-    ad->itc->func.text_get = _item_label_get;
-    ad->itc->func.content_get = NULL;
-    ad->itc->func.state_get = NULL;
+       /* Genlist Item */
+       ad->itc = elm_genlist_item_class_new();
+       ad->itc->item_style = "default";
+       ad->itc->func.text_get = _item_label_get;
+       ad->itc->func.content_get = NULL;
+       ad->itc->func.state_get = NULL;
 
-    json_array_foreach_element(auth_data_arr, _auth_arr_cb, NULL);
+       json_array_foreach_element(auth_data_arr, _auth_arr_cb, NULL);
 
-    CATCH:
-    if (parser != NULL) {
-        g_object_unref(parser);
-        parser = NULL;
-    }
+       CATCH:
+       if (parser != NULL) {
+               g_object_unref(parser);
+               parser = NULL;
+       }
 
-    if (parse_err != NULL) {
-        g_error_free(parse_err);
-        parse_err = NULL;
-    }
+       if (parse_err != NULL) {
+               g_error_free(parse_err);
+               parse_err = NULL;
+               }
 
-    SAFE_DELETE(ui_auth);
+       SAFE_DELETE(ui_auth);
 
-    return;
+       return;
 }
 
 // TODO button callback
@@ -495,128 +493,125 @@ static void btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) {
 static void
 _win_back_cb(void *data, Evas_Object *obj, void *event_info)
 {
-    if (auth_option_selected == FALSE) {
-        _ERR("Authenticator not selected by user");
-        _hide_ui();
-        __send_response_to_fido_svc(FIDO_ERROR_USER_CANCELLED, NULL);
-    }
+       if (auth_option_selected == FALSE) {
+               _ERR("Authenticator not selected by user");
+               _hide_ui();
+               __send_response_to_fido_svc(FIDO_ERROR_USER_CANCELLED, NULL);
+       }
 }
 
 static void
 _create_ui(void)
 {
-    _INFO("_create_ui");
-
-    /* Window */
-    //ad->win = elm_win_add(NULL, UI_SVC_PACKAGE,  ELM_WIN_BASIC);
-    ad->win = elm_win_util_standard_add(_UI_SVC_PACKAGE, "Authenticator Selection UI");
-    if (ad->win != NULL)
-        _INFO("elm_win_util_standard_add successful");
-    else
-        _ERR("elm_win_util_standard_add failed");
-
-    elm_win_autodel_set(ad->win, EINA_TRUE);
-
-    if (elm_win_wm_rotation_supported_get(ad->win)) {
-        int rots[4] = { 0, 90, 180, 270 };
-        elm_win_wm_rotation_available_rotations_set(ad->win,
-                (const int *) (&rots), 4);
-    }
+       _INFO("_create_ui");
+
+       /* Window */
+       //ad->win = elm_win_add(NULL, UI_SVC_PACKAGE,  ELM_WIN_BASIC);
+       ad->win = elm_win_util_standard_add(_UI_SVC_PACKAGE, "Authenticator Selection UI");
+       if (ad->win != NULL)
+               _INFO("elm_win_util_standard_add successful");
+       else
+               _ERR("elm_win_util_standard_add failed");
+
+       elm_win_autodel_set(ad->win, EINA_TRUE);
+
+       if (elm_win_wm_rotation_supported_get(ad->win)) {
+               int rots[4] = { 0, 90, 180, 270 };
+               elm_win_wm_rotation_available_rotations_set(ad->win,
+                               (const int *) (&rots), 4);
+       }
 
-    eext_object_event_callback_add(ad->win, EEXT_CALLBACK_BACK, _win_back_cb, ad);
-    evas_object_smart_callback_add(ad->win, "unfocused", _win_back_cb, NULL);
+       eext_object_event_callback_add(ad->win, EEXT_CALLBACK_BACK, _win_back_cb, ad);
+       evas_object_smart_callback_add(ad->win, "unfocused", _win_back_cb, NULL);
 
-    /* Conformant */
-    ad->conform = elm_conformant_add(ad->win);
-    elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
-    elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE);
-    evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND,
-            EVAS_HINT_EXPAND);
-    elm_win_resize_object_add(ad->win, ad->conform);
-    evas_object_show(ad->conform);
+       /* Conformant */
+       ad->conform = elm_conformant_add(ad->win);
+       elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
+       elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE);
+       evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_win_resize_object_add(ad->win, ad->conform);
+       evas_object_show(ad->conform);
 
-    /* Naviframe */
-    ad->nf = elm_naviframe_add(ad->conform);
-    elm_object_content_set(ad->conform, ad->nf);
-    evas_object_show(ad->nf);
+       /* Naviframe */
+       ad->nf = elm_naviframe_add(ad->conform);
+       elm_object_content_set(ad->conform, ad->nf);
+       evas_object_show(ad->nf);
 
-    /* Box */
-    ad->box = elm_box_add(ad->nf);
+       /* Box */
+       ad->box = elm_box_add(ad->nf);
 
-    /* Genlist */
-    ad->genlist = elm_genlist_add(ad->box);
-    elm_genlist_homogeneous_set(ad->genlist, EINA_TRUE);
+       /* Genlist */
+       ad->genlist = elm_genlist_add(ad->box);
+       elm_genlist_homogeneous_set(ad->genlist, EINA_TRUE);
 
-    /* Radio */
-    Evas_Object *radio_main = elm_radio_add(ad->genlist);
-    elm_radio_state_value_set(radio_main, 0);
-    elm_radio_value_set(radio_main, 0);
-    evas_object_data_set(ad->genlist, "radio_main", radio_main);
+       /* Radio */
+       Evas_Object *radio_main = elm_radio_add(ad->genlist);
+       elm_radio_state_value_set(radio_main, 0);
+       elm_radio_value_set(radio_main, 0);
+       evas_object_data_set(ad->genlist, "radio_main", radio_main);
 
-    evas_object_size_hint_weight_set(ad->genlist, EVAS_HINT_EXPAND,
-            EVAS_HINT_EXPAND);
-    evas_object_size_hint_align_set(ad->genlist, EVAS_HINT_FILL,
-            EVAS_HINT_FILL);
-    evas_object_show(ad->genlist);
-    elm_box_pack_end(ad->box, ad->genlist);
+       evas_object_size_hint_weight_set(ad->genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(ad->genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       evas_object_show(ad->genlist);
+       elm_box_pack_end(ad->box, ad->genlist);
 
-    //~ /* Button */ // TODO check button visibility
-    //~ ad->btn = elm_button_add(ad->box);
-    //~ elm_object_text_set(ad->btn, "OK");
-    //~ evas_object_size_hint_weight_set(ad->btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    //~ evas_object_size_hint_align_set(ad->btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       //~ /* Button */ // TODO check button visibility
+       //~ ad->btn = elm_button_add(ad->box);
+       //~ elm_object_text_set(ad->btn, "OK");
+       //~ evas_object_size_hint_weight_set(ad->btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       //~ evas_object_size_hint_align_set(ad->btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
-    //~ Evas_Object *btn_bg = elm_bg_add(ad->btn);
-    //~ elm_bg_color_set(btn_bg, 90, 160, 200);
+       //~ Evas_Object *btn_bg = elm_bg_add(ad->btn);
+       //~ elm_bg_color_set(btn_bg, 90, 160, 200);
 
-    //~ evas_object_smart_callback_add(ad->btn, "clicked", btn_clicked_cb, ad);
-    //~ evas_object_show(ad->btn);
-    //~ elm_box_pack_end(ad->box, ad->btn);
+       //~ evas_object_smart_callback_add(ad->btn, "clicked", btn_clicked_cb, ad);
+       //~ evas_object_show(ad->btn);
+       //~ elm_box_pack_end(ad->box, ad->btn);
 
 
-    elm_naviframe_item_push(ad->nf, "Select Authenticator",
-            NULL, NULL, ad->box, NULL);
+       elm_naviframe_item_push(ad->nf, "Select Authenticator",
+               NULL, NULL, ad->box, NULL);
 
-    /* Keep window hidden after base gui is set up */
-    //evas_object_hide(ad->win);
+       /* Keep window hidden after base gui is set up */
+       //evas_object_hide(ad->win);
 
 }
 
 static bool
 app_create(void *data)
 {
-    ad = data;
-    _create_ui();
+       ad = data;
+       _create_ui();
 
-    return true;
-    }
+       return true;
+}
 
 static void
 app_control(app_control_h app_control, void *data)
 {
-    //_UI_IPC_KEY_REQ
-    RET_IF_FAIL_VOID(app_control != NULL);
+       //_UI_IPC_KEY_REQ
+       RET_IF_FAIL_VOID(app_control != NULL);
 
-    char *req_json = NULL;
-    app_control_get_extra_data(app_control, _UI_IPC_KEY_REQ, &req_json);
-    RET_IF_FAIL_VOID(req_json != NULL);
+       char *req_json = NULL;
+       app_control_get_extra_data(app_control, _UI_IPC_KEY_REQ, &req_json);
+       RET_IF_FAIL_VOID(req_json != NULL);
 
-    _parse_json_ui_in(req_json);
+       _parse_json_ui_in(req_json);
 
-    evas_object_show(ad->win);
+       evas_object_show(ad->win);
 }
 
 static void
 app_pause(void *data)
 {
 
-    }
+}
 
 static void
 app_resume(void *data)
 {
 
-    }
+}
 
 static void
 app_terminate(void *data)
@@ -627,18 +622,17 @@ app_terminate(void *data)
 static void
 ui_app_lang_changed(app_event_info_h event_info, void *user_data)
 {
-
-    char *locale = NULL;
-    system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
-    elm_language_set(locale);
-    free(locale);
-    return;
+       char *locale = NULL;
+       system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
+       elm_language_set(locale);
+       free(locale);
+       return;
 }
 
 static void
 ui_app_orient_changed(app_event_info_h event_info, void *user_data)
 {
-    return;
+       return;
 }
 
 static void
@@ -660,29 +654,29 @@ ui_app_low_memory(app_event_info_h event_info, void *user_data)
 EXPORT_API int
 main(int argc, char *argv[])
 {
-    appdata_s ad = {0,};
-    int ret = 0;
-
-    ui_app_lifecycle_callback_s event_callback = {0,};
-    app_event_handler_h handlers[5] = {NULL, };
-
-    event_callback.create = app_create;
-    event_callback.terminate = app_terminate;
-    event_callback.pause = app_pause;
-    event_callback.resume = app_resume;
-    event_callback.app_control = app_control;
-
-    ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
-    ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
-    ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad);
-    ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
-    ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad);
-    ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]);
-
-    ret = ui_app_main(argc, argv, &event_callback, &ad);
-    if (ret != APP_ERROR_NONE) {
-        _INFO("app_main() is failed. err = %d", ret);
-    }
+       appdata_s ad = {0,};
+       int ret = 0;
+
+       ui_app_lifecycle_callback_s event_callback = {0,};
+       app_event_handler_h handlers[5] = {NULL, };
+
+       event_callback.create = app_create;
+       event_callback.terminate = app_terminate;
+       event_callback.pause = app_pause;
+       event_callback.resume = app_resume;
+       event_callback.app_control = app_control;
+
+       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad);
+       ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]);
+
+       ret = ui_app_main(argc, argv, &event_callback, &ad);
+       if (ret != APP_ERROR_NONE) {
+               _INFO("app_main() is failed. err = %d", ret);
+       }
 
-    return ret;
+       return ret;
 }
index 28b7407..971e146 100644 (file)
@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
 <manifest xmlns="http://tizen.org/ns/packages" api-version="2.4" package="org.tizen.fidosvcui" version="1.0.0">\r
-    <profile name="mobile"/>\r
-    <ui-application appid="org.tizen.fidosvcui" exec="/usr/apps/org.tizen.fidosvcui/bin/org.tizen.fidosvcui" multiple="false" nodisplay="true" taskmanage="false" type="capp">\r
-        <label>fidosvcui</label>\r
-        <icon>org.tizen.fidosvcui.png</icon>\r
-    </ui-application>\r
-    <privileges>\r
-        <privilege>http://tizen.org/privilege/account.read</privilege>\r
-        <privilege>http://tizen.org/privilege/account.write</privilege>\r
-    </privileges>\r
+       <profile name="mobile"/>\r
+       <ui-application appid="org.tizen.fidosvcui" exec="/usr/apps/org.tizen.fidosvcui/bin/org.tizen.fidosvcui" multiple="false" nodisplay="true" taskmanage="false" type="capp">\r
+               <label>fidosvcui</label>\r
+               <icon>org.tizen.fidosvcui.png</icon>\r
+       </ui-application>\r
+       <privileges>\r
+               <privilege>http://tizen.org/privilege/account.read</privilege>\r
+               <privilege>http://tizen.org/privilege/account.write</privilege>\r
+       </privileges>\r
 </manifest>\r
index d538384..d8b3dbb 100755 (executable)
@@ -160,8 +160,8 @@ typedef void (*fido_attestation_type_cb)(fido_auth_attestation_type_e att_type,
  * @retval     #FIDO_ERROR_NONE               Successful
  * @retval     #FIDO_ERROR_INVALID_PARAMETER  Invalid parameter
  */
-EXPORT_API int fido_authenticator_foreach_attestation_type(const fido_authenticator_h auth, fido_attestation_type_cb cb,
-                                                          void *user_data);
+EXPORT_API int fido_authenticator_foreach_attestation_type(const fido_authenticator_h auth,
+       fido_attestation_type_cb cb, void *user_data);
 
 /**
  * @brief Retrieves the user verification method of this Authenticator.
@@ -176,7 +176,7 @@ EXPORT_API int fido_authenticator_foreach_attestation_type(const fido_authentica
  * @retval     #FIDO_ERROR_INVALID_PARAMETER  Invalid parameter
  */
 EXPORT_API int fido_authenticator_get_verification_method(const fido_authenticator_h auth,
-                                                                                                                 fido_auth_user_verify_type_e *user_verification);
+       fido_auth_user_verify_type_e *user_verification);
 
 /**
  * @brief Retrieves the key protection method of this Authenticator.
@@ -191,7 +191,7 @@ EXPORT_API int fido_authenticator_get_verification_method(const fido_authenticat
  * @retval     #FIDO_ERROR_INVALID_PARAMETER  Invalid parameter
  */
 EXPORT_API int fido_authenticator_get_key_protection_method(const fido_authenticator_h auth,
-                                                                                                                       fido_auth_key_protection_type_e *key_protection);
+       fido_auth_key_protection_type_e *key_protection);
 
 /**
  * @brief Retrieves the matcher protection method of this Authenticator.
@@ -206,7 +206,7 @@ EXPORT_API int fido_authenticator_get_key_protection_method(const fido_authentic
  * @retval     #FIDO_ERROR_INVALID_PARAMETER  Invalid parameter
  */
 EXPORT_API int fido_authenticator_get_matcher_protection_method(const fido_authenticator_h auth,
-                                                                                                                               fido_auth_matcher_protection_type_e *matcher_protection);
+       fido_auth_matcher_protection_type_e *matcher_protection);
 
 /**
  * @brief Retrieves the attachment hint of this Authenticator.
@@ -221,7 +221,7 @@ EXPORT_API int fido_authenticator_get_matcher_protection_method(const fido_authe
  * @retval     #FIDO_ERROR_INVALID_PARAMETER  Invalid parameter
  */
 EXPORT_API int fido_authenticator_get_attachment_hint(const fido_authenticator_h auth,
-                                                                                                         fido_auth_attachment_hint_e *attachment_hint);
+       fido_auth_attachment_hint_e *attachment_hint);
 
 /**
  * @brief Checks if the Authenticator is Second factor only which is supported by U2F standards.
@@ -247,7 +247,7 @@ EXPORT_API bool fido_authenticator_get_is_second_factor_only(const fido_authenti
  * @retval     #FIDO_ERROR_INVALID_PARAMETER  Invalid parameter
  */
 EXPORT_API int fido_authenticator_get_tc_discplay(const fido_authenticator_h auth,
-                                                                                                 fido_auth_tc_display_type_e *tc_display);
+       fido_auth_tc_display_type_e *tc_display);
 
 /**
  * @brief Retrieves the Transaction Confirmation display content type of this Authenticator.
index c809a32..b759d3c 100755 (executable)
@@ -132,7 +132,7 @@ typedef void (*fido_uaf_response_message_cb) (fido_error_e tizen_error_code, con
  * @see fido_uaf_response_message_cb()
  */
 EXPORT_API int fido_uaf_get_response_message(const char *uaf_request_json, const char *channel_binding,
-                                          fido_uaf_response_message_cb callback, void *user_data);
+       fido_uaf_response_message_cb callback, void *user_data);
 
 /**
  * @brief Notifies the server result to the FIDO client. FIDO Server sends the result of processing a UAF message to FIDO client.
index 75b0fa5..97e8c31 100755 (executable)
@@ -1,5 +1,5 @@
 <manifest>
-    <request>
-        <domain name="_"/>
-    </request>
+       <request>
+               <domain name="_"/>
+       </request>
 </manifest>
old mode 100644 (file)
new mode 100755 (executable)
index ae0d947..41cbd57
@@ -23,42 +23,42 @@ pkg_check_modules(SERVER_pkgs REQUIRED
 )
 else()
 pkg_check_modules(SERVER_pkgs REQUIRED
-                dlog
-                glib-2.0
-                gio-unix-2.0
-                capi-base-common
-                json-glib-1.0
-                capi-appfw-application
-                aul
-                libsoup-2.4
-                capi-appfw-app-manager
-                openssl
-                bundle
+                               dlog
+                               glib-2.0
+                               gio-unix-2.0
+                               capi-base-common
+                               json-glib-1.0
+                               capi-appfw-application
+                               aul
+                               libsoup-2.4
+                               capi-appfw-app-manager
+                               openssl
+                               bundle
 )
 endif()
 
 FOREACH(flag ${SERVER_pkgs_CFLAGS})
-    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
 SET(SERVER_SRCS
-        fido_server.c
-        fido_asm_plugin_manager.c
-        fido_uaf_policy_checker.c
-        fido_selection_ui_adaptor.c
-        ../common/fido_uaf_utils.c
-        ../common/fido_json_handler.c
-        ../common/fido_tlv_util.c
-        fido_app_id_handler.c
-        ../common/fido_b64_util.c
-        fido_privilege_checker.c
+               fido_server.c
+               fido_asm_plugin_manager.c
+               fido_uaf_policy_checker.c
+               fido_selection_ui_adaptor.c
+               ../common/fido_uaf_utils.c
+               ../common/fido_json_handler.c
+               ../common/fido_tlv_util.c
+               fido_app_id_handler.c
+               ../common/fido_b64_util.c
+               fido_privilege_checker.c
 )
 
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common)
 
 ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_SOURCE_DIR}/common/fido-stub.c ${CMAKE_SOURCE_DIR}/common/fido-stub.h
 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/common/
-COMMAND gdbus-codegen --interface-prefix org.tizen. --generate-c-code fido-stub ${CMAKE_SOURCE_DIR}/common/dbus_interfaces/fido.xml 
+COMMAND gdbus-codegen --interface-prefix org.tizen. --generate-c-code fido-stub ${CMAKE_SOURCE_DIR}/common/dbus_interfaces/fido.xml
 COMMENT "Generating FIDO GDBus stubs........................")
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror")
@@ -77,4 +77,3 @@ add_definitions(-DWITH_JSON_BUILDER)
 else()
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/packaging/org.tizen.fido.service DESTINATION share/dbus-1/services)
 endif()
-
index 6ed3177..749b030 100644 (file)
 #define _MAX_NW_TIME_OUT 20
 
 typedef struct _app_id_cb_data {
-    char *caller_app_id;
-    char *real_app_id;
-    _facet_id_cb cb;
-    void *user_data;
-}_app_id_cb_data_t;
+       char *caller_app_id;
+       char *real_app_id;
+       _facet_id_cb cb;
+       void *user_data;
+} _app_id_cb_data_t;
 
 static inline int
 __read_proc(const char *path, char *buf, int size)
 {
-    int fd = 0;
-    int ret = 0;
-
-    if (buf == NULL || path == NULL) {
-        _ERR("path and buffer is mandatory\n");
-        return -1;
-    }
-
-    fd = open(path, O_RDONLY);
-    if (fd < 0) {
-        _ERR("fd open error(%d)\n", fd);
-        return -1;
-    }
-
-    ret = read(fd, buf, size - 1);
-    if (ret <= 0) {
-        _ERR("fd read error(%d)\n", fd);
-        close(fd);
-        return -1;
-    } else
-        buf[ret] = 0;
-
-    close(fd);
-
-    return ret;
+       int fd = 0;
+       int ret = 0;
+
+       if (buf == NULL || path == NULL) {
+               _ERR("path and buffer is mandatory\n");
+               return -1;
+       }
+
+       fd = open(path, O_RDONLY);
+       if (fd < 0) {
+               _ERR("fd open error(%d)\n", fd);
+               return -1;
+       }
+
+       ret = read(fd, buf, size - 1);
+       if (ret <= 0) {
+               _ERR("fd read error(%d)\n", fd);
+               close(fd);
+               return -1;
+       } else
+               buf[ret] = 0;
+
+       close(fd);
+
+       return ret;
 }
 
 static char*
 __get_appid_of_dbus_caller(GDBusMethodInvocation *invocation)
 {
-    pid_t remote_pid = 0;
-    GError *error = NULL;
-    GDBusConnection *connection = NULL;
-    GVariant *response = NULL;
-    guint32 upid;
-    const gchar *sender = NULL;
-
-    sender = g_dbus_method_invocation_get_sender (invocation);
-    if (!sender) {
-        _ERR("Failed to get sender");
-        return NULL;
-    }
-
-    connection = g_dbus_method_invocation_get_connection(invocation);
-    if (connection == NULL) {
-        _ERR("Failed to open connection for the invocation");
-        return NULL;
-    }
-
-    error = NULL;
-    response = g_dbus_connection_call_sync (connection,
-            _FREEDESKTOP_SERVICE, _FREEDESKTOP_PATH,
-            _FREEDESKTOP_INTERFACE, "GetConnectionUnixProcessID",
-            g_variant_new ("(s)", sender), ((const GVariantType *) "(u)"),
-            G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
-
-    //g_object_unref (connection);
-
-    if (response == NULL) {
-        _ERR("Failed to get caller id [%s]", error->message);
-        g_error_free (error);
-        return NULL;
-    }
-
-    g_variant_get (response, "(u)", &upid);
-    _INFO("Remote msg-bus peer service=%s pid=%u", sender, upid);
-    remote_pid = (pid_t) upid;
-
-    g_variant_unref (response);
-
-    char *app_id = NULL;
-    int ret = app_manager_get_app_id(remote_pid, &app_id);
-
-    if (app_id == NULL) {
-        _ERR("app_manager_get_app_id for %d failed = %d", remote_pid, ret);
-
-        /* Exception case : Daemons will not have app-ids, for them path will be set : /usr/bin/sample-service */
-        char buf[128];
-        int ret = 0;
-
-        snprintf(buf, sizeof(buf), "/proc/%d/cmdline", upid);
-        ret = __read_proc(buf, buf, sizeof(buf));
-        if (ret <= 0) {
-            _ERR("No proc directory (%d)\n", upid);
-            return NULL;
-        }
-
-        _INFO("Caller=[%s]", buf);
-
-        app_id = strdup(buf);
-    }
-
-
-    return app_id;
+       pid_t remote_pid = 0;
+       GError *error = NULL;
+       GDBusConnection *connection = NULL;
+       GVariant *response = NULL;
+       guint32 upid;
+       const gchar *sender = NULL;
+
+       sender = g_dbus_method_invocation_get_sender(invocation);
+       if (!sender) {
+               _ERR("Failed to get sender");
+               return NULL;
+       }
+
+       connection = g_dbus_method_invocation_get_connection(invocation);
+       if (connection == NULL) {
+               _ERR("Failed to open connection for the invocation");
+               return NULL;
+       }
+
+       error = NULL;
+       response = g_dbus_connection_call_sync(connection,
+                               _FREEDESKTOP_SERVICE, _FREEDESKTOP_PATH,
+                               _FREEDESKTOP_INTERFACE, "GetConnectionUnixProcessID",
+                               g_variant_new("(s)", sender), ((const GVariantType *) "(u)"),
+                               G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+
+       //g_object_unref (connection);
+
+       if (response == NULL) {
+               _ERR("Failed to get caller id [%s]", error->message);
+               g_error_free(error);
+               return NULL;
+       }
+
+       g_variant_get(response, "(u)", &upid);
+       _INFO("Remote msg-bus peer service=%s pid=%u", sender, upid);
+       remote_pid = (pid_t) upid;
+
+       g_variant_unref(response);
+
+       char *app_id = NULL;
+       int ret = app_manager_get_app_id(remote_pid, &app_id);
+
+       if (app_id == NULL) {
+               _ERR("app_manager_get_app_id for %d failed = %d", remote_pid, ret);
+
+               /* Exception case : Daemons will not have app-ids, for them path will be set : /usr/bin/sample-service */
+               char buf[128];
+               int ret = 0;
+
+               snprintf(buf, sizeof(buf), "/proc/%d/cmdline", upid);
+               ret = __read_proc(buf, buf, sizeof(buf));
+               if (ret <= 0) {
+                       _ERR("No proc directory (%d)\n", upid);
+                       return NULL;
+               }
+
+               _INFO("Caller=[%s]", buf);
+
+               app_id = strdup(buf);
+       }
+
+
+       return app_id;
 }
 
 static void
@@ -162,148 +162,149 @@ __soup_cb(SoupSession *session, SoupMessage *msg, gpointer user_data)
 
     _INFO("status_code = [%d]", msg->status_code);
 
-    CATCH_IF_FAIL_X(msg->status_code == SOUP_STATUS_OK, error_code = FIDO_ERROR_UNTRUSTED_FACET_ID);
+       CATCH_IF_FAIL_X(msg->status_code == SOUP_STATUS_OK, error_code = FIDO_ERROR_UNTRUSTED_FACET_ID);
 
-    request = soup_message_body_flatten(msg->response_body);
-    app_id_list = _uaf_parser_parse_trusted_facets(request->data);
+       request = soup_message_body_flatten(msg->response_body);
+       app_id_list = _uaf_parser_parse_trusted_facets(request->data);
 
-    soup_buffer_free(request);
-    request = NULL;
+       soup_buffer_free(request);
+       request = NULL;
 
-    if (app_id_list == NULL)
-        error_code = FIDO_ERROR_UNTRUSTED_FACET_ID;
+       if (app_id_list == NULL)
+               error_code = FIDO_ERROR_UNTRUSTED_FACET_ID;
 
-    GList *app_id_list_iter = app_id_list;
-    while (app_id_list_iter != NULL) {
-        char *id = (char *)(app_id_list_iter->data);
-        SoupURI *parsed_uri = soup_uri_new(id);
-        if (parsed_uri == NULL)
-            if (strcmp(cb_data->caller_app_id, id) == 0) {
-                real_app_id = strdup(id);
-                error_code = FIDO_ERROR_NONE;
-                break;
-            }
-        soup_uri_free(parsed_uri);
+       GList *app_id_list_iter = app_id_list;
+       while (app_id_list_iter != NULL) {
+               char *id = (char *)(app_id_list_iter->data);
+               SoupURI *parsed_uri = soup_uri_new(id);
+               if (parsed_uri == NULL)
+                       if (strcmp(cb_data->caller_app_id, id) == 0) {
+                               real_app_id = strdup(id);
+                               error_code = FIDO_ERROR_NONE;
+                               break;
+                       }
+               soup_uri_free(parsed_uri);
 
-        app_id_list_iter = app_id_list_iter->next;
-    }
+               app_id_list_iter = app_id_list_iter->next;
+       }
 
 CATCH:
-    (cb_data->cb)(error_code, real_app_id, cb_data->user_data);
+       (cb_data->cb)(error_code, real_app_id, cb_data->user_data);
 
-    if (app_id_list != NULL)
-        g_list_free_full(app_id_list, free);
+       if (app_id_list != NULL)
+               g_list_free_full(app_id_list, free);
 
-    SAFE_DELETE(real_app_id);
-    SAFE_DELETE(cb_data->real_app_id);
-    SAFE_DELETE(cb_data->caller_app_id);
-    SAFE_DELETE(cb_data);
+       SAFE_DELETE(real_app_id);
+       SAFE_DELETE(cb_data->real_app_id);
+       SAFE_DELETE(cb_data->caller_app_id);
+       SAFE_DELETE(cb_data);
 }
 
 static void
 _free_app_id_cb_data(_app_id_cb_data_t* data)
 {
-    _INFO("");
+       _INFO("");
 
-    RET_IF_FAIL_VOID(data != NULL);
+       RET_IF_FAIL_VOID(data != NULL);
 
-    SAFE_DELETE(data->real_app_id);
-    SAFE_DELETE(data->caller_app_id);
+       SAFE_DELETE(data->real_app_id);
+       SAFE_DELETE(data->caller_app_id);
 
-    SAFE_DELETE(data);
+       SAFE_DELETE(data);
 
-    _INFO("");
+       _INFO("");
 }
 
 static gboolean
 __timer_expired(gpointer data)
 {
-    _INFO("__timer_expired");
-    _app_id_cb_data_t *cb_data = (_app_id_cb_data_t*)data;
-    (cb_data->cb)(FIDO_ERROR_NONE, cb_data->real_app_id, cb_data->user_data);
+       _INFO("__timer_expired");
+       _app_id_cb_data_t *cb_data = (_app_id_cb_data_t*)data;
+       (cb_data->cb)(FIDO_ERROR_NONE, cb_data->real_app_id, cb_data->user_data);
 
-    _free_app_id_cb_data(cb_data);
+       _free_app_id_cb_data(cb_data);
 
-    return FALSE;
+       return FALSE;
 }
 
 int
 _verify_and_get_facet_id(const char *uaf_app_id, GDBusMethodInvocation *invocation, _facet_id_cb cb, void *user_data)
 {
-    _INFO("_verify_and_get_facet_id");
+       _INFO("_verify_and_get_facet_id");
 
-    char *app_id = __get_appid_of_dbus_caller(invocation);
-    if (app_id == NULL) {
-        return FIDO_ERROR_PERMISSION_DENIED;
-    }
+       char *app_id = __get_appid_of_dbus_caller(invocation);
+       if (app_id == NULL) {
+               return FIDO_ERROR_PERMISSION_DENIED;
+       }
 
-    _app_id_cb_data_t *cb_data = (_app_id_cb_data_t*)calloc(1, sizeof(_app_id_cb_data_t));
-    if (cb_data == NULL)
-        return FIDO_ERROR_OUT_OF_MEMORY;
+       _app_id_cb_data_t *cb_data = (_app_id_cb_data_t*)calloc(1, sizeof(_app_id_cb_data_t));
+       if (cb_data == NULL)
+               return FIDO_ERROR_OUT_OF_MEMORY;
 
-    cb_data->caller_app_id = app_id;
-    cb_data->cb = cb;
-    cb_data->user_data = user_data;
+       cb_data->caller_app_id = app_id;
+       cb_data->cb = cb;
+       cb_data->user_data = user_data;
 
-    if (uaf_app_id == NULL) {
-         cb_data->real_app_id = strdup(app_id);
-         g_timeout_add(2, __timer_expired, cb_data);
-         return FIDO_ERROR_NONE;
-    }
+       if (uaf_app_id == NULL) {
+                cb_data->real_app_id = strdup(app_id);
+                g_timeout_add(2, __timer_expired, cb_data);
+                return FIDO_ERROR_NONE;
+       }
 
 
-    SoupURI *parsed_uri = soup_uri_new(uaf_app_id);
+       SoupURI *parsed_uri = soup_uri_new(uaf_app_id);
 
-    if (parsed_uri == NULL) {
+       if (parsed_uri == NULL) {
 
-        if (strcmp(app_id, uaf_app_id) == 0) {
-            cb_data->real_app_id = strdup(uaf_app_id);
-            g_timeout_add(2, __timer_expired, cb_data);
-            return FIDO_ERROR_NONE;
-        }
-        else {
-            _free_app_id_cb_data(cb_data);
-            return FIDO_ERROR_PERMISSION_DENIED;
-        }
-    }
+               if (strcmp(app_id, uaf_app_id) == 0) {
+                       cb_data->real_app_id = strdup(uaf_app_id);
+                       g_timeout_add(2, __timer_expired, cb_data);
+                       return FIDO_ERROR_NONE;
+               } else {
+                       _free_app_id_cb_data(cb_data);
+                       return FIDO_ERROR_PERMISSION_DENIED;
+               }
+       }
 
-    const char *scheme = soup_uri_get_scheme(parsed_uri);
-    if (scheme == NULL) {
-         _free_app_id_cb_data(cb_data);
-         return FIDO_ERROR_INVALID_PARAMETER;
-    }
+       const char *scheme = soup_uri_get_scheme(parsed_uri);
+       if (scheme == NULL) {
+                _free_app_id_cb_data(cb_data);
+                return FIDO_ERROR_INVALID_PARAMETER;
+       }
 
-    if (strcmp(SOUP_URI_SCHEME_HTTPS, scheme) != 0) {
-        _free_app_id_cb_data(cb_data);
-        return FIDO_ERROR_INVALID_PARAMETER;
-    }
+       if (strcmp(SOUP_URI_SCHEME_HTTPS, scheme) != 0) {
+               _free_app_id_cb_data(cb_data);
+               return FIDO_ERROR_INVALID_PARAMETER;
+       }
 
-    _INFO("%s", uaf_app_id);
+       _INFO("%s", uaf_app_id);
 
-    SoupMessage *soup_message = soup_message_new_from_uri ("GET", parsed_uri);
+       SoupMessage *soup_message = soup_message_new_from_uri("GET", parsed_uri);
 
-    soup_uri_free(parsed_uri);
+       soup_uri_free(parsed_uri);
 
 #ifdef WITH_JSON_HANDLER
-    SoupSession *session = soup_session_new_with_options(
-                SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_PROXY_RESOLVER_DEFAULT,
-                SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE,
-                SOUP_SESSION_TIMEOUT, _MAX_NW_TIME_OUT,
-                NULL);
+       SoupSession *session = soup_session_new_with_options(
+                                                       SOUP_SESSION_ADD_FEATURE_BY_TYPE,
+                                                       SOUP_TYPE_PROXY_RESOLVER_DEFAULT,
+                                                       SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE,
+                                                       SOUP_SESSION_TIMEOUT, _MAX_NW_TIME_OUT,
+                                                       NULL);
 #else
-    SoupSession *session = soup_session_async_new_with_options(
-                SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_PROXY_RESOLVER_DEFAULT,
-                SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE,
-                SOUP_SESSION_TIMEOUT, _MAX_NW_TIME_OUT,
-                NULL);
+       SoupSession *session = soup_session_async_new_with_options(
+                                                       SOUP_SESSION_ADD_FEATURE_BY_TYPE,
+                                                       SOUP_TYPE_PROXY_RESOLVER_DEFAULT,
+                                                       SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE,
+                                                       SOUP_SESSION_TIMEOUT, _MAX_NW_TIME_OUT,
+                                                       NULL);
 #endif
 
-    bool ssl_strict = FALSE;//changed to make sure https cert errors dont occur, only for testing
-    g_object_set(session, "ssl-strict", ssl_strict, NULL);
+       bool ssl_strict = FALSE;//changed to make sure https cert errors dont occur, only for testing
+       g_object_set(session, "ssl-strict", ssl_strict, NULL);
 
-    soup_session_queue_message(session, soup_message, __soup_cb, cb_data);
+       soup_session_queue_message(session, soup_message, __soup_cb, cb_data);
 
-    _INFO("Added in soup_session_queue_message");
+       _INFO("Added in soup_session_queue_message");
 
-    return FIDO_ERROR_NONE;
+       return FIDO_ERROR_NONE;
 }
index 2e02620..f4caab8 100644 (file)
 #define _ASM_CONF_DIR_PATH_64 "/usr/lib64/fido/asm/"
 
 typedef struct _asm_ipc_cb_data {
-    _asm_ipc_response_cb cb;
-    void *user_data;
+       _asm_ipc_response_cb cb;
+       void *user_data;
 } _asm_ipc_cb_data_t;
 
 typedef struct _asm_ipc_discover_cb_data {
-    _asm_plugin_discover_response_cb cb;
-    GList *asm_proxy_list_iter;
-    void *user_data;
-    GList *asm_resp_list;
+       _asm_plugin_discover_response_cb cb;
+       GList *asm_proxy_list_iter;
+       void *user_data;
+       GList *asm_resp_list;
 } _asm_ipc_discover_cb_data_t;
 
 static GHashTable *asm_proxy_table = NULL;
@@ -53,79 +53,77 @@ static GFileMonitor *__monitor = NULL;
 static GDBusConnection *
 __get_dbus_connection(void)
 {
-    GError *error = NULL;
+       GError *error = NULL;
 
-    GDBusConnection *dbus_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+       GDBusConnection *dbus_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
 
-    if (dbus_conn == NULL) {
-        _ERR("Unable to connect to dbus: %s", error->message);
-        g_clear_error(&error);
-    }
+       if (dbus_conn == NULL) {
+               _ERR("Unable to connect to dbus: %s", error->message);
+               g_clear_error(&error);
+       }
 
-    return dbus_conn;
+       return dbus_conn;
 }
 
 static GDBusProxy*
 __get_dbus_proxy(const char *dbus_name, const char *obj_path,
-                 const char *intf_name)
+                               const char *intf_name)
 {
-    GDBusConnection *conn = __get_dbus_connection();
-    if (conn == NULL)
-        return NULL;
+       GDBusConnection *conn = __get_dbus_connection();
+       if (conn == NULL)
+               return NULL;
 
-    GError *err = NULL;
+       GError *err = NULL;
 
-    GDBusProxy *dbus_proxy = g_dbus_proxy_new_sync(conn,
-                                        G_DBUS_PROXY_FLAGS_NONE,
-                                        NULL,
-                                        dbus_name,
-                                        obj_path,
-                                        intf_name,
-                                        NULL,
-                                        &err);
+       GDBusProxy *dbus_proxy = g_dbus_proxy_new_sync(conn,
+                                                               G_DBUS_PROXY_FLAGS_NONE,
+                                                               NULL,
+                                                               dbus_name,
+                                                               obj_path,
+                                                               intf_name,
+                                                               NULL,
+                                                               &err);
 
-    if (err != NULL)
-        _ERR("g_dbus_proxy_new_sync failed [%d][%s]", err->code, err->message);
+       if (err != NULL)
+               _ERR("g_dbus_proxy_new_sync failed [%d][%s]", err->code, err->message);
 
-    return dbus_proxy;
+       return dbus_proxy;
 }
 
 static void
 __free_asm_proxy_data(gpointer data)
 {
-    if (data != NULL) {
-        _fido_asm_proxy_t *proxy = data;
-
-        SAFE_DELETE(proxy->bin_path);
-        SAFE_DELETE(proxy->dbus_info);
-        SAFE_DELETE(proxy->dbus_interface_name);
-        SAFE_DELETE(proxy->dbus_method_name);
-        SAFE_DELETE(proxy->dbus_obj_path);
-        SAFE_DELETE(proxy->vendor);
-
-        SAFE_DELETE(proxy);
-    }
-
-
+       if (data != NULL) {
+               _fido_asm_proxy_t *proxy = data;
+
+               SAFE_DELETE(proxy->bin_path);
+               SAFE_DELETE(proxy->dbus_info);
+               SAFE_DELETE(proxy->dbus_interface_name);
+               SAFE_DELETE(proxy->dbus_method_name);
+               SAFE_DELETE(proxy->dbus_obj_path);
+               SAFE_DELETE(proxy->vendor);
+
+               SAFE_DELETE(proxy);
+       }
 }
 
 static int
 __load_plugins(char **plugin_path)
 {
-    if (asm_proxy_table != NULL) {
-        g_hash_table_destroy(asm_proxy_table);
-        asm_proxy_table = NULL;
-    }
+       if (asm_proxy_table != NULL) {
+               g_hash_table_destroy(asm_proxy_table);
+               asm_proxy_table = NULL;
+       }
 
-    asm_proxy_table = g_hash_table_new_full(g_str_hash, g_str_equal, free, _free_fido_asm_proxy);
+       asm_proxy_table = g_hash_table_new_full(g_str_hash, g_str_equal, free, _free_fido_asm_proxy);
 
-    DIR *dir;
+       DIR *dir;
        struct dirent entry;
        struct dirent *result;
-    bool is_64 = true;
+       bool is_64 = true;
 
-    dir = opendir(_ASM_CONF_DIR_PATH_64);
-    if (dir == NULL) {
+       dir = opendir(_ASM_CONF_DIR_PATH_64);
+       if (dir == NULL) {
 
                dir = opendir(_ASM_CONF_DIR_PATH);
                if (dir == NULL) {
@@ -134,7 +132,7 @@ __load_plugins(char **plugin_path)
                        return FIDO_ERROR_PERMISSION_DENIED;
                }
                is_64 = false;
-    }
+       }
 
        *plugin_path = calloc(1, 128);
        if (is_64 == true)
@@ -142,54 +140,52 @@ __load_plugins(char **plugin_path)
        else
                snprintf(*plugin_path, 127, _ASM_CONF_DIR_PATH);
 
-    bool is_asm_found = false;
+       bool is_asm_found = false;
 
-    _INFO("Loading ASM conf files from [%s]", *plugin_path);
+       _INFO("Loading ASM conf files from [%s]", *plugin_path);
 
        while ((readdir_r(dir, &entry, &result) == 0)
-                  && (result != NULL)) {
+               && (result != NULL)) {
                if (entry.d_type == DT_REG) {
                        char *conf_file_name = entry.d_name;
-            if (conf_file_name != NULL) {
-                char conf_file_name_full[128] = {0, };
-                /*TODO make safe size*/
-                snprintf(conf_file_name_full, 127, "%s%s", *plugin_path, conf_file_name);
-                _INFO("Processing [%s]", conf_file_name_full);
-                _fido_asm_proxy_t *asm_proxy = _parse_asm_conf_file(conf_file_name_full);
-                if (asm_proxy != NULL) {
-                    asm_proxy->dbus_proxy = __get_dbus_proxy(asm_proxy->dbus_info, asm_proxy->dbus_obj_path,
-                                                             asm_proxy->dbus_interface_name);
-                    if (asm_proxy->dbus_proxy != NULL) {
-                        is_asm_found = true;
-
-                        asm_proxy->asm_id = strdup(conf_file_name);
-                        g_hash_table_insert(asm_proxy_table, strdup(conf_file_name), asm_proxy);
-                    }
-                    else {
-                        _ERR("Failed to get dbus proxy for the ASM");
-                        __free_asm_proxy_data((gpointer)asm_proxy);
-                    }
-                }
-
-            }
-        }
-    }
-
-    closedir(dir);
-
-    if (is_asm_found == false)
-        return FIDO_ERROR_NOT_SUPPORTED;
-
-    return FIDO_ERROR_NONE;
+                       if (conf_file_name != NULL) {
+                               char conf_file_name_full[128] = {0, };
+                               /*TODO make safe size*/
+                               snprintf(conf_file_name_full, 127, "%s%s", *plugin_path, conf_file_name);
+                               _INFO("Processing [%s]", conf_file_name_full);
+                               _fido_asm_proxy_t *asm_proxy = _parse_asm_conf_file(conf_file_name_full);
+                               if (asm_proxy != NULL) {
+                                       asm_proxy->dbus_proxy = __get_dbus_proxy(asm_proxy->dbus_info, asm_proxy->dbus_obj_path,
+                                                                                                                       asm_proxy->dbus_interface_name);
+                                       if (asm_proxy->dbus_proxy != NULL) {
+                                               is_asm_found = true;
+
+                                               asm_proxy->asm_id = strdup(conf_file_name);
+                                               g_hash_table_insert(asm_proxy_table, strdup(conf_file_name), asm_proxy);
+                                       } else {
+                                               _ERR("Failed to get dbus proxy for the ASM");
+                                               __free_asm_proxy_data((gpointer)asm_proxy);
+                                       }
+                               }
+                       }
+               }
+       }
+
+       closedir(dir);
+
+       if (is_asm_found == false)
+               return FIDO_ERROR_NOT_SUPPORTED;
+
+       return FIDO_ERROR_NONE;
 }
 
 static void
 __plugin_changed_cb(GFileMonitor *monitor, GFile *file, GFile *other_file, GFileMonitorEvent event_type,
-               void* user_data)
+                       void* user_data)
 {
        char *plugin_path = NULL;
-    int ret = __load_plugins(&plugin_path);
-    _INFO("__load_plugins=[%d]", ret);
+       int ret = __load_plugins(&plugin_path);
+       _INFO("__load_plugins=[%d]", ret);
 
        SAFE_DELETE(plugin_path);
 }
@@ -197,289 +193,285 @@ __plugin_changed_cb(GFileMonitor *monitor, GFile *file, GFile *other_file, GFile
 static void
 __set_up_watcher(const char *watch_path)
 {
-    if ((watch_path == NULL)
-            || (strlen(watch_path) == 0))
-        return;
+       if ((watch_path == NULL)
+                       || (strlen(watch_path) == 0))
+               return;
 
-    GFile* file = g_file_new_for_path(watch_path);
+       GFile* file = g_file_new_for_path(watch_path);
 
-    if (__monitor != NULL)
-        g_object_unref(__monitor);
+       if (__monitor != NULL)
+               g_object_unref(__monitor);
 
-    __monitor = g_file_monitor(file, G_FILE_MONITOR_NONE, NULL, NULL);
-    g_object_unref(file);
+       __monitor = g_file_monitor(file, G_FILE_MONITOR_NONE, NULL, NULL);
+       g_object_unref(file);
 
-    if (__monitor == NULL)
-        return;
+       if (__monitor == NULL)
+               return;
 
-    g_signal_connect(__monitor, "changed", G_CALLBACK(__plugin_changed_cb), NULL);
+       g_signal_connect(__monitor, "changed", G_CALLBACK(__plugin_changed_cb), NULL);
 }
 
 int
 _asm_plugin_mgr_init(void)
 {
-
-    _INFO("_asm_plugin_mgr_init start");
+       _INFO("_asm_plugin_mgr_init start");
 
        char *plugin_path = NULL;
-    int ret = __load_plugins(&plugin_path);
-    _INFO("__load_plugins=[%d]", ret);
+       int ret = __load_plugins(&plugin_path);
+       _INFO("__load_plugins=[%d]", ret);
 
-    __set_up_watcher(plugin_path);
+       __set_up_watcher(plugin_path);
 
        SAFE_DELETE(plugin_path);
 
-    /*Ignored load_plugins error, since ASM might get installed later*/
-    return FIDO_ERROR_NONE;
+       /*Ignored load_plugins error, since ASM might get installed later*/
+       return FIDO_ERROR_NONE;
 }
 
 void
 _asm_plugin_mgr_destroy(void)
 {
-    if (asm_proxy_table != NULL) {
-        g_hash_table_destroy(asm_proxy_table);
-        asm_proxy_table = NULL;
-    }
-    if (__monitor != NULL)
-        g_object_unref(__monitor);
+       if (asm_proxy_table != NULL) {
+               g_hash_table_destroy(asm_proxy_table);
+               asm_proxy_table = NULL;
+       }
+       if (__monitor != NULL)
+               g_object_unref(__monitor);
 }
 
 static void
 __discover_cb_internal(int error_code, const char *asm_response_json, void *user_data)
 {
-    _asm_ipc_discover_cb_data_t *cb_data = user_data;
+       _asm_ipc_discover_cb_data_t *cb_data = user_data;
 
-    _asm_discover_response_t *response_info = calloc(1, sizeof(_asm_discover_response_t));
-    response_info->error_code = error_code;
-    if (asm_response_json != NULL)
-        response_info->asm_response_json = strdup(asm_response_json);
+       _asm_discover_response_t *response_info = calloc(1, sizeof(_asm_discover_response_t));
+       response_info->error_code = error_code;
+       if (asm_response_json != NULL)
+               response_info->asm_response_json = strdup(asm_response_json);
 
-    _fido_asm_proxy_t *asm_proxy = (_fido_asm_proxy_t*)(cb_data->asm_proxy_list_iter->data);
-    response_info->asm_id = strdup(asm_proxy->asm_id);
+       _fido_asm_proxy_t *asm_proxy = (_fido_asm_proxy_t*)(cb_data->asm_proxy_list_iter->data);
+       response_info->asm_id = strdup(asm_proxy->asm_id);
 
-    cb_data->asm_resp_list = g_list_append(cb_data->asm_resp_list, response_info);
+       cb_data->asm_resp_list = g_list_append(cb_data->asm_resp_list, response_info);
 
-    cb_data->asm_proxy_list_iter = g_list_next(cb_data->asm_proxy_list_iter);
-    if (cb_data->asm_proxy_list_iter == NULL) {
-        _INFO("All ASM processing finished");
+       cb_data->asm_proxy_list_iter = g_list_next(cb_data->asm_proxy_list_iter);
+       if (cb_data->asm_proxy_list_iter == NULL) {
+               _INFO("All ASM processing finished");
 
-        cb_data->asm_resp_list = g_list_first(cb_data->asm_resp_list);
-        (cb_data->cb)(cb_data->asm_resp_list, cb_data->user_data);
+               cb_data->asm_resp_list = g_list_first(cb_data->asm_resp_list);
+               (cb_data->cb)(cb_data->asm_resp_list, cb_data->user_data);
 
-        cb_data->asm_proxy_list_iter = g_list_first(cb_data->asm_proxy_list_iter);
-        g_list_free(cb_data->asm_proxy_list_iter);
+               cb_data->asm_proxy_list_iter = g_list_first(cb_data->asm_proxy_list_iter);
+               g_list_free(cb_data->asm_proxy_list_iter);
 
-        SAFE_DELETE(cb_data);
-    }
-    else {
-
-        _fido_asm_proxy_t *asm_proxy = (_fido_asm_proxy_t*)(cb_data->asm_proxy_list_iter->data);
-        int ret = _asm_ipc_send(asm_proxy->asm_id, _GET_INFO_ASM_REQUEST_JSON, __discover_cb_internal, cb_data);
-        if (ret != FIDO_ERROR_NONE)
-            __discover_cb_internal(ret, NULL, user_data);
-    }
+               SAFE_DELETE(cb_data);
+       } else {
 
+               _fido_asm_proxy_t *asm_proxy = (_fido_asm_proxy_t*)(cb_data->asm_proxy_list_iter->data);
+               int ret = _asm_ipc_send(asm_proxy->asm_id, _GET_INFO_ASM_REQUEST_JSON, __discover_cb_internal, cb_data);
+               if (ret != FIDO_ERROR_NONE)
+                       __discover_cb_internal(ret, NULL, user_data);
+       }
 }
 
 int
 _asm_plugin_mgr_discover_all(_asm_plugin_discover_response_cb cb, void *user_data)
 {
-    if (asm_proxy_table == NULL
-            || g_hash_table_size(asm_proxy_table) <= 0) {
-        _ERR("No ASM found");
-        return FIDO_ERROR_NOT_SUPPORTED;
-    }
+       if (asm_proxy_table == NULL
+                       || g_hash_table_size(asm_proxy_table) <= 0) {
+               _ERR("No ASM found");
+               return FIDO_ERROR_NOT_SUPPORTED;
+       }
 
-    _asm_ipc_discover_cb_data_t *cb_data = calloc(1, sizeof(_asm_ipc_discover_cb_data_t));
-    if (cb_data == NULL)
-        return -1;
+       _asm_ipc_discover_cb_data_t *cb_data = calloc(1, sizeof(_asm_ipc_discover_cb_data_t));
+       if (cb_data == NULL)
+               return -1;
 
-    cb_data->cb = cb;
-    cb_data->asm_proxy_list_iter = g_hash_table_get_values(asm_proxy_table);
+       cb_data->cb = cb;
+       cb_data->asm_proxy_list_iter = g_hash_table_get_values(asm_proxy_table);
 
-    cb_data->user_data = user_data;
+       cb_data->user_data = user_data;
 
-    _fido_asm_proxy_t *asm_proxy = (_fido_asm_proxy_t*)(cb_data->asm_proxy_list_iter->data);
+       _fido_asm_proxy_t *asm_proxy = (_fido_asm_proxy_t*)(cb_data->asm_proxy_list_iter->data);
 
-    return _asm_ipc_send(asm_proxy->asm_id, _GET_INFO_ASM_REQUEST_JSON, __discover_cb_internal, cb_data);
+       return _asm_ipc_send(asm_proxy->asm_id, _GET_INFO_ASM_REQUEST_JSON, __discover_cb_internal, cb_data);
 }
 
 static void
 _on_asm_dbus_reply(GObject *proxy, GAsyncResult *res, gpointer user_data)
 {
-    _INFO("_on_asm_dbus_reply");
-
-    GError *dbus_err = NULL;
+       _INFO("_on_asm_dbus_reply");
 
-    if (user_data == NULL) {
-        _ERR("Can not proceed since callback data is NULL");
-        return;
-    }
+       GError *dbus_err = NULL;
 
-    _asm_ipc_cb_data_t *cb_data = (_asm_ipc_cb_data_t *)user_data;
-    if (cb_data == NULL) {
-        _ERR("Can not proceed since callback data is NULL");
-        return;
-    }
+       if (user_data == NULL) {
+               _ERR("Can not proceed since callback data is NULL");
+               return;
+       }
 
-    if (cb_data->cb == NULL) {
-        _ERR("Can not proceed since callback data's cb part is NULL");
-        return;
-    }
+       _asm_ipc_cb_data_t *cb_data = (_asm_ipc_cb_data_t *)user_data;
+       if (cb_data == NULL) {
+               _ERR("Can not proceed since callback data is NULL");
+               return;
+       }
 
-    int tizen_err = FIDO_ERROR_NONE;
-    char *asm_response_json = NULL;
+       if (cb_data->cb == NULL) {
+               _ERR("Can not proceed since callback data's cb part is NULL");
+               return;
+       }
 
-    GError *error = NULL;
+       int tizen_err = FIDO_ERROR_NONE;
+       char *asm_response_json = NULL;
 
-    /*For dereg request, ASM does not send any reponse, so this is not error for dereg*/
-    GVariant *dbus_resp = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, &error);
-    if (dbus_resp == NULL) {
-        _ERR("g_dbus_proxy_call_finish failed  with [%d][%s]", error->code, error->message);
-        (cb_data->cb)(FIDO_ERROR_PERMISSION_DENIED, NULL, cb_data->user_data);
+       GError *error = NULL;
 
-        SAFE_DELETE(cb_data);
+       /*For dereg request, ASM does not send any reponse, so this is not error for dereg*/
+       GVariant *dbus_resp = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, &error);
+       if (dbus_resp == NULL) {
+               _ERR("g_dbus_proxy_call_finish failed  with [%d][%s]", error->code, error->message);
+               (cb_data->cb)(FIDO_ERROR_PERMISSION_DENIED, NULL, cb_data->user_data);
 
-        return;
-    }
+               SAFE_DELETE(cb_data);
 
-    g_variant_get(dbus_resp, "(is)",
-                   &tizen_err,
-                   &asm_response_json);
+               return;
+       }
 
+       g_variant_get(dbus_resp, "(is)",
+                                  &tizen_err,
+                                  &asm_response_json);
 
-    g_clear_error(&dbus_err);
+       g_clear_error(&dbus_err);
 
-    if (asm_response_json != NULL)
-        _INFO("asm_response_json=[%s]", asm_response_json);
+       if (asm_response_json != NULL)
+               _INFO("asm_response_json=[%s]", asm_response_json);
 
-    (cb_data->cb)(tizen_err, asm_response_json, cb_data->user_data);
+       (cb_data->cb)(tizen_err, asm_response_json, cb_data->user_data);
 
-    if (dbus_resp != NULL)
-        g_variant_unref(dbus_resp);
+       if (dbus_resp != NULL)
+               g_variant_unref(dbus_resp);
 
-    SAFE_DELETE(cb_data);
+       SAFE_DELETE(cb_data);
 }
 
 static char*
 __get_asm_req_dbus_method_name(const char *intf_name, const char *dbus_method_name)
 {
-    char *method_name = (char *)calloc(1, 128);
-    if (method_name == NULL)
-        return NULL;
+       char *method_name = (char *)calloc(1, 128);
+       if (method_name == NULL)
+               return NULL;
 
-    snprintf(method_name, 127, "%s.%s", intf_name, dbus_method_name);
+       snprintf(method_name, 127, "%s.%s", intf_name, dbus_method_name);
 
-    return method_name;
+       return method_name;
 }
 
 int
 _asm_ipc_send(const char *asm_id, const char *asm_request, _asm_ipc_response_cb cb, void *user_data)
 {
-    _INFO("asm_request=[%s]", asm_request);
+       _INFO("asm_request=[%s]", asm_request);
 
-    if (asm_id == NULL) {
-        _ERR("dbus proxy failed");
-        return FIDO_ERROR_NOT_SUPPORTED;
-    }
+       if (asm_id == NULL) {
+               _ERR("dbus proxy failed");
+               return FIDO_ERROR_NOT_SUPPORTED;
+       }
 
-    _fido_asm_proxy_t *asm_proxy = g_hash_table_lookup(asm_proxy_table, asm_id);
-    if (asm_proxy == NULL) {
-        _ERR("dbus proxy failed");
-        return FIDO_ERROR_NOT_SUPPORTED;
-    }
+       _fido_asm_proxy_t *asm_proxy = g_hash_table_lookup(asm_proxy_table, asm_id);
+       if (asm_proxy == NULL) {
+               _ERR("dbus proxy failed");
+               return FIDO_ERROR_NOT_SUPPORTED;
+       }
 
-    _INFO("For=[%s]", asm_id);
+       _INFO("For=[%s]", asm_id);
 
-    if (asm_proxy->dbus_info != NULL)
-        _INFO("For DBUS = [%s]", asm_proxy->dbus_info);
+       if (asm_proxy->dbus_info != NULL)
+               _INFO("For DBUS = [%s]", asm_proxy->dbus_info);
 
-    _asm_ipc_cb_data_t *cb_data = (_asm_ipc_cb_data_t*)calloc(1, sizeof(_asm_ipc_cb_data_t));
-    if (cb_data == NULL)
-        return -1;
+       _asm_ipc_cb_data_t *cb_data = (_asm_ipc_cb_data_t*)calloc(1, sizeof(_asm_ipc_cb_data_t));
+       if (cb_data == NULL)
+               return -1;
 
-    cb_data->cb = cb;
-    cb_data->user_data = user_data;
+       cb_data->cb = cb;
+       cb_data->user_data = user_data;
 
-    char *method_name = __get_asm_req_dbus_method_name(asm_proxy->dbus_interface_name,
-                                                       asm_proxy->dbus_method_name);
-    if (method_name == NULL) {
+       char *method_name = __get_asm_req_dbus_method_name(asm_proxy->dbus_interface_name,
+                                                       asm_proxy->dbus_method_name);
+       if (method_name == NULL) {
 
-        SAFE_DELETE(cb_data);
-        return FIDO_ERROR_OUT_OF_MEMORY;
-    }
+               SAFE_DELETE(cb_data);
+               return FIDO_ERROR_OUT_OF_MEMORY;
+       }
 
-    g_dbus_proxy_call(asm_proxy->dbus_proxy,
-                        method_name,
-                        g_variant_new ("(s)",
-                        asm_request),
-                        G_DBUS_CALL_FLAGS_NONE,
-                        _DBUS_TIMEOUT_INFINITE,
-                        NULL,
-                        _on_asm_dbus_reply,
-                        cb_data);
+       g_dbus_proxy_call(asm_proxy->dbus_proxy,
+               method_name,
+               g_variant_new("(s)",
+               asm_request),
+               G_DBUS_CALL_FLAGS_NONE,
+               _DBUS_TIMEOUT_INFINITE,
+               NULL,
+               _on_asm_dbus_reply,
+               cb_data);
 
-    SAFE_DELETE(method_name);
+       SAFE_DELETE(method_name);
 
-    return 0;
+       return 0;
 }
 
 char *
 _asm_ipc_send_sync(const char *asm_id, const char *asm_req)
 {
-    _INFO("_asm_ipc_send_sync");
+       _INFO("_asm_ipc_send_sync");
 
-    if (asm_id == NULL) {
-        _ERR("dbus proxy failed");
-        return NULL;
-    }
+       if (asm_id == NULL) {
+               _ERR("dbus proxy failed");
+               return NULL;
+       }
 
-    _INFO("For=[%s]", asm_id);
+       _INFO("For=[%s]", asm_id);
 
-    _fido_asm_proxy_t *asm_proxy = g_hash_table_lookup(asm_proxy_table, asm_id);
-    if (asm_proxy == NULL) {
-        _ERR("dbus proxy failed");
-        return NULL;
-    }
+       _fido_asm_proxy_t *asm_proxy = g_hash_table_lookup(asm_proxy_table, asm_id);
+       if (asm_proxy == NULL) {
+               _ERR("dbus proxy failed");
+               return NULL;
+       }
 
-    if (asm_proxy->dbus_info != NULL)
-        _INFO("For DBUS = [%s]", asm_proxy->dbus_info);
+       if (asm_proxy->dbus_info != NULL)
+               _INFO("For DBUS = [%s]", asm_proxy->dbus_info);
 
-    int tz_err = FIDO_ERROR_NONE;
-    char *asm_res_json = NULL;
+       int tz_err = FIDO_ERROR_NONE;
+       char *asm_res_json = NULL;
 
-    GError *error = NULL;
-    GVariant *_ret;
+       GError *error = NULL;
+       GVariant *_ret;
 
-    char *method_name = __get_asm_req_dbus_method_name(asm_proxy->dbus_interface_name,
-                                                       asm_proxy->dbus_method_name);
+       char *method_name = __get_asm_req_dbus_method_name(asm_proxy->dbus_interface_name,
+                                                       asm_proxy->dbus_method_name);
 
-    if (method_name == NULL)
-        return NULL;
+       if (method_name == NULL)
+               return NULL;
 
-    _ret = g_dbus_proxy_call_sync(asm_proxy->dbus_proxy,
-                                  method_name,
-                                  g_variant_new ("(s)",
-                                  asm_req),
-                                  G_DBUS_CALL_FLAGS_NONE,
-                                  _DBUS_TIMEOUT_USE_DEFAULT,
-                                  NULL,
-                                  &error);
+       _ret = g_dbus_proxy_call_sync(asm_proxy->dbus_proxy,
+                       method_name,
+                       g_variant_new("(s)",
+                       asm_req),
+                       G_DBUS_CALL_FLAGS_NONE,
+                       _DBUS_TIMEOUT_USE_DEFAULT,
+                       NULL,
+                       &error);
 
-    if (error != NULL)
-        _ERR("g_dbus_proxy_call_sync failed [%s]", error->message);
-    else
-        _INFO("g_dbus_proxy_call_sync success");
+       if (error != NULL)
+               _ERR("g_dbus_proxy_call_sync failed [%s]", error->message);
+       else
+               _INFO("g_dbus_proxy_call_sync success");
 
-    if (_ret == NULL)
-      goto CATCH;
+       if (_ret == NULL)
+               goto CATCH;
 
-    g_variant_get (_ret, "(is)", &tz_err, &asm_res_json);
-    if (asm_res_json != NULL)
-        _INFO("ASM returned = %s", asm_res_json);
+       g_variant_get(_ret, "(is)", &tz_err, &asm_res_json);
+       if (asm_res_json != NULL)
+               _INFO("ASM returned = %s", asm_res_json);
 
-    //g_variant_unref (_ret);
+       //g_variant_unref (_ret);
 
 CATCH:
-    return asm_res_json;
+       return asm_res_json;
 }
index 3d2344a..620e1cc 100644 (file)
@@ -32,170 +32,167 @@ static cynara *__cynara = NULL;
 static guint
 _get_client_pid(GDBusMethodInvocation* invoc)
 {
-    const char *name = NULL;
-    name = g_dbus_method_invocation_get_sender(invoc);
-    if (name == NULL)
-    {
-        _ERR("g_dbus_method_invocation_get_sender failed");
-        return -1;
-    }
-    _INFO("sender=[%s]", name);
-
-
-    guint pid = -1;
-    GError *error = NULL;
-    GVariant *_ret;
-
-    _INFO("calling GetConnectionUnixProcessID");
-
-    GDBusConnection* conn = g_dbus_method_invocation_get_connection(invoc);
-    _ret = g_dbus_connection_call_sync(conn,
-            "org.freedesktop.DBus",
-            "/org/freedesktop/DBus",
-            "org.freedesktop.DBus",
-            "GetConnectionUnixProcessID",
-            g_variant_new("(s)", name),
-            NULL,
-            G_DBUS_CALL_FLAGS_NONE,
-            -1,
-            NULL,
-            &error);
-
-    if (_ret != NULL) {
-        g_variant_get(_ret, "(u)", &pid);
-        g_variant_unref(_ret);
-    }
-
-    _INFO("process Id = [%u]", pid);
-    return pid;
+       const char *name = NULL;
+       name = g_dbus_method_invocation_get_sender(invoc);
+       if (name == NULL) {
+               _ERR("g_dbus_method_invocation_get_sender failed");
+               return -1;
+       }
+       _INFO("sender=[%s]", name);
+
+
+       guint pid = -1;
+       GError *error = NULL;
+       GVariant *_ret;
+
+       _INFO("calling GetConnectionUnixProcessID");
+
+       GDBusConnection* conn = g_dbus_method_invocation_get_connection(invoc);
+       _ret = g_dbus_connection_call_sync(conn,
+                       "org.freedesktop.DBus",
+                       "/org/freedesktop/DBus",
+                       "org.freedesktop.DBus",
+                       "GetConnectionUnixProcessID",
+                       g_variant_new("(s)", name),
+                       NULL,
+                       G_DBUS_CALL_FLAGS_NONE,
+                       -1,
+                       NULL,
+                       &error);
+
+       if (_ret != NULL) {
+               g_variant_get(_ret, "(u)", &pid);
+               g_variant_unref(_ret);
+       }
+
+       _INFO("process Id = [%u]", pid);
+       return pid;
 }
 
 static int
 __check_privilege_by_cynara(const char *client, const char *session, const char *user, const char *privilege)
 {
-    #ifdef WITH_JSON_BUILDER
-
-    int ret;
-    char err_buf[128] = {0,};
-
-    ret = cynara_check(__cynara, client, session, user, privilege);
-    switch (ret) {
-        case CYNARA_API_ACCESS_ALLOWED:
-            _DBG("cynara_check success");
-            return FIDO_ERROR_NONE;
-
-        case CYNARA_API_ACCESS_DENIED:
-            _ERR("cynara_check permission deined, privilege=%s, error = CYNARA_API_ACCESS_DENIED", privilege);
-            return FIDO_ERROR_PERMISSION_DENIED;
-
-        default:
-            cynara_strerror(ret, err_buf, sizeof(err_buf));
-            _ERR("cynara_check error : %s, privilege=%s, ret = %d", err_buf, privilege, ret);
-            return FIDO_ERROR_PERMISSION_DENIED;
-    }
-
-    return FIDO_ERROR_NONE;
-    #endif
+#ifdef WITH_JSON_BUILDER
+       int ret;
+       char err_buf[128] = {0,};
+
+       ret = cynara_check(__cynara, client, session, user, privilege);
+       switch (ret) {
+               case CYNARA_API_ACCESS_ALLOWED:
+                       _DBG("cynara_check success");
+                       return FIDO_ERROR_NONE;
+
+               case CYNARA_API_ACCESS_DENIED:
+                       _ERR("cynara_check permission deined, privilege=%s, error = CYNARA_API_ACCESS_DENIED", privilege);
+                       return FIDO_ERROR_PERMISSION_DENIED;
+
+               default:
+                       cynara_strerror(ret, err_buf, sizeof(err_buf));
+                       _ERR("cynara_check error : %s, privilege=%s, ret = %d", err_buf, privilege, ret);
+                       return FIDO_ERROR_PERMISSION_DENIED;
+       }
+
+       return FIDO_ERROR_NONE;
+#endif
 
-    return FIDO_ERROR_NONE;
+       return FIDO_ERROR_NONE;
 }
 
 static int
 __get_information_for_cynara_check(GDBusMethodInvocation *invocation, char **client, char **user, char **session)
 {
-    #ifdef WITH_JSON_BUILDER
-
-    GDBusConnection *gdbus_conn = NULL;
-    char* sender = NULL;
-    int ret = -1;
-
-    gdbus_conn = g_dbus_method_invocation_get_connection(invocation);
-    if(gdbus_conn == NULL) {
-        _ERR("g_dbus_method_invocation_get_connection failed");
-        return -1;
-    }
-
-    sender = (char*) g_dbus_method_invocation_get_sender(invocation);
-    if (sender == NULL) {
-        _ERR("g_dbus_method_invocation_get_sender failed");
-        return -1;
-    }
-
-    ret = cynara_creds_gdbus_get_user(gdbus_conn, sender, USER_METHOD_DEFAULT, user);
-    if (ret != CYNARA_API_SUCCESS) {
-        _ERR("cynara_creds_gdbus_get_user failed, ret = %d", ret);
-        return -1;
-    }
-
-    ret = cynara_creds_gdbus_get_client(gdbus_conn, sender, CLIENT_METHOD_DEFAULT, client);
-    if (ret != CYNARA_API_SUCCESS) {
-        _ERR("cynara_creds_gdbus_get_client failed, ret = %d", ret);
-        return -1;
-    }
-
-    guint pid = _get_client_pid(invocation);
-    _INFO("client Id = [%u]", pid);
-
-    *session = cynara_session_from_pid(pid);
-    if (*session == NULL) {
-        _ERR("cynara_session_from_pid failed");
-        return -1;
-    }
-    return FIDO_ERROR_NONE;
-    #endif
-
-    return FIDO_ERROR_NONE;
+#ifdef WITH_JSON_BUILDER
+       GDBusConnection *gdbus_conn = NULL;
+       char* sender = NULL;
+       int ret = -1;
+
+       gdbus_conn = g_dbus_method_invocation_get_connection(invocation);
+       if (gdbus_conn == NULL) {
+               _ERR("g_dbus_method_invocation_get_connection failed");
+               return -1;
+       }
+
+       sender = (char*) g_dbus_method_invocation_get_sender(invocation);
+       if (sender == NULL) {
+               _ERR("g_dbus_method_invocation_get_sender failed");
+               return -1;
+       }
+
+       ret = cynara_creds_gdbus_get_user(gdbus_conn, sender, USER_METHOD_DEFAULT, user);
+       if (ret != CYNARA_API_SUCCESS) {
+               _ERR("cynara_creds_gdbus_get_user failed, ret = %d", ret);
+               return -1;
+       }
+
+       ret = cynara_creds_gdbus_get_client(gdbus_conn, sender, CLIENT_METHOD_DEFAULT, client);
+       if (ret != CYNARA_API_SUCCESS) {
+               _ERR("cynara_creds_gdbus_get_client failed, ret = %d", ret);
+               return -1;
+       }
+
+       guint pid = _get_client_pid(invocation);
+       _INFO("client Id = [%u]", pid);
+
+       *session = cynara_session_from_pid(pid);
+       if (*session == NULL) {
+               _ERR("cynara_session_from_pid failed");
+               return -1;
+       }
+       return FIDO_ERROR_NONE;
+       #endif
+
+       return FIDO_ERROR_NONE;
 }
 #endif
 
 bool
 is_allowed_to_call(GDBusMethodInvocation *invocation, const char* privilege)
 {
-    #ifdef WITH_JSON_BUILDER
+#ifdef WITH_JSON_BUILDER
 
-    int ret = -1;
+       int ret = -1;
 
-    if (__cynara == NULL) {
-        ret = cynara_initialize(&__cynara, NULL);
-        if(ret != CYNARA_API_SUCCESS) {
-            _ERR("CYNARA Initialization fail");
-            return false;
-        }
-    }
+       if (__cynara == NULL) {
+               ret = cynara_initialize(&__cynara, NULL);
+               if (ret != CYNARA_API_SUCCESS) {
+                       _ERR("CYNARA Initialization fail");
+                       return false;
+               }
+       }
 
-    char *client = NULL;
-    char *session = NULL;
-    char *user = NULL;
+       char *client = NULL;
+       char *session = NULL;
+       char *user = NULL;
 
-    ret = __get_information_for_cynara_check(invocation, &client, &user, &session);
-    if ( ret != FIDO_ERROR_NONE) {
-        _ERR("__get_information_for_cynara_check failed");
-        g_free(client);
-        g_free(user);
-        SAFE_DELETE(session);
+       ret = __get_information_for_cynara_check(invocation, &client, &user, &session);
+       if (ret != FIDO_ERROR_NONE) {
+               _ERR("__get_information_for_cynara_check failed");
+               g_free(client);
+               g_free(user);
+               SAFE_DELETE(session);
 
-        return false;
-    }
+               return false;
+       }
 
-    ret = __check_privilege_by_cynara(client, session, user, privilege);
+       ret = __check_privilege_by_cynara(client, session, user, privilege);
 
-    /*TODO enable after smack is defined*/
+       /*TODO enable after smack is defined*/
 #ifndef _DISABLE_PRIV_CHECK
-    if ( ret != FIDO_ERROR_NONE) {
-        _ERR("__check_privilege_by_cynara failed, ret = %d", ret);
-        g_free(client);
-        g_free(user);
-        SAFE_DELETE(session);
-
-        return false;
-    }
+       if (ret != FIDO_ERROR_NONE) {
+               _ERR("__check_privilege_by_cynara failed, ret = %d", ret);
+               g_free(client);
+               g_free(user);
+               SAFE_DELETE(session);
+
+               return false;
+       }
 #endif
-    g_free(client);
-    g_free(user);
-    SAFE_DELETE(session);
+       g_free(client);
+       g_free(user);
+       SAFE_DELETE(session);
 
-    return true;
-#endif
+       return true;
+       #endif
 
-    return true;
+       return true;
 }
index 17ae88b..71c5c69 100644 (file)
@@ -46,34 +46,34 @@ static int __ui_svc_pid = -1;
 static int _process_ui_selection_queue(void);
 
 typedef struct _ui_response_cb_data {
-    GList *auth_list;
-    _ui_response_cb cb;
-    void *user_data;
+       GList *auth_list;
+       _ui_response_cb cb;
+       void *user_data;
 } _ui_response_cb_data_t;
 
 static void
 __free_ui_auth_data(gpointer data)
 {
-    RET_IF_FAIL_VOID(data != NULL);
+       RET_IF_FAIL_VOID(data != NULL);
 
-    _ui_auth_data_t *auth_data = data;
+       _ui_auth_data_t *auth_data = data;
 
-    SAFE_DELETE(auth_data->asm_id);
-    SAFE_DELETE(auth_data->auth_index);
-    SAFE_DELETE(auth_data->label);
+       SAFE_DELETE(auth_data->asm_id);
+       SAFE_DELETE(auth_data->auth_index);
+       SAFE_DELETE(auth_data->label);
 
-    SAFE_DELETE(auth_data);
+       SAFE_DELETE(auth_data);
 }
 
 static void
 __free_ui_response_cb_data(_ui_response_cb_data_t *data)
 {
-    RET_IF_FAIL_VOID(data != NULL);
+       RET_IF_FAIL_VOID(data != NULL);
 
-    if (data->auth_list != NULL)
-        g_list_free_full(data->auth_list, __free_ui_auth_data);
+       if (data->auth_list != NULL)
+               g_list_free_full(data->auth_list, __free_ui_auth_data);
 
-    SAFE_DELETE(data);
+       SAFE_DELETE(data);
 }
 
 static GQueue *
@@ -126,11 +126,11 @@ _compose_json_ui_out(const char *response_json)
                goto CATCH;
        }
 
-    const char *asm_id = json_object_get_string_member(obj, UI_DATA_ASM_ID);
-    if (!asm_id) {
-        _ERR("json_object_get_string_member() failed");
-        goto CATCH;
-    }
+       const char *asm_id = json_object_get_string_member(obj, UI_DATA_ASM_ID);
+       if (!asm_id) {
+               _ERR("json_object_get_string_member() failed");
+               goto CATCH;
+       }
 
        const char *auth_idx = NULL;
        auth_idx = json_object_get_string_member(obj, UI_DATA_AUTH_INDEX);
@@ -150,13 +150,12 @@ _compose_json_ui_out(const char *response_json)
        att = json_object_get_int_member(obj, UI_DATA_ATT_TYPE);
 
        ui_auth_data = (_ui_auth_data_t *) calloc(1, sizeof(_ui_auth_data_t));
-       if (ui_auth_data == NULL)
-       {
+       if (ui_auth_data == NULL) {
                _ERR("Out of memory");
                goto CATCH;
        }
 
-    ui_auth_data->asm_id = strdup(asm_id);
+       ui_auth_data->asm_id = strdup(asm_id);
        ui_auth_data->auth_index = strdup(auth_idx);
        ui_auth_data->label = strdup(label);
        ui_auth_data->att_type = att;
@@ -193,20 +192,20 @@ _compose_json_ui_in(GList *auth_list)
        JsonArray *ui_arr = NULL;
 
        generator = json_generator_new();
-       if(generator == NULL) {
-        _ERR("json_generator_new is NULL");
+       if (generator == NULL) {
+               _ERR("json_generator_new is NULL");
                goto CATCH;
        }
 
        root_node = json_node_new(JSON_NODE_ARRAY);
        if (root_node == NULL) {
-        _ERR("json_node_new is NULL");
+               _ERR("json_node_new is NULL");
                goto CATCH;
        }
 
        ui_arr = json_array_new();
        if (ui_arr == NULL) {
-        _ERR("json_array_new is NULL");
+               _ERR("json_array_new is NULL");
                goto CATCH;
        }
 
@@ -220,12 +219,12 @@ _compose_json_ui_in(GList *auth_list)
                if (ui_data) {
                        JsonObject *obj = json_object_new();
 
-            if (ui_data->asm_id != NULL)
-                json_object_set_string_member(obj, UI_DATA_ASM_ID, ui_data->asm_id);
+                       if (ui_data->asm_id != NULL)
+                               json_object_set_string_member(obj, UI_DATA_ASM_ID, ui_data->asm_id);
 
                        json_object_set_string_member(obj, UI_DATA_AUTH_INDEX, ui_data->auth_index);
-            if (ui_data->label != NULL)
-                json_object_set_string_member(obj, UI_DATA_LABEL, ui_data->label);
+                       if (ui_data->label != NULL)
+                               json_object_set_string_member(obj, UI_DATA_LABEL, ui_data->label);
                        json_object_set_int_member(obj, UI_DATA_ATT_TYPE, ui_data->att_type);
 
                        json_array_add_object_element(ui_arr, obj);
@@ -269,49 +268,49 @@ CATCH:
 static void
 __terminate_ui_svc(void)
 {
-    _INFO("Killing inactive UI Service [%d]", __ui_svc_pid);
+       _INFO("Killing inactive UI Service [%d]", __ui_svc_pid);
 
-    if (__ui_svc_pid > 0)
-        aul_terminate_pid(__ui_svc_pid);
+       if (__ui_svc_pid > 0)
+               aul_terminate_pid(__ui_svc_pid);
 
-    __ui_svc_pid = -1;
+       __ui_svc_pid = -1;
 }
 
 static gboolean
 __timer_expired(gpointer data)
 {
-    if (g_queue_is_empty(_ui_q) == TRUE)
-        __terminate_ui_svc();
+       if (g_queue_is_empty(_ui_q) == TRUE)
+               __terminate_ui_svc();
 
-    return FALSE;
+       return FALSE;
 }
 
 static void
 __start_ui_svc_term_timer(void)
 {
-    g_timeout_add(_UI_SVC_TERMINATE_TIMEOUT, __timer_expired, NULL);
+       g_timeout_add(_UI_SVC_TERMINATE_TIMEOUT, __timer_expired, NULL);
 }
 
 static int
 __launch_svc_ui(bundle *ui_req)
 {
-    int i = 0;
-    for (; i < _UI_LAUNCH_RETRY_COUNT; i++) {
-        if (__ui_svc_pid < 0)
-            __ui_svc_pid = aul_launch_app(_UI_SVC_PACKAGE, ui_req);
-        else {
-            aul_terminate_pid(__ui_svc_pid);
-            __ui_svc_pid = -1;
-
-            __ui_svc_pid = aul_launch_app(_UI_SVC_PACKAGE, ui_req);
-        }
+       int i = 0;
+       for (; i < _UI_LAUNCH_RETRY_COUNT; i++) {
+               if (__ui_svc_pid < 0)
+                       __ui_svc_pid = aul_launch_app(_UI_SVC_PACKAGE, ui_req);
+               else {
+                       aul_terminate_pid(__ui_svc_pid);
+                       __ui_svc_pid = -1;
+
+                       __ui_svc_pid = aul_launch_app(_UI_SVC_PACKAGE, ui_req);
+               }
 
-        _INFO("fido svc pid = [%d]", __ui_svc_pid);
+               _INFO("fido svc pid = [%d]", __ui_svc_pid);
 
-        if (__ui_svc_pid > 0)
-            return FIDO_ERROR_NONE;
-    }
-    return FIDO_ERROR_UNKNOWN;
+               if (__ui_svc_pid > 0)
+                       return FIDO_ERROR_NONE;
+       }
+       return FIDO_ERROR_UNKNOWN;
 }
 
 static int
@@ -329,18 +328,18 @@ _process_ui_selection_queue(void)
 
        char *ui_data = _compose_json_ui_in(ui_res_data->auth_list);
        if (ui_data == NULL) {
-        ui_res_data->cb(FIDO_ERROR_OUT_OF_MEMORY, NULL, ui_res_data->user_data);
+               ui_res_data->cb(FIDO_ERROR_OUT_OF_MEMORY, NULL, ui_res_data->user_data);
                g_queue_pop_head(q);
-        return FIDO_ERROR_OUT_OF_MEMORY;
+               return FIDO_ERROR_OUT_OF_MEMORY;
        }
 
-    _INFO("Sending to UI SVC");
-    _INFO("%s", ui_data);
+       _INFO("Sending to UI SVC");
+       _INFO("%s", ui_data);
 
-    bundle *ui_req = bundle_create();
-    bundle_add_str(ui_req, _UI_IPC_KEY_REQ, ui_data);
+       bundle *ui_req = bundle_create();
+       bundle_add_str(ui_req, _UI_IPC_KEY_REQ, ui_data);
 
-    return __launch_svc_ui(ui_req);
+       return __launch_svc_ui(ui_req);
 }
 
 int
@@ -357,13 +356,13 @@ _auth_ui_selector_send(GList *auth_list, _ui_response_cb cb, void *user_data)
        ui_cb_data->user_data = user_data;
 
        GQueue *q = _get_ui_queue();
-    if (q == NULL) {
-        __free_ui_response_cb_data(ui_cb_data);
-        return FIDO_ERROR_OUT_OF_MEMORY;
-    }
+       if (q == NULL) {
+               __free_ui_response_cb_data(ui_cb_data);
+               return FIDO_ERROR_OUT_OF_MEMORY;
+       }
 
        g_queue_push_tail(q, ui_cb_data);
-    _INFO("Q len=[%d]", g_queue_get_length(q));
+       _INFO("Q len=[%d]", g_queue_get_length(q));
 
        if (g_queue_get_length(q) == 1)
                _process_ui_selection_queue();
@@ -374,141 +373,141 @@ _auth_ui_selector_send(GList *auth_list, _ui_response_cb cb, void *user_data)
 static inline int
 __read_proc(const char *path, char *buf, int size)
 {
-    int fd = 0;
-    int ret = 0;
+       int fd = 0;
+       int ret = 0;
 
-    if (buf == NULL || path == NULL) {
-        _ERR("path and buffer is mandatory\n");
-        return -1;
-    }
+       if (buf == NULL || path == NULL) {
+               _ERR("path and buffer is mandatory\n");
+               return -1;
+       }
 
-    fd = open(path, O_RDONLY);
-    if (fd < 0) {
-        _ERR("fd open error(%d)\n", fd);
-        return -1;
-    }
+       fd = open(path, O_RDONLY);
+       if (fd < 0) {
+               _ERR("fd open error(%d)\n", fd);
+               return -1;
+       }
 
-    ret = read(fd, buf, size - 1);
-    if (ret <= 0) {
-        _ERR("fd read error(%d)\n", fd);
-        close(fd);
-        return -1;
-    } else
-        buf[ret] = 0;
+       ret = read(fd, buf, size - 1);
+       if (ret <= 0) {
+               _ERR("fd read error(%d)\n", fd);
+               close(fd);
+               return -1;
+       } else
+               buf[ret] = 0;
 
-    close(fd);
+       close(fd);
 
-    return ret;
+       return ret;
 }
 
 static char*
 __get_proc_path_of_dbus_caller(GDBusMethodInvocation *invocation)
 {
-    //pid_t remote_pid = 0;
-    GError *error = NULL;
-    GDBusConnection *connection = NULL;
-    GVariant *response = NULL;
-    guint32 upid;
-    const gchar *sender = NULL;
-
-    sender = g_dbus_method_invocation_get_sender (invocation);
-    if (!sender) {
-        _ERR("Failed to get sender");
-        return NULL;
-    }
-
-    connection = g_dbus_method_invocation_get_connection(invocation);
-    if (connection == NULL) {
-        _ERR("Failed to open connection for the invocation [%s]", error->message);
-        g_error_free (error);
-        return NULL;
-    }
+       //pid_t remote_pid = 0;
+       GError *error = NULL;
+       GDBusConnection *connection = NULL;
+       GVariant *response = NULL;
+       guint32 upid;
+       const gchar *sender = NULL;
+
+       sender = g_dbus_method_invocation_get_sender(invocation);
+       if (!sender) {
+               _ERR("Failed to get sender");
+               return NULL;
+       }
 
-    error = NULL;
-    response = g_dbus_connection_call_sync (connection,
-            _FREEDESKTOP_SERVICE, _FREEDESKTOP_PATH,
-            _FREEDESKTOP_INTERFACE, "GetConnectionUnixProcessID",
-            g_variant_new ("(s)", sender), ((const GVariantType *) "(u)"),
-            G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+       connection = g_dbus_method_invocation_get_connection(invocation);
+       if (connection == NULL) {
+               _ERR("Failed to open connection for the invocation [%s]", error->message);
+               g_error_free(error);
+               return NULL;
+       }
 
-    if (response == NULL) {
-        _ERR("Failed to get caller id [%s]", error->message);
-        g_error_free (error);
-        return NULL;
-    }
+       error = NULL;
+       response = g_dbus_connection_call_sync(connection,
+                               _FREEDESKTOP_SERVICE, _FREEDESKTOP_PATH,
+                               _FREEDESKTOP_INTERFACE, "GetConnectionUnixProcessID",
+                               g_variant_new("(s)", sender), ((const GVariantType *) "(u)"),
+                               G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+
+       if (response == NULL) {
+               _ERR("Failed to get caller id [%s]", error->message);
+               g_error_free(error);
+               return NULL;
+       }
 
-    g_variant_get (response, "(u)", &upid);
-    _INFO("Remote msg-bus peer service=%s pid=%u", sender, upid);
-    //remote_pid = (pid_t) upid;
+       g_variant_get(response, "(u)", &upid);
+       _INFO("Remote msg-bus peer service=%s pid=%u", sender, upid);
+       //remote_pid = (pid_t) upid;
 
-    g_variant_unref (response);
+       g_variant_unref(response);
 
-    char buf[128];
-    int ret = 0;
+       char buf[128];
+       int ret = 0;
 
-    snprintf(buf, sizeof(buf), "/proc/%d/cmdline", upid);
-    ret = __read_proc(buf, buf, sizeof(buf));
-    if (ret <= 0) {
+       snprintf(buf, sizeof(buf), "/proc/%d/cmdline", upid);
+       ret = __read_proc(buf, buf, sizeof(buf));
+       if (ret <= 0) {
         _ERR("No proc directory (%d)\n", upid);
         return NULL;
     }
 
-    _INFO("Caller=[%s]", buf);
+       _INFO("Caller=[%s]", buf);
 
-    return strdup(buf);
+       return strdup(buf);
 }
 
 gboolean
 _auth_ui_selector_on_ui_response(Fido *object, GDBusMethodInvocation *invocation, int error, const char *ui_resp)
 {
-    _INFO("");
+       _INFO("");
 
-    char *caller = __get_proc_path_of_dbus_caller(invocation);
-    if (caller == NULL) {
-        _ERR("__get_proc_path_of_dbus_caller failed");
-        __start_ui_svc_term_timer();
-        return true;
-    }
+       char *caller = __get_proc_path_of_dbus_caller(invocation);
+       if (caller == NULL) {
+               _ERR("__get_proc_path_of_dbus_caller failed");
+               __start_ui_svc_term_timer();
+               return true;
+       }
 
-    if (strcmp(caller, _UI_SVC_BIN_PATH) != 0) {
-        _ERR("[%s] is not allowed", caller);
-        __start_ui_svc_term_timer();
-        return true;
-    }
+       if (strcmp(caller, _UI_SVC_BIN_PATH) != 0) {
+               _ERR("[%s] is not allowed", caller);
+               __start_ui_svc_term_timer();
+               return true;
+       }
 
-    _ui_response_cb_data_t *cb_data = (_ui_response_cb_data_t*)(g_queue_pop_head(_ui_q));
-    if (cb_data == NULL) {
-        _ERR("Can not proceed since callback data is NULL");
-        goto CATCH;
-    }
+       _ui_response_cb_data_t *cb_data = (_ui_response_cb_data_t*)(g_queue_pop_head(_ui_q));
+       if (cb_data == NULL) {
+               _ERR("Can not proceed since callback data is NULL");
+               goto CATCH;
+       }
 
-    if (cb_data->cb == NULL) {
-        _ERR("Can not proceed since callback data's cb part is NULL");
-        goto CATCH;
-    }
+       if (cb_data->cb == NULL) {
+               _ERR("Can not proceed since callback data's cb part is NULL");
+               goto CATCH;
+       }
 
-    if (error != FIDO_ERROR_NONE)
-        cb_data->cb(error, NULL, cb_data->user_data);
-    else {
-        if (ui_resp == NULL)
-            cb_data->cb(FIDO_ERROR_PERMISSION_DENIED, NULL, cb_data->user_data);
-        else {
-            _INFO("response from server = [%s]", ui_resp);
-
-            _ui_auth_data_t *ui_auth_data = _compose_json_ui_out(ui_resp);
-            cb_data->cb(FIDO_ERROR_NONE, ui_auth_data, cb_data->user_data);
-        }
-    }
+       if (error != FIDO_ERROR_NONE)
+               cb_data->cb(error, NULL, cb_data->user_data);
+       else {
+               if (ui_resp == NULL)
+                       cb_data->cb(FIDO_ERROR_PERMISSION_DENIED, NULL, cb_data->user_data);
+               else {
+                       _INFO("response from server = [%s]", ui_resp);
+
+                       _ui_auth_data_t *ui_auth_data = _compose_json_ui_out(ui_resp);
+                       cb_data->cb(FIDO_ERROR_NONE, ui_auth_data, cb_data->user_data);
+               }
+       }
 
 CATCH:
 
-    if (g_queue_is_empty(_ui_q) == false)
-        _process_ui_selection_queue();
-    else {
-        g_queue_free(_ui_q);
-        _ui_q = NULL;
-        __start_ui_svc_term_timer();
-    }
+       if (g_queue_is_empty(_ui_q) == false)
+               _process_ui_selection_queue();
+       else {
+               g_queue_free(_ui_q);
+               _ui_q = NULL;
+               __start_ui_svc_term_timer();
+       }
 
-    return true;
+       return true;
 }
index 1000ea0..a337c1a 100755 (executable)
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 #include <signal.h>
 #include <glib.h>
-#if !GLIB_CHECK_VERSION (2, 31, 0)
+#if !GLIB_CHECK_VERSION(2, 31, 0)
 #include <glib/gmacros.h>
 #endif
 
@@ -42,10 +42,10 @@ static Fido* fido_dbus_obj = NULL;
 
 //TODO : current assumption is, ASM will handle multiple request queueing
 
-typedef struct _dbus_info{
+typedef struct _dbus_info {
        Fido *dbus_obj;
        GDBusMethodInvocation *invocation;
-}_dbus_info_t;
+} _dbus_info_t;
 
 typedef struct _discover_cb {
        //fido_authenticator_cb cb;
@@ -56,7 +56,7 @@ typedef struct _discover_cb {
 typedef struct _fido_discover_asm_cb_data {
        _fido_discover_asm_cb cb;
        void *user_data;
-}_fido_discover_asm_cb_data_t;
+} _fido_discover_asm_cb_data_t;
 
 typedef enum {
        _PROCESS_TYPE_MIN = 0,
@@ -125,14 +125,14 @@ __send_discover_response(Fido *object, GDBusMethodInvocation *invocation, int er
 
                char **empty_arr = __create_empty_json_2d_array();
                fido_complete_fido_uaf_discover(object, invocation, err,
-                                                                               (const gchar * const*)empty_arr, 0);
+                       (const gchar * const *)empty_arr, 0);
 
                __free_2d_string_array(empty_arr, 1);
                return;
        }
 
        fido_complete_fido_uaf_discover(object, invocation, err,
-                                                                       (const gchar * const*)asm_resp_2d_arr, asm_resp_len);
+               (const gchar * const *)asm_resp_2d_arr, asm_resp_len);
 
        __free_2d_string_array(asm_resp_2d_arr, asm_resp_len);
 }
@@ -165,8 +165,7 @@ _asm_get_info_cb(GList *asm_resp_list, void *user_data)
 
                   __send_discover_response(dbus_info->dbus_obj, dbus_info->invocation, FIDO_ERROR_NONE,
                                                                                   asm_resp_json_arr, data_len);
-               }
-               else
+               } else
                   __send_discover_response(dbus_info->dbus_obj, dbus_info->invocation, FIDO_ERROR_NOT_SUPPORTED,
                                                                                   NULL, 0);
        }
@@ -182,8 +181,7 @@ _send_process_response(_process_cb_data_t *cb_data, int tz_err_code, char *uaf_r
 
        /*TODO*/
        _dbus_info_t *dbus_info = (_dbus_info_t *)(cb_data->dbus_info);
-       if (dbus_info != NULL)
-       {
+       if (dbus_info != NULL) {
                if (cb_data->type == _PROCESS_TYPE_CHECK_POLICY) {
                        _INFO("before fido_complete_fido_uaf_check_policy");
                        fido_complete_fido_uaf_check_policy(dbus_info->dbus_obj, dbus_info->invocation, tz_err_code);
@@ -434,8 +432,7 @@ __handle_reg(_process_cb_data_t *cb_data, _matched_auth_data_t *matched_auth)
                /* app id*/
                cb_data->uaf_req->header->app_id = strdup(cb_data->uaf_req->facet_id);
                reg_in->app_id = strdup(cb_data->uaf_req->header->app_id);
-       }
-       else {
+       } else {
                /* app id*/
                reg_in->app_id = strdup(cb_data->uaf_req->header->app_id);
        }
@@ -584,8 +581,7 @@ __handle_auth(_process_cb_data_t *cb_data, _matched_auth_data_t *matched_auth)
                }
                cb_data->uaf_req->header->app_id = strdup(cb_data->uaf_req->facet_id);
                auth_asm_in->app_id = strdup(cb_data->uaf_req->facet_id);
-       }
-       else {
+       } else {
                auth_asm_in->app_id = strdup(cb_data->uaf_req->header->app_id);
        }
 
@@ -632,8 +628,7 @@ __handle_auth(_process_cb_data_t *cb_data, _matched_auth_data_t *matched_auth)
        if (ret == 0 && asm_req_json != NULL) {
                _asm_ipc_send(matched_auth->asm_id,
                                          asm_req_json, _asm_response_auth_process, cb_data);
-       }
-       else {
+       } else {
                _send_process_response(cb_data, FIDO_ERROR_INVALID_PARAMETER, NULL);
        }
 
@@ -736,8 +731,7 @@ __process_dereg_queue(_dereg_q_t *dereg_q)
        if (ret == 0 && asm_req_json != NULL) {
                _asm_ipc_send(dereg_data->asm_id,
                                          asm_req_json, _asm_response_dereg_process, dereg_q);
-       }
-       else {
+       } else {
                _send_process_response(cb_data, FIDO_ERROR_INVALID_PARAMETER, NULL);
        }
 
@@ -865,8 +859,7 @@ _discover_response_cb_for_process(int tz_error_code, int error_code, GList *avai
                                _reg_request_t *uaf_reg_req = (_reg_request_t *)(cb_data->uaf_req->data);
                                policy = uaf_reg_req->policy;
                                 _INFO("_PROCESS_TYPE_CHECK_POLICY for reg");
-                       }
-                       else if (strcmp(cb_data->uaf_req->header->operation, _UAF_OPERATION_NAME_KEY_AUTH) == 0) {
+                       } else if (strcmp(cb_data->uaf_req->header->operation, _UAF_OPERATION_NAME_KEY_AUTH) == 0) {
                                _auth_request_t *uaf_auth_req = (_auth_request_t *)(cb_data->uaf_req->data);
                                policy = uaf_auth_req->policy;
                                _INFO("_PROCESS_TYPE_CHECK_POLICY for auth");
@@ -889,16 +882,14 @@ _discover_response_cb_for_process(int tz_error_code, int error_code, GList *avai
                        if ((allowed_auth_list != NULL) && g_list_length(allowed_auth_list) > 0) {
 
                                _send_process_response(cb_data, FIDO_ERROR_NONE, NULL);
-                       }
-                       else {
+                       } else {
                                _send_process_response(cb_data, FIDO_ERROR_NO_SUITABLE_AUTHENTICATOR, NULL);
                        }
 
                        if (allowed_auth_list != NULL)
                                g_list_free_full(allowed_auth_list, _free_matched_auth_data);
 
-               }
-               else if (strcmp(cb_data->uaf_req->header->operation, _UAF_OPERATION_NAME_KEY_DE_REG) == 0) {
+               } else if (strcmp(cb_data->uaf_req->header->operation, _UAF_OPERATION_NAME_KEY_DE_REG) == 0) {
 
                        _dereg_request_t *dereg_req = (_dereg_request_t*)(cb_data->uaf_req->data);
 
@@ -913,8 +904,7 @@ _discover_response_cb_for_process(int tz_error_code, int error_code, GList *avai
                        if ((matched_auth_list != NULL) && g_list_length(matched_auth_list) > 0) {
 
                                _send_process_response(cb_data, FIDO_ERROR_NONE, NULL);
-                       }
-                       else {
+                       } else {
                                _send_process_response(cb_data, FIDO_ERROR_NO_SUITABLE_AUTHENTICATOR, NULL);
                        }
 
@@ -939,7 +929,7 @@ _discover_response_cb_for_process(int tz_error_code, int error_code, GList *avai
 
                g_list_free_full(available_authenticators_full, _free_asm_auth_list);
 
-               if (matched_auth_list == NULL){
+               if (matched_auth_list == NULL) {
                        _ERR("No supported authenticators found");
                        _send_process_response(cb_data, FIDO_ERROR_NO_SUITABLE_AUTHENTICATOR, NULL);
                        return;
@@ -977,12 +967,10 @@ _discover_response_cb_for_process(int tz_error_code, int error_code, GList *avai
        if (cb_data->type == _PROCESS_TYPE_REG) {
                _reg_request_t *uaf_reg_req = (_reg_request_t *)(cb_data->uaf_req->data);
                policy = uaf_reg_req->policy;
-       }
-       else if (cb_data->type == _PROCESS_TYPE_AUTH) {
+       } else if (cb_data->type == _PROCESS_TYPE_AUTH) {
                _auth_request_t *uaf_auth_req = (_auth_request_t *)(cb_data->uaf_req->data);
                policy = uaf_auth_req->policy;
-       }
-       else {
+       } else {
                _send_process_response(cb_data, FIDO_ERROR_UNKNOWN, NULL);
                return;
        }
@@ -1001,7 +989,7 @@ _discover_response_cb_for_process(int tz_error_code, int error_code, GList *avai
        GList *allowed_auth_list = _policy_checker_get_matched_auth_list(policy, available_authenticators_full);
        g_list_free_full(available_authenticators_full, _free_asm_auth_list);
 
-       if (allowed_auth_list == NULL){
+       if (allowed_auth_list == NULL) {
                _ERR("No supported authenticators found");
                _send_process_response(cb_data, FIDO_ERROR_NO_SUITABLE_AUTHENTICATOR, NULL);
 
@@ -1047,8 +1035,7 @@ _discover_response_cb_for_process(int tz_error_code, int error_code, GList *avai
                                g_list_free_full(allowed_auth_list, _free_matched_auth_data);
                        return;
                }
-       }
-       else {
+       } else {
                _INFO("");
                GList *allowed_auth_list_iter = allowed_auth_list;
                _matched_auth_data_t *match_data = (_matched_auth_data_t *)(allowed_auth_list_iter->data);
@@ -1134,8 +1121,7 @@ _dbus_on_fido_deinit(Fido *object, GDBusMethodInvocation *invocation)
 {
        if (is_allowed_to_call(invocation, _FIDO_CLIENT_PRIVILEGE) == false) {
                fido_complete_fido_uaf_deinit(object, invocation, FIDO_ERROR_PERMISSION_DENIED);
-       }
-       else {
+       } else {
                //_auth_ui_selector_deinit();
                fido_complete_fido_uaf_deinit(object, invocation, FIDO_ERROR_NONE);
        }
@@ -1247,7 +1233,7 @@ _dbus_on_fido_uaf_notify_result(Fido *object, GDBusMethodInvocation *invocation,
 }*/
 
 static void
-on_bus_acquired (GDBusConnection *connection, const gchar *name, gpointer user_data)
+on_bus_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
 {
                dlog_print(DLOG_INFO, "FIDO", "on_bus_acquired");
 
@@ -1303,7 +1289,7 @@ on_bus_acquired (GDBusConnection *connection, const gchar *name, gpointer user_d
 }
 
 static void
-on_name_acquired (GDBusConnection *connection,
+on_name_acquired(GDBusConnection *connection,
                                                const gchar     *name,
                                                gpointer         user_data)
 {
@@ -1312,13 +1298,13 @@ on_name_acquired (GDBusConnection *connection,
 }
 
 static void
-on_name_lost (GDBusConnection *connection,
+on_name_lost(GDBusConnection *connection,
                                                const gchar     *name,
                                                gpointer         user_data)
 {
                _INFO("on_name_lost");
                _asm_plugin_mgr_destroy();
-               exit (1);
+               exit(1);
 }
 
 static bool
@@ -1326,18 +1312,18 @@ __initialize_dbus(void)
 {
        _INFO("__initialize_dbus Enter");
 
-       owner_id = g_bus_own_name (G_BUS_TYPE_SYSTEM,
-                                                        _FIDO_DBUS_NAME,
-                                                        G_BUS_NAME_OWNER_FLAGS_NONE,
-                                                        on_bus_acquired,
-                                                        on_name_acquired,
-                                                        on_name_lost,
-                                                        NULL,
-                                                        NULL);
+       owner_id = g_bus_own_name(G_BUS_TYPE_SYSTEM,
+                               _FIDO_DBUS_NAME,
+                               G_BUS_NAME_OWNER_FLAGS_NONE,
+                               on_bus_acquired,
+                               on_name_acquired,
+                               on_name_lost,
+                               NULL,
+                               NULL);
 
        _INFO("owner_id=[%d]", owner_id);
 
-       if(owner_id == 0) {
+       if (owner_id == 0) {
                        _INFO("gdbus own failed!!");
                        return false;
        }
@@ -1349,7 +1335,7 @@ __initialize_dbus(void)
 static void
 __initialize(void)
 {
-#if !GLIB_CHECK_VERSION(2,35,0)
+#if !GLIB_CHECK_VERSION(2, 35, 0)
        g_type_init();
 #endif
 
index 535436e..f3bf758 100644 (file)
 static gint
 _int_cmp(gconstpointer a, gconstpointer b)
 {
-    int int1 = GPOINTER_TO_INT(a);
-    int int2 = GPOINTER_TO_INT(b);
-    return (int1 - int2);
+       int int1 = GPOINTER_TO_INT(a);
+       int int2 = GPOINTER_TO_INT(b);
+       return (int1 - int2);
 }
 
 bool
 _policy_checker_is_matched(_match_criteria_t *match_criteria, fido_authenticator_s *auth_info)
 {
-    _INFO("_policy_checker_is_matched");
+       _INFO("_policy_checker_is_matched");
 
-    /* -1 means the int value is not present, so we should ignore that. */
+       /* -1 means the int value is not present, so we should ignore that. */
 
-    /* 1. If any AAID is mentioned in match_criteria, then atleast one AAID should match */
-    GList *aaid_list = match_criteria->aaid_list;
-
-    if (aaid_list &&
-            (g_list_length(aaid_list)) &&
-            (auth_info->aaid) &&
-            (strlen(auth_info->aaid) > 0)) {
-        aaid_list = g_list_first(aaid_list);
-        if (g_list_find_custom(aaid_list, auth_info->aaid, (GCompareFunc)strcmp) == NULL) {
-            _ERR("AAID match failed");
-            return false;
-        }
-    }
+       /* 1. If any AAID is mentioned in match_criteria, then atleast one AAID should match */
+       GList *aaid_list = match_criteria->aaid_list;
 
+       if (aaid_list &&
+               (g_list_length(aaid_list)) &&
+               (auth_info->aaid) &&
+               (strlen(auth_info->aaid) > 0)) {
+               aaid_list = g_list_first(aaid_list);
+               if (g_list_find_custom(aaid_list, auth_info->aaid, (GCompareFunc)strcmp) == NULL) {
+                       _ERR("AAID match failed");
+                       return false;
+               }
+       }
 
-    /* 2. If any Vendor ID is mentioned in match_criteria, then atleast one Vendor ID should match */
-    GList *vendor_list = match_criteria->vendor_list;
+       /* 2. If any Vendor ID is mentioned in match_criteria, then atleast one Vendor ID should match */
+       GList *vendor_list = match_criteria->vendor_list;
 
-    if (vendor_list && auth_info->aaid) {
+       if (vendor_list && auth_info->aaid) {
                char *save_ptr = NULL;
-        char *auth_aaid = strdup(auth_info->aaid);
+               char *auth_aaid = strdup(auth_info->aaid);
                char *auth_vendor = strtok_r(auth_aaid, "#", &save_ptr);
 
-        if (vendor_list &&
-                (g_list_length(vendor_list)) &&
-                auth_vendor &&
-                (strlen(auth_vendor) > 0)) {
-            vendor_list = g_list_first(vendor_list);
-            if (g_list_find_custom(vendor_list, auth_vendor, (GCompareFunc)strcmp) == NULL) {
-                _ERR("Vendor ID match failed");
-
-                SAFE_DELETE(auth_aaid);
-                return false;
-            }
-        }
-        SAFE_DELETE(auth_aaid);
-    }
-
-    _INFO("keyid matching");
-
-    /* 3. If any Key ID is mentioned in match_criteria, then atleast one Key ID should match */
-    GList *key_id_list = match_criteria->key_id_list;
-
-    if (key_id_list != NULL) {
-
-        if (auth_info->key_ids == NULL) {
-            _ERR("keyID match failed");
-            return false;
-        }
-
-        GList *auth_key_ids = auth_info->key_ids;
-
-        GList *common_key_id_list = NULL;
-
-        key_id_list = g_list_first(key_id_list);
-        auth_key_ids = g_list_first(auth_key_ids);
-
-        _INFO("match_criteria keyid count = [%d]", g_list_length(key_id_list));
-        _INFO("auth info keyid count = [%d]", g_list_length(auth_key_ids));
-
-        GList *key_id_iter = g_list_first(key_id_list);
-        while (key_id_iter != NULL) {
-            char *key_id = (char*) (key_id_iter->data);
-            if (key_id) {
-                if (g_list_find_custom(auth_key_ids, key_id, (GCompareFunc)strcmp) != NULL) {
-                    _INFO("keyid matched [%s]", key_id);
-                    common_key_id_list = g_list_append(common_key_id_list, strdup(key_id));
-                }
-            }
-            key_id_iter = key_id_iter->next;
-        }
-
-        if (common_key_id_list == NULL) {
-            _ERR("keyID match failed");
-            return false;
-        }
-
-        common_key_id_list = g_list_first(common_key_id_list);
-
-        /*Set common keyIds in match*/
-        g_list_free_full(match_criteria->key_id_list, free);
-        match_criteria->key_id_list = common_key_id_list;
-
-        _INFO("keyID matched count [%d]", g_list_length(match_criteria->key_id_list));
-
-    }
-
-    _INFO("User verification matching");
-
-    /* 4. User verification match */
-    if (match_criteria->user_verification != -1) {
-        if ((match_criteria->user_verification == auth_info->user_verification)
-                ||
-                (
-                        ((auth_info->user_verification & _USER_VER_METHOD_ALL) == 0)
-                        &&
-                        ((match_criteria->user_verification & _USER_VER_METHOD_ALL) == 0)
-                        &&
-                        ((auth_info->user_verification & match_criteria->user_verification) != 0)
-                )
-        )
-            _INFO("User verification match passed");
-        else {
-            _ERR("User verification match failed");
-            return false;
-        }
-    }
-
-    /* 5. Key protection field bit matching */
-    if ((match_criteria->key_protection != -1) && auth_info->key_protection) {
-        if (((match_criteria->key_protection) && (auth_info->key_protection)) == 0) {
-            _ERR("Key protection match failed");
-            return false;
-        }
-    }
-
-    /* 6. Matcher Protection field bit matching */
-    if ((match_criteria->matcher_protection != -1) && auth_info->matcher_protection) {
-        if (((match_criteria->matcher_protection) && (auth_info->matcher_protection)) == 0) {
-            _ERR("Matcher protection match failed");
-            return false;
-        }
-    }
-
-    /* 7. Attachment hint field bit matching */
-    if ((match_criteria->attachement_hint != -1) && auth_info->attachment_hint) {
-        if (((match_criteria->attachement_hint) && (auth_info->attachment_hint)) == 0) {
-            _ERR("Attachment hint match failed");
-            return false;
-        }
-    }
-
-    /* 8. TC Display field bit matching */
-    if ((match_criteria->tc_display != -1) && auth_info->tc_display) {
-        if (((match_criteria->tc_display) && (auth_info->tc_display)) == 0) {
-            _ERR("Attachment hint match failed");
-            return false;
-        }
-    }
-
-    /* 9. If any algo is mentioned in match_criteria, then atleast one algo should match */
-    GList *match_algo_list = match_criteria->auth_algo_list;
-    if (match_algo_list && (g_list_length(match_algo_list))
-            && (auth_info->authentication_algorithm)) {
-        match_algo_list = g_list_first(match_algo_list);
-        if (g_list_find_custom(match_algo_list, GINT_TO_POINTER(auth_info->authentication_algorithm), (GCompareFunc)_int_cmp) == NULL) {
-            _ERR("Algorithm match failed");
-            return false;
-        }
-    }
-
-    /* 10. If any assertion scheme is mentioned in match_criteria, then atleast one assertion scheme should match */
-    GList *assertion_list = match_criteria->assertion_scheme_list;
-    if (assertion_list && (g_list_length(assertion_list))
-            && (auth_info->assertion_scheme) && (strlen(auth_info->assertion_scheme) > 0)) {
-        assertion_list = g_list_first(assertion_list);
-        if (g_list_find_custom(assertion_list, auth_info->assertion_scheme, (GCompareFunc)strcmp) == NULL)
-        {
-            _ERR("Assertion scheme match failed");
-            return false;
-        }
-    }
-
-    /* 11. If any attestation type is mentioned in match_criteria, then atleast one attestation type should match */
-    GList *attestation_type_list = match_criteria->attestation_type_list;
-    if (attestation_type_list && (g_list_length(attestation_type_list))
-            && (auth_info->attestation_types)) {
-        attestation_type_list = g_list_first(attestation_type_list);
-        if (g_list_find_custom(attestation_type_list, GINT_TO_POINTER(auth_info->attestation_types), (GCompareFunc)_int_cmp) == NULL) {
-            _ERR("Attestation type match failed");
-            return false;
-        }
-    }
-
-    /* TODO : 12. Auth version */
-
-    /* TODO : 13. Extension */
-
-    _INFO("_policy_checker_is_matched true");
-
-    return true;
+               if (vendor_list &&
+                       (g_list_length(vendor_list)) &&
+                       auth_vendor &&
+                       (strlen(auth_vendor) > 0)) {
+                       vendor_list = g_list_first(vendor_list);
+                       if (g_list_find_custom(vendor_list, auth_vendor, (GCompareFunc)strcmp) == NULL) {
+                               _ERR("Vendor ID match failed");
+
+                               SAFE_DELETE(auth_aaid);
+                               return false;
+                       }
+               }
+               SAFE_DELETE(auth_aaid);
+       }
+
+       _INFO("keyid matching");
+
+       /* 3. If any Key ID is mentioned in match_criteria, then atleast one Key ID should match */
+       GList *key_id_list = match_criteria->key_id_list;
+
+       if (key_id_list != NULL) {
+
+               if (auth_info->key_ids == NULL) {
+                       _ERR("keyID match failed");
+                       return false;
+               }
+
+               GList *auth_key_ids = auth_info->key_ids;
+
+               GList *common_key_id_list = NULL;
+
+               key_id_list = g_list_first(key_id_list);
+               auth_key_ids = g_list_first(auth_key_ids);
+
+               _INFO("match_criteria keyid count = [%d]", g_list_length(key_id_list));
+               _INFO("auth info keyid count = [%d]", g_list_length(auth_key_ids));
+
+               GList *key_id_iter = g_list_first(key_id_list);
+               while (key_id_iter != NULL) {
+                       char *key_id = (char*) (key_id_iter->data);
+                       if (key_id) {
+                               if (g_list_find_custom(auth_key_ids, key_id, (GCompareFunc)strcmp) != NULL) {
+                                       _INFO("keyid matched [%s]", key_id);
+                                       common_key_id_list = g_list_append(common_key_id_list, strdup(key_id));
+                               }
+                       }
+                       key_id_iter = key_id_iter->next;
+               }
+
+               if (common_key_id_list == NULL) {
+                       _ERR("keyID match failed");
+                       return false;
+               }
+
+               common_key_id_list = g_list_first(common_key_id_list);
+
+               /*Set common keyIds in match*/
+               g_list_free_full(match_criteria->key_id_list, free);
+               match_criteria->key_id_list = common_key_id_list;
+
+               _INFO("keyID matched count [%d]", g_list_length(match_criteria->key_id_list));
+
+       }
+
+       _INFO("User verification matching");
+
+       /* 4. User verification match */
+       if (match_criteria->user_verification != -1) {
+               if ((match_criteria->user_verification == auth_info->user_verification)
+                       ||
+                       (((auth_info->user_verification & _USER_VER_METHOD_ALL) == 0)
+                               &&
+                               ((match_criteria->user_verification & _USER_VER_METHOD_ALL) == 0)
+                               &&
+                               ((auth_info->user_verification & match_criteria->user_verification) != 0)))
+               {
+                       _INFO("User verification match passed");
+               } else {
+                       _ERR("User verification match failed");
+                       return false;
+               }
+       }
+
+       /* 5. Key protection field bit matching */
+       if ((match_criteria->key_protection != -1) && auth_info->key_protection) {
+               if (((match_criteria->key_protection) && (auth_info->key_protection)) == 0) {
+                       _ERR("Key protection match failed");
+                       return false;
+               }
+       }
+
+       /* 6. Matcher Protection field bit matching */
+       if ((match_criteria->matcher_protection != -1) && auth_info->matcher_protection) {
+               if (((match_criteria->matcher_protection) && (auth_info->matcher_protection)) == 0) {
+                       _ERR("Matcher protection match failed");
+                       return false;
+               }
+       }
+
+       /* 7. Attachment hint field bit matching */
+       if ((match_criteria->attachement_hint != -1) && auth_info->attachment_hint) {
+               if (((match_criteria->attachement_hint) && (auth_info->attachment_hint)) == 0) {
+                       _ERR("Attachment hint match failed");
+                       return false;
+               }
+       }
+
+       /* 8. TC Display field bit matching */
+       if ((match_criteria->tc_display != -1) && auth_info->tc_display) {
+               if (((match_criteria->tc_display) && (auth_info->tc_display)) == 0) {
+                       _ERR("Attachment hint match failed");
+                       return false;
+               }
+       }
+
+       /* 9. If any algo is mentioned in match_criteria, then atleast one algo should match */
+       GList *match_algo_list = match_criteria->auth_algo_list;
+       if (match_algo_list && (g_list_length(match_algo_list))
+               && (auth_info->authentication_algorithm)) {
+               match_algo_list = g_list_first(match_algo_list);
+               if (g_list_find_custom(match_algo_list, GINT_TO_POINTER(auth_info->authentication_algorithm), (GCompareFunc)_int_cmp) == NULL) {
+                       _ERR("Algorithm match failed");
+                       return false;
+               }
+       }
+
+       /* 10. If any assertion scheme is mentioned in match_criteria, then atleast one assertion scheme should match */
+       GList *assertion_list = match_criteria->assertion_scheme_list;
+       if (assertion_list && (g_list_length(assertion_list)) && (auth_info->assertion_scheme) && (strlen(auth_info->assertion_scheme) > 0)) {
+               assertion_list = g_list_first(assertion_list);
+               if (g_list_find_custom(assertion_list, auth_info->assertion_scheme, (GCompareFunc)strcmp) == NULL) {
+                       _ERR("Assertion scheme match failed");
+                       return false;
+               }
+       }
+
+       /* 11. If any attestation type is mentioned in match_criteria, then atleast one attestation type should match */
+       GList *attestation_type_list = match_criteria->attestation_type_list;
+       if (attestation_type_list && (g_list_length(attestation_type_list))
+               && (auth_info->attestation_types)) {
+               attestation_type_list = g_list_first(attestation_type_list);
+               if (g_list_find_custom(attestation_type_list, GINT_TO_POINTER(auth_info->attestation_types), (GCompareFunc)_int_cmp) == NULL) {
+                       _ERR("Attestation type match failed");
+                       return false;
+               }
+       }
+
+       /* TODO : 12. Auth version */
+
+       /* TODO : 13. Extension */
+
+       _INFO("_policy_checker_is_matched true");
+
+       return true;
 }
 
 int
 _get_attestation_type(_match_criteria_t *match_criteria, fido_authenticator_s *auth_info)
 {
-     _INFO("_get_attestation_type");
-
-    if (match_criteria && match_criteria->attestation_type_list) {
-
-        GList *match_att_list_iter = g_list_first(match_criteria->attestation_type_list);
-        while (match_att_list_iter != NULL) {
-
-            int match_att_type = GPOINTER_TO_INT(match_att_list_iter->data);
-
-            if (auth_info && auth_info->attestation_types) {
-
-                GList *auth_att_list_iter = g_list_first(auth_info->attestation_types);
-                while (auth_att_list_iter != NULL) {
-
-                    int auth_att_type = GPOINTER_TO_INT(auth_att_list_iter->data);
-
-                    if (match_att_type == auth_att_type) {
-                        _INFO("_get_attestation_type end [%d]", match_att_type);
-                        return match_att_type;
-                    }
-                }
-            }
-            match_att_list_iter = match_att_list_iter->data;
-        }
-    }
-    else {
-        if (auth_info->attestation_types != NULL) {
-            GList *att_type_iter = g_list_first(auth_info->attestation_types);
-
-            /*Returning first attestation type in case policy does not mandate any*/
-            while (att_type_iter != NULL) {
-                int auth_att_type = GPOINTER_TO_INT(att_type_iter->data);
-                _INFO("Returning first attestation type in case policy does not mandate any [%d]", auth_att_type);
-                return auth_att_type;
-            }
-        }
-    }
-
-    _ERR("_get_attestation_type end");
-    return -1;
+       _INFO("_get_attestation_type");
+
+       if (match_criteria && match_criteria->attestation_type_list) {
+
+               GList *match_att_list_iter = g_list_first(match_criteria->attestation_type_list);
+               while (match_att_list_iter != NULL) {
+
+                       int match_att_type = GPOINTER_TO_INT(match_att_list_iter->data);
+
+                       if (auth_info && auth_info->attestation_types) {
+
+                               GList *auth_att_list_iter = g_list_first(auth_info->attestation_types);
+                               while (auth_att_list_iter != NULL) {
+
+                                       int auth_att_type = GPOINTER_TO_INT(auth_att_list_iter->data);
+
+                                       if (match_att_type == auth_att_type) {
+                                               _INFO("_get_attestation_type end [%d]", match_att_type);
+                                               return match_att_type;
+                                       }
+                               }
+                       }
+                       match_att_list_iter = match_att_list_iter->data;
+               }
+       } else {
+               if (auth_info->attestation_types != NULL) {
+                       GList *att_type_iter = g_list_first(auth_info->attestation_types);
+
+                       /*Returning first attestation type in case policy does not mandate any*/
+                       while (att_type_iter != NULL) {
+                               int auth_att_type = GPOINTER_TO_INT(att_type_iter->data);
+                               _INFO("Returning first attestation type in case policy does not mandate any [%d]", auth_att_type);
+                               return auth_att_type;
+                       }
+               }
+       }
+
+       _ERR("_get_attestation_type end");
+       return -1;
 }
 
 static char *
 __get_verification_method_string(unsigned long int ver_method)
 {
-    char *ver_str = calloc(1, 128);
+       char *ver_str = calloc(1, 128);
 
-    switch (ver_method) {
+       switch (ver_method) {
 
-    case _USER_VER_METHOD_PRESENCE:
-        snprintf(ver_str, 127, "%s", "Presence Authenticator");
-        break;
+               case _USER_VER_METHOD_PRESENCE:
+                       snprintf(ver_str, 127, "%s", "Presence Authenticator");
+                       break;
 
-    case _USER_VER_METHOD_FINGERPRINT:
-        snprintf(ver_str, 127, "%s", "Fingerprint Authenticator");
-        break;
+               case _USER_VER_METHOD_FINGERPRINT:
+                       snprintf(ver_str, 127, "%s", "Fingerprint Authenticator");
+                       break;
 
-    case _USER_VER_METHOD_PASSCODE:
-        snprintf(ver_str, 127, "%s", "Passcode Authenticator");
-        break;
+               case _USER_VER_METHOD_PASSCODE:
+                       snprintf(ver_str, 127, "%s", "Passcode Authenticator");
+                       break;
 
-    case _USER_VER_METHOD_VOICE_PRINT:
-        snprintf(ver_str, 127, "%s", "Voice Print Authenticator");
-        break;
+               case _USER_VER_METHOD_VOICE_PRINT:
+                       snprintf(ver_str, 127, "%s", "Voice Print Authenticator");
+                       break;
 
-    case _USER_VER_METHOD_FACE_PRINT:
-        snprintf(ver_str, 127, "%s", "Face Print Authenticator");
-        break;
+               case _USER_VER_METHOD_FACE_PRINT:
+                       snprintf(ver_str, 127, "%s", "Face Print Authenticator");
+                       break;
 
-    case _USER_VER_METHOD_LOCATION:
-        snprintf(ver_str, 127, "%s", "Location Authenticator");
-        break;
+               case _USER_VER_METHOD_LOCATION:
+                       snprintf(ver_str, 127, "%s", "Location Authenticator");
+                       break;
 
-    case _USER_VER_METHOD_EYE_PRINT:
-        snprintf(ver_str, 127, "%s", "Eye Print Authenticator");
-        break;
+               case _USER_VER_METHOD_EYE_PRINT:
+                       snprintf(ver_str, 127, "%s", "Eye Print Authenticator");
+                       break;
 
-    case _USER_VER_METHOD_PATTERN:
-        snprintf(ver_str, 127, "%s", "Pattern Authenticator");
-        break;
+               case _USER_VER_METHOD_PATTERN:
+                       snprintf(ver_str, 127, "%s", "Pattern Authenticator");
+                       break;
 
-    case _USER_VER_METHOD_HAND_PRINT:
-        snprintf(ver_str, 127, "%s", "Hand Print Authenticator");
-        break;
+               case _USER_VER_METHOD_HAND_PRINT:
+                       snprintf(ver_str, 127, "%s", "Hand Print Authenticator");
+                       break;
 
-//    case _USER_VER_METHOD_NONE:
-//        snprintf(ver_str, "%s", "");
-//        break;
+       //    case _USER_VER_METHOD_NONE:
+       //        snprintf(ver_str, "%s", "");
+       //        break;
 
-    case _USER_VER_METHOD_ALL:
-        snprintf(ver_str, 127, "%s", "All Authenticator");
-        break;
+               case _USER_VER_METHOD_ALL:
+                       snprintf(ver_str, 127, "%s", "All Authenticator");
+                       break;
 
-    default:
-        snprintf(ver_str, 127, "%s", "Other Type");
-        break;
-    }
+               default:
+                       snprintf(ver_str, 127, "%s", "Other Type");
+                       break;
+       }
 
-    return ver_str;
+       return ver_str;
 }
 
 static GList*
 __copy_string_list(GList *src)
 {
-    RET_IF_FAIL(src != NULL, NULL);
+       RET_IF_FAIL(src != NULL, NULL);
 
-    GList *dest = NULL;
+       GList *dest = NULL;
 
-    GList *iter = g_list_first(src);
-    while (iter != NULL) {
-        char *str = (char*)(iter->data);
-        dest = g_list_append(dest, strdup(str));
+       GList *iter = g_list_first(src);
+       while (iter != NULL) {
+               char *str = (char*)(iter->data);
+               dest = g_list_append(dest, strdup(str));
 
-        iter = iter->next;
-    }
+               iter = iter->next;
+       }
 
-    return dest;
+       return dest;
 }
 
 static GList*
@@ -422,124 +416,122 @@ __copy_png_list(GList *src_list)
 GList *
 _policy_checker_get_matched_auth_list(_policy_t *policy, GList *auth_list)
 {
-    _INFO("_policy_checker_get_matched_auth_list");
-
-    if (policy == NULL)
-        _INFO("policy is NULL");
+       _INFO("_policy_checker_get_matched_auth_list");
 
-    if (auth_list == NULL)
-        _INFO("auth_list is NULL");
+       if (policy == NULL)
+               _INFO("policy is NULL");
 
-    RET_IF_FAIL(policy != NULL, NULL);
-    RET_IF_FAIL(auth_list != NULL, NULL);
+       if (auth_list == NULL)
+               _INFO("auth_list is NULL");
 
-    //    _match_criteria_t *match_criteria_or = NULL;
-    GList *allowed_list = NULL;
-    GList *disallowed_list = policy->disallowed_list;
-    GList *accepted_list = policy->accepted_list;
+       RET_IF_FAIL(policy != NULL, NULL);
+       RET_IF_FAIL(auth_list != NULL, NULL);
 
-    if (accepted_list != NULL)
-        _INFO("accepted_list count = [%d]", g_list_length(accepted_list));
+       //    _match_criteria_t *match_criteria_or = NULL;
+       GList *allowed_list = NULL;
+       GList *disallowed_list = policy->disallowed_list;
+       GList *accepted_list = policy->accepted_list;
 
-    if (disallowed_list != NULL)
-        _INFO("allowed_list count = [%d]", g_list_length(disallowed_list));
+       if (accepted_list != NULL)
+               _INFO("accepted_list count = [%d]", g_list_length(accepted_list));
 
-    GList *accepted_list_iter = g_list_first(accepted_list);
-    while (accepted_list_iter != NULL) {
+       if (disallowed_list != NULL)
+               _INFO("allowed_list count = [%d]", g_list_length(disallowed_list));
 
-        GList *accepted_list_internal = (GList *) accepted_list_iter->data;
-        GList *accepted_list_internal_iter = g_list_first(accepted_list_internal);
-        while (accepted_list_internal_iter != NULL) {
-            _match_criteria_t *match_info = (_match_criteria_t *) accepted_list_internal_iter->data;
+       GList *accepted_list_iter = g_list_first(accepted_list);
+       while (accepted_list_iter != NULL) {
 
-            GList *auth_list_iter = g_list_first(auth_list);
-            while (auth_list_iter != NULL) {
-                fido_authenticator_s *authenticator = (fido_authenticator_s*) (auth_list_iter->data);
+               GList *accepted_list_internal = (GList *) accepted_list_iter->data;
+               GList *accepted_list_internal_iter = g_list_first(accepted_list_internal);
+               while (accepted_list_internal_iter != NULL) {
+                       _match_criteria_t *match_info = (_match_criteria_t *) accepted_list_internal_iter->data;
 
-                if (_policy_checker_is_matched(match_info, authenticator)) {
-                    _INFO("[%s] is matched from allowed list", authenticator->aaid);
+                       GList *auth_list_iter = g_list_first(auth_list);
+                       while (auth_list_iter != NULL) {
+                               fido_authenticator_s *authenticator = (fido_authenticator_s*) (auth_list_iter->data);
 
-                    /*Disallowed list can be NULL, which means put all which are matching with accepted list*/
+                               if (_policy_checker_is_matched(match_info, authenticator)) {
+                                       _INFO("[%s] is matched from allowed list", authenticator->aaid);
 
-                    if (disallowed_list != NULL) {
+                                       /*Disallowed list can be NULL, which means put all which are matching with accepted list*/
 
-                        GList *disallowed_list_iter = g_list_first(disallowed_list);
-                        while (disallowed_list_iter != NULL) {
-                            _match_criteria_t *disallowed_match_info = (_match_criteria_t *) disallowed_list_iter->data;
+                                       if (disallowed_list != NULL) {
 
-                            if (!_policy_checker_is_matched(disallowed_match_info, authenticator)) {
-                                _INFO("[%s] is not in disallowed list", authenticator->aaid);
-                                _matched_auth_data_t *matched_auth_data = (_matched_auth_data_t*) calloc(1, sizeof(_matched_auth_data_t));
-                                RET_IF_FAIL(matched_auth_data, NULL);
+                                               GList *disallowed_list_iter = g_list_first(disallowed_list);
+                                               while (disallowed_list_iter != NULL) {
+                                                       _match_criteria_t *disallowed_match_info = (_match_criteria_t *) disallowed_list_iter->data;
 
-                                /*TODO : ASM must send auth index*/
-                                if (authenticator->auth_index != NULL)
-                                    matched_auth_data->auth_index = strdup(authenticator->auth_index);
-                                else
-                                    _ERR("auth index missing");
+                                                       if (!_policy_checker_is_matched(disallowed_match_info, authenticator)) {
+                                                               _INFO("[%s] is not in disallowed list", authenticator->aaid);
+                                                               _matched_auth_data_t *matched_auth_data = (_matched_auth_data_t*) calloc(1, sizeof(_matched_auth_data_t));
+                                                               RET_IF_FAIL(matched_auth_data, NULL);
 
-                                matched_auth_data->att_type = _get_attestation_type(match_info, authenticator);
+                                                               /*TODO : ASM must send auth index*/
+                                                               if (authenticator->auth_index != NULL)
+                                                                       matched_auth_data->auth_index = strdup(authenticator->auth_index);
+                                                               else
+                                                                       _ERR("auth index missing");
 
-                                if (authenticator->title != NULL)
-                                    matched_auth_data->label = strdup(authenticator->title);
-                                else {
-                                    _ERR("title missing, putting ver method");
-                                    /*If label is null, set verification method name instead*/
-                                    matched_auth_data->label = __get_verification_method_string(authenticator->user_verification);
-                                }
+                                                               matched_auth_data->att_type = _get_attestation_type(match_info, authenticator);
 
+                                                               if (authenticator->title != NULL)
+                                                                       matched_auth_data->label = strdup(authenticator->title);
+                                                               else {
+                                                                       _ERR("title missing, putting ver method");
+                                                                       /*If label is null, set verification method name instead*/
+                                                                       matched_auth_data->label = __get_verification_method_string(authenticator->user_verification);
+                                                               }
 
-                                if (authenticator->asm_id != NULL)
-                                    matched_auth_data->asm_id = strdup(authenticator->asm_id);
-                                else
-                                    _ERR("Authenticator does not have any ASM ID!!");
+                                                               if (authenticator->asm_id != NULL)
+                                                                       matched_auth_data->asm_id = strdup(authenticator->asm_id);
+                                                               else
+                                                                       _ERR("Authenticator does not have any ASM ID!!");
 
-                                matched_auth_data->key_ids = __copy_string_list(match_info->key_id_list);
+                                                               matched_auth_data->key_ids = __copy_string_list(match_info->key_id_list);
                                                                /*fido_display_png_characteristics_descriptor_s list*/
                                                                matched_auth_data->tc_display_png_characteristics =
                                                                                __copy_png_list(authenticator->tc_display_png_characteristics);
 
-                                allowed_list = g_list_append(allowed_list, matched_auth_data);
-                            }
-                            disallowed_list_iter = disallowed_list_iter->next;
-                        }
-                    }
-                    else {
-                        _INFO("[%s] adding since no disallowed list", authenticator->aaid);
-                        _matched_auth_data_t *matched_auth_data = (_matched_auth_data_t*) calloc(1, sizeof(_matched_auth_data_t));
-                        RET_IF_FAIL(matched_auth_data, NULL);
-
-                        matched_auth_data->auth_index = strdup(authenticator->auth_index);
-                        matched_auth_data->att_type = _get_attestation_type(match_info, authenticator);
-                        if (authenticator->title != NULL)
-                            matched_auth_data->label = strdup(authenticator->title);
-                        else {
-                            _ERR("title missing, putting ver method");
-                            /*If label is null, set verification method name instead*/
-                            matched_auth_data->label = __get_verification_method_string(authenticator->user_verification);
-                        }
-
-                        if (authenticator->asm_id != NULL)
-                            matched_auth_data->asm_id = strdup(authenticator->asm_id);
-                        else
-                            _ERR("Authenticator does not have any ASM ID!!");
-
-                        matched_auth_data->key_ids = __copy_string_list(match_info->key_id_list);
-
-                        allowed_list = g_list_append(allowed_list, matched_auth_data);
-                    }
-                }
-                auth_list_iter = auth_list_iter->next;
-            }
-            accepted_list_internal_iter = accepted_list_internal_iter->next;
-        }
-        accepted_list_iter = accepted_list_iter->next;
-    }
-
-    if (allowed_list != NULL)
-        allowed_list = g_list_first(allowed_list);
-
-    return allowed_list;
+                                                               allowed_list = g_list_append(allowed_list, matched_auth_data);
+                                                       }
+                                                       disallowed_list_iter = disallowed_list_iter->next;
+                                               }
+                                       } else {
+                                               _INFO("[%s] adding since no disallowed list", authenticator->aaid);
+                                               _matched_auth_data_t *matched_auth_data = (_matched_auth_data_t*) calloc(1, sizeof(_matched_auth_data_t));
+                                               RET_IF_FAIL(matched_auth_data, NULL);
+
+                                               matched_auth_data->auth_index = strdup(authenticator->auth_index);
+                                               matched_auth_data->att_type = _get_attestation_type(match_info, authenticator);
+                                               if (authenticator->title != NULL)
+                                                       matched_auth_data->label = strdup(authenticator->title);
+                                               else {
+                                                       _ERR("title missing, putting ver method");
+                                                       /*If label is null, set verification method name instead*/
+                                                       matched_auth_data->label = __get_verification_method_string(authenticator->user_verification);
+                                               }
+
+                                               if (authenticator->asm_id != NULL)
+                                                       matched_auth_data->asm_id = strdup(authenticator->asm_id);
+                                               else
+                                                       _ERR("Authenticator does not have any ASM ID!!");
+
+                                               matched_auth_data->key_ids = __copy_string_list(match_info->key_id_list);
+
+                                               allowed_list = g_list_append(allowed_list, matched_auth_data);
+                                       }
+                               }
+                               auth_list_iter = auth_list_iter->next;
+                       }
+                       accepted_list_internal_iter = accepted_list_internal_iter->next;
+               }
+               accepted_list_iter = accepted_list_iter->next;
+       }
+
+       if (allowed_list != NULL)
+               allowed_list = g_list_first(allowed_list);
+
+       return allowed_list;
 }
 
 /* Returns _matched_auth_dereg_t list */
@@ -549,46 +541,46 @@ _policy_checker_get_matched_auth_list_dereg(const char *app_id, GList *input_aut
        _INFO("");
 
        RET_IF_FAIL(app_id, NULL);
-    RET_IF_FAIL(input_auth_list, NULL);
-    RET_IF_FAIL(available_auth_list, NULL);
+       RET_IF_FAIL(input_auth_list, NULL);
+       RET_IF_FAIL(available_auth_list, NULL);
 
        _INFO("");
 
-    GList *matched_auth_dereg_list = NULL;
+       GList *matched_auth_dereg_list = NULL;
 
-    GList *input_auth_list_iter = g_list_first(input_auth_list);
-    while (input_auth_list_iter != NULL) {
-        _dereg_auth_info_t *dereg_auth_info = (_dereg_auth_info_t*) (input_auth_list_iter->data);
+       GList *input_auth_list_iter = g_list_first(input_auth_list);
+       while (input_auth_list_iter != NULL) {
+               _dereg_auth_info_t *dereg_auth_info = (_dereg_auth_info_t*) (input_auth_list_iter->data);
 
-        GList *available_auth_list_iter = g_list_first(available_auth_list);
-        while (available_auth_list_iter != NULL) {
-            fido_authenticator_s *authenticator = (fido_authenticator_s*) (available_auth_list_iter->data);
+               GList *available_auth_list_iter = g_list_first(available_auth_list);
+               while (available_auth_list_iter != NULL) {
+                       fido_authenticator_s *authenticator = (fido_authenticator_s*) (available_auth_list_iter->data);
 
                        if (dereg_auth_info->aaid != NULL)
                                _INFO("Input AAID = [%s]", dereg_auth_info->aaid);
 
                        if (authenticator->aaid != NULL)
                                _INFO("Authenticator AAID = [%s]", authenticator->aaid);
-                       
-            if (dereg_auth_info->aaid && authenticator->aaid && !strcmp(dereg_auth_info->aaid, authenticator->aaid)) {
-                _matched_auth_dereg_t *matched_auth_dereg = (_matched_auth_dereg_t*) calloc(1, sizeof(_matched_auth_dereg_t));
-                RET_IF_FAIL(matched_auth_dereg, NULL);
-
-                matched_auth_dereg->auth_index = strdup(authenticator->auth_index);
-                matched_auth_dereg->app_id = strdup(app_id);
-                matched_auth_dereg->key_id = strdup(dereg_auth_info->key_id);
-                if (authenticator->asm_id != NULL)
-                    matched_auth_dereg->asm_id = strdup(authenticator->asm_id);
-                else
-                    _ERR("Authenticator does not have any ASM ID!!");
+
+                       if (dereg_auth_info->aaid && authenticator->aaid && !strcmp(dereg_auth_info->aaid, authenticator->aaid)) {
+                               _matched_auth_dereg_t *matched_auth_dereg = (_matched_auth_dereg_t*) calloc(1, sizeof(_matched_auth_dereg_t));
+                               RET_IF_FAIL(matched_auth_dereg, NULL);
+
+                               matched_auth_dereg->auth_index = strdup(authenticator->auth_index);
+                               matched_auth_dereg->app_id = strdup(app_id);
+                               matched_auth_dereg->key_id = strdup(dereg_auth_info->key_id);
+                               if (authenticator->asm_id != NULL)
+                                       matched_auth_dereg->asm_id = strdup(authenticator->asm_id);
+                               else
+                                       _ERR("Authenticator does not have any ASM ID!!");
 
                                _INFO("");
-                matched_auth_dereg_list = g_list_append(matched_auth_dereg_list, matched_auth_dereg);
-            }
-            available_auth_list_iter = available_auth_list_iter->next;
-        }
-        input_auth_list_iter = input_auth_list_iter->next;
-    }
-
-    return matched_auth_dereg_list;
+                               matched_auth_dereg_list = g_list_append(matched_auth_dereg_list, matched_auth_dereg);
+                       }
+                       available_auth_list_iter = available_auth_list_iter->next;
+               }
+               input_auth_list_iter = input_auth_list_iter->next;
+       }
+
+       return matched_auth_dereg_list;
 }
old mode 100644 (file)
new mode 100755 (executable)
index b3d9ab9..efc044e
@@ -20,14 +20,14 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common)
 
 ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_SOURCE_DIR}/common/dummy-asm-stub.c ${CMAKE_SOURCE_DIR}/common/dummy-asm-stub.h
 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/common/
-COMMAND gdbus-codegen --interface-prefix org.tizen. --generate-c-code dummy-asm-stub ${CMAKE_SOURCE_DIR}/common/dbus_interfaces/dummyasm.xml 
+COMMAND gdbus-codegen --interface-prefix org.tizen. --generate-c-code dummy-asm-stub ${CMAKE_SOURCE_DIR}/common/dbus_interfaces/dummyasm.xml
 COMMENT "Generating Dummy ASM GDBus stubs........................")
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -Werror")
 SET(CMAKE_LDFLAGS "-Wl,-zdefs")
 
 SET(DUMMY_ASM_SRCS
-        dummy_asm_server.c
+               dummy_asm_server.c
 )
 
 ADD_EXECUTABLE(${ASM_DAEMON} ${DUMMY_ASM_SRCS} ${CMAKE_SOURCE_DIR}/common/dummy-asm-stub.c)
index a34e200..c78542f 100644 (file)
@@ -1,8 +1,8 @@
 {
-        "vendor" : "Dummy Corp",
-        "bin_path" : "/usr/bin/dummyasm-service",
-        "dbus_info" : "org.tizen.dummyasm",
-        "dbus_obj_path" : "/org/tizen/dummyasm",
-        "dbus_interface_name" : "org.tizen.dummyasm",
-        "dbus_method_name" : "asm_request"
+               "vendor" : "Dummy Corp",
+               "bin_path" : "/usr/bin/dummyasm-service",
+               "dbus_info" : "org.tizen.dummyasm",
+               "dbus_obj_path" : "/org/tizen/dummyasm",
+               "dbus_interface_name" : "org.tizen.dummyasm",
+               "dbus_method_name" : "asm_request"
 }
index 37734d6..14be180 100644 (file)
@@ -22,7 +22,7 @@
 #include <sys/stat.h>
 #include <signal.h>
 #include <glib.h>
-#if !GLIB_CHECK_VERSION (2, 31, 0)
+#if !GLIB_CHECK_VERSION(2, 31, 0)
 #include <glib/gmacros.h>
 #endif
 
@@ -57,243 +57,240 @@ static Dummyasm* __dbus_obj = NULL;
 static inline int
 __read_proc(const char *path, char *buf, int size)
 {
-    int fd = 0;
-    int ret = 0;
-
-    if (buf == NULL || path == NULL) {
-        _ERR("path and buffer is mandatory\n");
-        return -1;
-    }
-
-    fd = open(path, O_RDONLY);
-    if (fd < 0) {
-        _ERR("fd open error(%d)\n", fd);
-        return -1;
-    }
-
-    ret = read(fd, buf, size - 1);
-    if (ret <= 0) {
-        _ERR("fd read error(%d)\n", fd);
-        close(fd);
-        return -1;
-    } else
-        buf[ret] = 0;
-
-    close(fd);
-
-    return ret;
+       int fd = 0;
+       int ret = 0;
+
+       if (buf == NULL || path == NULL) {
+               _ERR("path and buffer is mandatory\n");
+               return -1;
+       }
+
+       fd = open(path, O_RDONLY);
+       if (fd < 0) {
+               _ERR("fd open error(%d)\n", fd);
+               return -1;
+       }
+
+       ret = read(fd, buf, size - 1);
+       if (ret <= 0) {
+               _ERR("fd read error(%d)\n", fd);
+               close(fd);
+               return -1;
+       } else
+               buf[ret] = 0;
+
+       close(fd);
+
+       return ret;
 }
 
 static char*
 __get_proc_path_of_dbus_caller(GDBusMethodInvocation *invocation)
 {
-    //pid_t remote_pid = 0;
-    GError *error = NULL;
-    GDBusConnection *connection = NULL;
-    GVariant *response = NULL;
-    guint32 upid;
-    const gchar *sender = NULL;
-
-    sender = g_dbus_method_invocation_get_sender (invocation);
-    if (!sender) {
-        _ERR("Failed to get sender");
-        return NULL;
-    }
-
-    connection = g_dbus_method_invocation_get_connection(invocation);
-    if (connection == NULL) {
-        _ERR("Failed to open connection for the invocation [%s]", error->message);
-        g_error_free (error);
-        return NULL;
-    }
-
-    error = NULL;
-    response = g_dbus_connection_call_sync (connection,
-            _FREEDESKTOP_SERVICE, _FREEDESKTOP_PATH,
-            _FREEDESKTOP_INTERFACE, "GetConnectionUnixProcessID",
-            g_variant_new ("(s)", sender), ((const GVariantType *) "(u)"),
-            G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
-
-    if (response == NULL) {
-        _ERR("Failed to get caller id [%s]", error->message);
-        g_error_free (error);
-        return NULL;
-    }
-
-    g_variant_get (response, "(u)", &upid);
-    _INFO("Remote msg-bus peer service=%s pid=%u", sender, upid);
-    //remote_pid = (pid_t) upid;
-
-    g_variant_unref (response);
-
-    char buf[128];
-    int ret = 0;
-
-    snprintf(buf, sizeof(buf), "/proc/%d/cmdline", upid);
-    ret = __read_proc(buf, buf, sizeof(buf));
-    if (ret <= 0) {
-        _ERR("No proc directory (%d)\n", upid);
-        return NULL;
-    }
-
-    _INFO("Caller=[%s]", buf);
-
-    return strdup(buf);
+       //pid_t remote_pid = 0;
+       GError *error = NULL;
+       GDBusConnection *connection = NULL;
+       GVariant *response = NULL;
+       guint32 upid;
+       const gchar *sender = NULL;
+
+       sender = g_dbus_method_invocation_get_sender(invocation);
+       if (!sender) {
+               _ERR("Failed to get sender");
+               return NULL;
+       }
+
+       connection = g_dbus_method_invocation_get_connection(invocation);
+       if (connection == NULL) {
+               _ERR("Failed to open connection for the invocation [%s]", error->message);
+               g_error_free(error);
+               return NULL;
+       }
+
+       error = NULL;
+       response = g_dbus_connection_call_sync(connection,
+                       _FREEDESKTOP_SERVICE, _FREEDESKTOP_PATH,
+                       _FREEDESKTOP_INTERFACE, "GetConnectionUnixProcessID",
+                       g_variant_new("(s)", sender), ((const GVariantType *) "(u)"),
+                       G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+
+       if (response == NULL) {
+               _ERR("Failed to get caller id [%s]", error->message);
+               g_error_free(error);
+               return NULL;
+       }
+
+       g_variant_get(response, "(u)", &upid);
+       _INFO("Remote msg-bus peer service=%s pid=%u", sender, upid);
+       //remote_pid = (pid_t) upid;
+
+       g_variant_unref(response);
+
+       char buf[128];
+       int ret = 0;
+
+       snprintf(buf, sizeof(buf), "/proc/%d/cmdline", upid);
+       ret = __read_proc(buf, buf, sizeof(buf));
+       if (ret <= 0) {
+               _ERR("No proc directory (%d)\n", upid);
+               return NULL;
+       }
+
+       _INFO("Caller=[%s]", buf);
+
+       return strdup(buf);
 }
 
 static char*
 __get_request_type(const char *asm_req_json)
 {
-    if (asm_req_json == NULL)
-        return NULL;
+       if (asm_req_json == NULL)
+               return NULL;
 
-    JsonParser *parser = json_parser_new();
-    RET_IF_FAIL(parser != NULL, NULL);
+       JsonParser *parser = json_parser_new();
+       RET_IF_FAIL(parser != NULL, NULL);
 
-    GError *parse_err = NULL;
-    json_parser_load_from_data(parser, asm_req_json, -1, &parse_err);
-    RET_IF_FAIL(parse_err == NULL, NULL);
+       GError *parse_err = NULL;
+       json_parser_load_from_data(parser, asm_req_json, -1, &parse_err);
+       RET_IF_FAIL(parse_err == NULL, NULL);
 
-    JsonNode *root = json_parser_get_root(parser);
-    RET_IF_FAIL(root != NULL, NULL);
+       JsonNode *root = json_parser_get_root(parser);
+       RET_IF_FAIL(root != NULL, NULL);
 
-    JsonObject *root_obj = json_node_get_object(root);
+       JsonObject *root_obj = json_node_get_object(root);
 
-    const char *req_type = json_object_get_string_member(root_obj, "requestType");
+       const char *req_type = json_object_get_string_member(root_obj, "requestType");
 
-    return strdup(req_type);
+       return strdup(req_type);
 
 }
 
 gboolean
 _dbus_on_asm_request(Dummyasm *object, GDBusMethodInvocation *invocation, const gchar *uaf_request_json)
 {
-    _INFO("_dbus_on_asm_request");
-
-    char *caller_path = __get_proc_path_of_dbus_caller(invocation);
-    if (caller_path == NULL) {
-        _ERR("Failed to get caller path");
-        dummyasm_complete_asm_request(object, invocation, -1, NULL);
-        return true;
-    }
-
-    if (strcmp(caller_path, _FIDO_SERVICE_PATH) != 0) {
-        _ERR("Only fido-service is allowed to call ASM");
-        dummyasm_complete_asm_request(object, invocation, -1, NULL);
-        return true;
-    }
-
-    char *req_type = __get_request_type(uaf_request_json);
-    if (req_type == NULL){
-         dummyasm_complete_asm_request(object, invocation, -1, NULL);
-        return true;
-    }
-
-    _INFO("request type=[%s]", req_type);
-
-    if (strcmp(req_type, "GetInfo") == 0){
-        dummyasm_complete_asm_request(object, invocation, 0, _GET_INFO_RESPONSE);
-    }
-    if (strcmp(req_type, "Register") == 0){
-        dummyasm_complete_asm_request(object, invocation, 0, _REG_RESPONSE);
-    }
-    if (strcmp(req_type, "Authenticate") == 0){
-        dummyasm_complete_asm_request(object, invocation, 0, _AUTH_RESPONSE);
-    }
-    if (strcmp(req_type, "Deregister") == 0){
-        dummyasm_complete_asm_request(object, invocation, 0, _DEREG_RESPONSE);
-    }
-    if (strcmp(req_type, "GetRegistrations") == 0) {
-        dummyasm_complete_asm_request(object, invocation, 0, _GET_REGISTRATIONS_RESPONSE);
-    }
-
-    return true;
+       _INFO("_dbus_on_asm_request");
+
+       char *caller_path = __get_proc_path_of_dbus_caller(invocation);
+       if (caller_path == NULL) {
+               _ERR("Failed to get caller path");
+               dummyasm_complete_asm_request(object, invocation, -1, NULL);
+               return true;
+       }
+
+       if (strcmp(caller_path, _FIDO_SERVICE_PATH) != 0) {
+               _ERR("Only fido-service is allowed to call ASM");
+               dummyasm_complete_asm_request(object, invocation, -1, NULL);
+               return true;
+       }
+
+       char *req_type = __get_request_type(uaf_request_json);
+       if (req_type == NULL) {
+                dummyasm_complete_asm_request(object, invocation, -1, NULL);
+               return true;
+       }
+
+       _INFO("request type=[%s]", req_type);
+
+       if (strcmp(req_type, "GetInfo") == 0) {
+               dummyasm_complete_asm_request(object, invocation, 0, _GET_INFO_RESPONSE);
+       }
+       if (strcmp(req_type, "Register") == 0) {
+               dummyasm_complete_asm_request(object, invocation, 0, _REG_RESPONSE);
+       }
+       if (strcmp(req_type, "Authenticate") == 0) {
+               dummyasm_complete_asm_request(object, invocation, 0, _AUTH_RESPONSE);
+       }
+       if (strcmp(req_type, "Deregister") == 0) {
+               dummyasm_complete_asm_request(object, invocation, 0, _DEREG_RESPONSE);
+       }
+       if (strcmp(req_type, "GetRegistrations") == 0) {
+               dummyasm_complete_asm_request(object, invocation, 0, _GET_REGISTRATIONS_RESPONSE);
+       }
+
+       return true;
 }
 
 static void
-on_bus_acquired (GDBusConnection *connection, const gchar *name, gpointer user_data)
+on_bus_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
 {
                _INFO("on_bus_acquired");
-        
-        GDBusInterfaceSkeleton* interface = NULL;
-        __dbus_obj = dummyasm_skeleton_new();
-        if (__dbus_obj == NULL) {
-            return;
-        }
-
-        interface = G_DBUS_INTERFACE_SKELETON(__dbus_obj);
-        if (!g_dbus_interface_skeleton_export(interface, connection, _DUMMY_ASM_SERVICE_DBUS_PATH, NULL)) {
-            return;
-        }
-
-        _INFO("before g_signal_connect");
-        g_signal_connect(__dbus_obj, "handle_asm_request",
-                        G_CALLBACK(_dbus_on_asm_request), NULL);
 
+               GDBusInterfaceSkeleton* interface = NULL;
+               __dbus_obj = dummyasm_skeleton_new();
+               if (__dbus_obj == NULL) {
+                       return;
+               }
+
+               interface = G_DBUS_INTERFACE_SKELETON(__dbus_obj);
+               if (!g_dbus_interface_skeleton_export(interface, connection, _DUMMY_ASM_SERVICE_DBUS_PATH, NULL)) {
+                       return;
+               }
+
+               _INFO("before g_signal_connect");
+               g_signal_connect(__dbus_obj, "handle_asm_request",
+                                               G_CALLBACK(_dbus_on_asm_request), NULL);
 }
 
 static void
-on_name_acquired (GDBusConnection *connection,
-                        const gchar     *name,
-                        gpointer         user_data)
+on_name_acquired(GDBusConnection *connection,
+                                               const gchar     *name,
+                                               gpointer         user_data)
 {
        _INFO("on_name_acquired");
 }
 
 static void
-on_name_lost (GDBusConnection *connection,
-                        const gchar     *name,
-                        gpointer         user_data)
+on_name_lost(GDBusConnection *connection,
+                                               const gchar     *name,
+                                               gpointer         user_data)
 {
        _INFO("on_name_lost");
-    exit (1);
+       exit(1);
 }
 
 static bool _initialize_dbus()
 {
        _INFO("_initialize_dbus");
-    owner_id = g_bus_own_name (G_BUS_TYPE_SYSTEM,
-                             "org.tizen.dummyasm",
-                             G_BUS_NAME_OWNER_FLAGS_NONE,
-                             on_bus_acquired,
-                             on_name_acquired,
-                             on_name_lost,
-                             NULL,
-                             NULL);
-
-    if(owner_id == 0) {
-            _INFO("owner_id is 0");
-            return false;
-    }
-
-    
-    return true;
+       owner_id = g_bus_own_name(G_BUS_TYPE_SYSTEM,
+                                                        "org.tizen.dummyasm",
+                                                        G_BUS_NAME_OWNER_FLAGS_NONE,
+                                                        on_bus_acquired,
+                                                        on_name_acquired,
+                                                        on_name_lost,
+                                                        NULL,
+                                                        NULL);
+
+       if (owner_id == 0) {
+                       _INFO("owner_id is 0");
+                       return false;
+       }
+
+       return true;
 }
 
 static void
 _initialize(void)
 {
-#if !GLIB_CHECK_VERSION(2,35,0)
-    g_type_init();
+#if !GLIB_CHECK_VERSION(2, 35, 0)
+       g_type_init();
 #endif
 
-    if (_initialize_dbus() == false) {
-        /* because dbus's initialize failed, we cannot continue any more. */
-        exit(1);
-    }
+       if (_initialize_dbus() == false) {
+               /* because dbus's initialize failed, we cannot continue any more. */
+               exit(1);
+       }
 }
 
 int
 main(void)
 {
-    GMainLoop *mainloop = NULL;
+       GMainLoop *mainloop = NULL;
 
-    mainloop = g_main_loop_new(NULL, FALSE);
+       mainloop = g_main_loop_new(NULL, FALSE);
 
-    _initialize();
+       _initialize();
 
-    g_main_loop_run(mainloop);
+       g_main_loop_run(mainloop);
 
-    
-    return 0;
+       return 0;
 }
index 9b10474..abfa3aa 100755 (executable)
@@ -70,7 +70,7 @@ static void create_popup(char *popup_str, appdata_s *ad)
        Evas_Object *popup = elm_popup_add(ad->win);
        Evas_Object *btn;
        char str[2048] = {0,};
-       strcpy(str,popup_str);
+       strcpy(str, popup_str);
        elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
        evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        elm_object_text_set(popup, popup_str);
@@ -90,9 +90,9 @@ static void create_popup(char *popup_str, appdata_s *ad)
 char *get_error_code(fido_error_e error_code)
 {
 
-       char *error_str = calloc(1,128);
+       char *error_str = calloc(1, 128);
 
-       if(error_code == FIDO_ERROR_NONE)
+       if (error_code == FIDO_ERROR_NONE)
                strcpy(error_str, "SUCCESS");
        else if (error_code == FIDO_ERROR_OUT_OF_MEMORY)
                strcpy(error_str, "FIDO_ERROR_OUT_OF_MEMORY");
@@ -130,12 +130,12 @@ void uaf_version_cb(fido_version_h version, void *user_data)
        int minor = -1;
 
        fido_get_uaf_version(version, &major, &minor);
-       if(major != -1) {
+       if (major != -1) {
                sprintf(tmp, " | Version Major = [%d]", major);
                strcat(str, tmp);
        }
 
-       if(minor != -1) {
+       if (minor != -1) {
                sprintf(tmp, " | Version Minor = [%d]", minor);
                strcat(str, tmp);
        }
@@ -146,7 +146,7 @@ void fido_attestation_type_cb_list(int att_type, void *user_data)
        char *str = (char *) user_data;
 
        char tmp[1024] = {0,};
-       if(att_type != -1) {
+       if (att_type != -1) {
                sprintf(tmp, " | Attestation Type = [%d]", att_type);
                strcat(str, tmp);
        }
@@ -157,7 +157,7 @@ void ext_cb_list(char *ext, void *user_data)
        char *str = (char *) user_data;
 
        char tmp[1024] = {0,};
-       if(ext) {
+       if (ext) {
                sprintf(tmp, " | Extension = [%s]", ext);
                strcat(str, tmp);
        }
@@ -173,28 +173,28 @@ __print_authinfo(fido_authenticator_h auth, appdata_s *ad)
 
        char *title =  NULL;
        fido_authenticator_get_title(auth, &title);
-       if(title) {
+       if (title) {
                sprintf(tmp, " | Title = [%s]", title);
                strcat(str, tmp);
        }
 
        char *aaid = NULL;
        fido_authenticator_get_aaid(auth, &aaid);
-       if(aaid) {
+       if (aaid) {
                sprintf(tmp, " | AAID = [%s]", aaid);
                strcat(str, tmp);
        }
 
        char *description = NULL;
        fido_authenticator_get_description(auth, &description);
-       if(description) {
+       if (description) {
                sprintf(tmp, " | Description = [%s]", description);
                strcat(str, tmp);
        }
 
        char *scheme = NULL;
        fido_authenticator_get_assertion_scheme(auth, &scheme);
-       if(scheme) {
+       if (scheme) {
                sprintf(tmp, " | Scheme = [%s]", scheme);
                strcat(str, tmp);
        }
@@ -203,56 +203,56 @@ __print_authinfo(fido_authenticator_h auth, appdata_s *ad)
 
        int get_algo = -1;
        fido_authenticator_get_algorithm(auth, &get_algo);
-       if(get_algo != -1) {
+       if (get_algo != -1) {
                sprintf(tmp, " | Algo = [%d]", get_algo);
                strcat(str, tmp);
        }
 
        int user_ver = -1;
        fido_authenticator_get_verification_method(auth, &user_ver);
-       if(user_ver != -1) {
+       if (user_ver != -1) {
                sprintf(tmp, " | Verification = [%d]", user_ver);
                strcat(str, tmp);
        }
 
        int key_protection = -1;
        fido_authenticator_get_verification_method(auth, &key_protection);
-       if(key_protection != -1) {
+       if (key_protection != -1) {
                sprintf(tmp, " | Key Protection = [%d]", key_protection);
                strcat(str, tmp);
        }
 
        int matcher_protection = -1;
        fido_authenticator_get_matcher_protection_method(auth, &matcher_protection);
-       if(matcher_protection != -1) {
+       if (matcher_protection != -1) {
                sprintf(tmp, " | Matcher Protection = [%d]", matcher_protection);
                strcat(str, tmp);
        }
 
        int attachment_hint = -1;
        fido_authenticator_get_attachment_hint(auth, &attachment_hint);
-       if(attachment_hint != -1) {
+       if (attachment_hint != -1) {
                sprintf(tmp, " | Attachment Hint = [%d]", attachment_hint);
                strcat(str, tmp);
        }
 
        int tc_discplay = -1;
        fido_authenticator_get_tc_discplay(auth, &tc_discplay);
-       if(tc_discplay != -1) {
+       if (tc_discplay != -1) {
                sprintf(tmp, " | Tc Display = [%d]", tc_discplay);
                strcat(str, tmp);
        }
 
        char *tc_display_type = NULL;
        fido_authenticator_get_tc_display_type(auth, &tc_display_type);
-       if(tc_display_type) {
+       if (tc_display_type) {
                sprintf(tmp, " | Tc Display Type = [%s]", tc_display_type);
                strcat(str, tmp);
        }
 
        char *icon = NULL;
        fido_authenticator_get_icon(auth, &icon);
-       if(icon) {
+       if (icon) {
                sprintf(tmp, " | Icon = [%s]", icon);
                strcat(str, tmp);
        }
@@ -287,8 +287,7 @@ _fido_authenticator_cb(int tizen_error_code, fido_discovery_data_h discovery_dat
 
        if (tizen_error_code == FIDO_ERROR_NONE) {
                __print_discovery_data(discovery_data, (appdata_s *) user_data);
-       }
-       else {
+       } else {
                char *error_string = get_error_code(tizen_error_code);
                create_popup(error_string, (appdata_s *) user_data);
                free(error_string);
@@ -335,8 +334,7 @@ _process_cb(int tizen_error_code, char *uaf_response, void *user_data)
                strcat(str, "uaf response = ");
                strcat(str, uaf_response);
                create_popup(str, (appdata_s *) user_data);
-       }
-       else {
+       } else {
                char *error_string = get_error_code(tizen_error_code);
                create_popup(error_string, (appdata_s *) user_data);
                free(error_string);
@@ -415,8 +413,7 @@ _process_cb_for_notify_pos(int tizen_error_code, char *uaf_response, void *user_
                char *error_string = get_error_code(tizen_error_code);
                create_popup(error_string, (appdata_s *) user_data);
                free(error_string);
-       }
-       else {
+       } else {
                char *error_string = get_error_code(tizen_error_code);
                create_popup(error_string, (appdata_s *) user_data);
                free(error_string);
@@ -437,8 +434,7 @@ _process_cb_for_notify_neg(int tizen_error_code, char *uaf_response, void *user_
                char *error_string = get_error_code(tizen_error_code);
                create_popup(error_string, (appdata_s *) user_data);
                free(error_string);
-       }
-       else {
+       } else {
                char *error_string = get_error_code(tizen_error_code);
                create_popup(error_string, (appdata_s *) user_data);
                free(error_string);
old mode 100644 (file)
new mode 100755 (executable)
index dcedc2e..aad3c00
@@ -28,8 +28,8 @@ IF(NOT DEFINED DESKTOP_ICON)
        SET(DESKTOP_ICON ${PACKAGE_NAME}.png)
 ENDIF(NOT DEFINED DESKTOP_ICON)
 
-SET(TEST_SRCS 
-        src/main.c
+SET(TEST_SRCS
+               src/main.c
 )
 
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common)
index 0e878d0..7f09c6c 100644 (file)
@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>\r
 <manifest xmlns="http://tizen.org/ns/packages" api-version="2.4" package="org.tizen.FidoSample" version="1.0.0">\r
-    <profile name="mobile"/>\r
-    <ui-application appid="org.tizen.FidoSample" exec="/opt/usr/apps/org.tizen.FidoSample/bin/org.tizen.FidoSample" multiple="false" nodisplay="false" taskmanage="true" type="capp">\r
-        <label>fidosample</label>\r
-        <icon>org.tizen.FidoSample.png</icon>\r
-    </ui-application>\r
-    <privileges>\r
-        <privilege>http://tizen.org/privilege/account.read</privilege>\r
-        <privilege>http://tizen.org/privilege/account.write</privilege>\r
-        <privilege>http://tizen.org/privilege/internet</privilege>\r
-    </privileges>\r
+       <profile name="mobile"/>\r
+       <ui-application appid="org.tizen.FidoSample" exec="/opt/usr/apps/org.tizen.FidoSample/bin/org.tizen.FidoSample" multiple="false" nodisplay="false" taskmanage="true" type="capp">\r
+               <label>fidosample</label>\r
+               <icon>org.tizen.FidoSample.png</icon>\r
+       </ui-application>\r
+       <privileges>\r
+               <privilege>http://tizen.org/privilege/account.read</privilege>\r
+               <privilege>http://tizen.org/privilege/account.write</privilege>\r
+               <privilege>http://tizen.org/privilege/internet</privilege>\r
+       </privileges>\r
 </manifest>\r
index 9cb7263..51874bd 100644 (file)
@@ -1,50 +1,50 @@
 [
-    {
-        "header": {
-            "upv": {
-                "major": 1,
-                "minor": 0
-            },
-            "op": "Auth",
-            "appID": "org.tizen.FidoSample",
-            "serverData": "emKubKMS8RxYOth7J8enT_x7dQWBaO1CiC0fGmSEhX56kq2RYo1LRpwvfHlzYRI3p9Ay-l4zJcV3lX6rQ0CYNWi5nNDabClFm3k0pPj0kX5V-db9ejN_05y2J6wqztSD"
-        },
-        "challenge": "1AM2yZY4-9SG4Ns7-hMdB8IV_FTDKFFiUqNJNVbsVoo",
-        "transaction": [
-            {
-                "contentType": "text/plain",
-                "content": "VHJhbnNhY3Rpb24gQ29udGVudCBmb3IgVGVzdC4",
-                "tcDisplayPNGCharacteristics": [
-                    {
-                        "width": 320,
-                        "height": 240,
-                        "bitDepth": 16,
-                        "colorType": 2,
-                        "compression": 0,
-                        "filter": 0,
-                        "interlace": 0
-                    }
-                ]
-            }
-        ],
-        "policy": {
-            "accepted": [
-                [
-                    {
-                        "aaid": [
-                            "0001#8001"
-                        ]
-                    }
-                ],
-                [
-                    {
-                        "aaid": [
-                            "DDDD#F001"
-                        ]
-                    }
-                ]
-            ]
-        }
-    }
+       {
+               "header": {
+                       "upv": {
+                               "major": 1,
+                               "minor": 0
+                       },
+                       "op": "Auth",
+                       "appID": "org.tizen.FidoSample",
+                       "serverData": "emKubKMS8RxYOth7J8enT_x7dQWBaO1CiC0fGmSEhX56kq2RYo1LRpwvfHlzYRI3p9Ay-l4zJcV3lX6rQ0CYNWi5nNDabClFm3k0pPj0kX5V-db9ejN_05y2J6wqztSD"
+               },
+               "challenge": "1AM2yZY4-9SG4Ns7-hMdB8IV_FTDKFFiUqNJNVbsVoo",
+               "transaction": [
+                       {
+                               "contentType": "text/plain",
+                               "content": "VHJhbnNhY3Rpb24gQ29udGVudCBmb3IgVGVzdC4",
+                               "tcDisplayPNGCharacteristics": [
+                                       {
+                                               "width": 320,
+                                               "height": 240,
+                                               "bitDepth": 16,
+                                               "colorType": 2,
+                                               "compression": 0,
+                                               "filter": 0,
+                                               "interlace": 0
+                                       }
+                               ]
+                       }
+               ],
+               "policy": {
+                       "accepted": [
+                               [
+                                       {
+                                               "aaid": [
+                                                       "0001#8001"
+                                               ]
+                                       }
+                               ],
+                               [
+                                       {
+                                               "aaid": [
+                                                       "DDDD#F001"
+                                               ]
+                                       }
+                               ]
+                       ]
+               }
+       }
 ]
 
index c330f4e..7d93d5f 100644 (file)
@@ -1,18 +1,18 @@
 [
-    {
-        "header": {
-            "upv": {
-                "major": "1",
-                "minor": "0"
-            },
-            "op": "Dereg",
-            "appID": "org.tizen.FidoSample"
-        },
-        "authenticators": [
-            {
-                "aaid": "0001#8001",
-                "keyID": "uWrbo_8JI1HmPESrNAStTVV8ZbBrzLsf_kZu1QKX2YY"
-            }
-        ]
-    }
+       {
+               "header": {
+                       "upv": {
+                               "major": "1",
+                               "minor": "0"
+                       },
+                       "op": "Dereg",
+                       "appID": "org.tizen.FidoSample"
+               },
+               "authenticators": [
+                       {
+                               "aaid": "0001#8001",
+                               "keyID": "uWrbo_8JI1HmPESrNAStTVV8ZbBrzLsf_kZu1QKX2YY"
+                       }
+               ]
+       }
 ]
index c3570a7..418e813 100644 (file)
@@ -1,33 +1,33 @@
 [
-    {
-        "header": {
-            "upv": {
-                "major": 1,
-                "minor": 0
-            },
+       {
+               "header": {
+                       "upv": {
+                               "major": 1,
+                               "minor": 0
+                       },
 "op":"Reg",
 "appID":"org.tizen.FidoSample",
-            "serverData": "nwV8EPqS5raZdAgH3GD9Z-ytCA9MkiiWaCsr1GHHNJ2yUh3HaV1HHxd4Z67FefJOD5sQYZvipfg5BavhdWPMecD2SH39aJixoXN9ZaNwRlcftJe9WbtPNDC9q5V9WX7Z5jCwkAwehcI"
-        },
-        "challenge": "9pIcUwwrY5eD9o3OwfhkeHLnoIl0vaeJUbxSHMe_XgE",
+                       "serverData": "nwV8EPqS5raZdAgH3GD9Z-ytCA9MkiiWaCsr1GHHNJ2yUh3HaV1HHxd4Z67FefJOD5sQYZvipfg5BavhdWPMecD2SH39aJixoXN9ZaNwRlcftJe9WbtPNDC9q5V9WX7Z5jCwkAwehcI"
+               },
+               "challenge": "9pIcUwwrY5eD9o3OwfhkeHLnoIl0vaeJUbxSHMe_XgE",
 "username":"ryan",
-        "policy": {
-            "accepted": [
-                [
-                    {
-                        "aaid": [
-                            "0001#8001"
-                        ]
-                    }
-                ],
-                [
-                    {
-                        "aaid": [
-                            "DDDD#F001"
-                        ]
-                    }
-                ]
-            ]
-        }
-    }
+               "policy": {
+                       "accepted": [
+                               [
+                                       {
+                                               "aaid": [
+                                                       "0001#8001"
+                                               ]
+                                       }
+                               ],
+                               [
+                                       {
+                                               "aaid": [
+                                                       "DDDD#F001"
+                                               ]
+                                       }
+                               ]
+                       ]
+               }
+       }
 ]
index c0f2a83..cd86ca0 100755 (executable)
@@ -90,9 +90,9 @@ static void create_popup(char *popup_str, appdata_s *ad)
 char *get_error_code(fido_error_e error_code)
 {
 
-       char *error_str = calloc(1,128);
+       char *error_str = calloc(1, 128);
 
-       if(error_code == FIDO_ERROR_NONE)
+       if (error_code == FIDO_ERROR_NONE)
                strcpy(error_str, "SUCCESS");
        else if (error_code == FIDO_ERROR_OUT_OF_MEMORY)
                strcpy(error_str, "FIDO_ERROR_OUT_OF_MEMORY");
@@ -134,7 +134,7 @@ void fido_attestation_type_cb_list(fido_auth_attestation_type_e att_type, void *
        char *str = (char *) user_data;
 
        char tmp[1024] = {0,};
-       if(att_type != -1) {
+       if (att_type != -1) {
                sprintf(tmp, " | Attestation Type = [%d]", att_type);
                strcat(str, tmp);
        }
@@ -152,7 +152,7 @@ __print_authinfo(const fido_authenticator_h auth, appdata_s *ad)
 
        char *title =  NULL;
        fido_authenticator_get_title(auth, &title);
-       if(title) {
+       if (title) {
                sprintf(tmp, " | Title = [%s]", title);
                strcat(str, tmp);
        }
@@ -160,7 +160,7 @@ __print_authinfo(const fido_authenticator_h auth, appdata_s *ad)
 
        char *aaid = NULL;
        fido_authenticator_get_aaid(auth, &aaid);
-       if(aaid) {
+       if (aaid) {
                sprintf(tmp, " | AAID = [%s]", aaid);
                strcat(str, tmp);
        }
@@ -168,7 +168,7 @@ __print_authinfo(const fido_authenticator_h auth, appdata_s *ad)
 
        char *description = NULL;
        fido_authenticator_get_description(auth, &description);
-       if(description) {
+       if (description) {
                sprintf(tmp, " | Description = [%s]", description);
                strcat(str, tmp);
        }
@@ -176,7 +176,7 @@ __print_authinfo(const fido_authenticator_h auth, appdata_s *ad)
 
        char *scheme = NULL;
        fido_authenticator_get_assertion_scheme(auth, &scheme);
-       if(scheme) {
+       if (scheme) {
                sprintf(tmp, " | Scheme = [%s]", scheme);
                strcat(str, tmp);
        }
@@ -186,49 +186,49 @@ __print_authinfo(const fido_authenticator_h auth, appdata_s *ad)
 
        fido_auth_algo_e get_algo = -1;
        fido_authenticator_get_algorithm(auth, &get_algo);
-       if(get_algo != -1) {
+       if (get_algo != -1) {
                sprintf(tmp, " | Algo = [%d]", get_algo);
                strcat(str, tmp);
        }
 
        fido_auth_user_verify_type_e user_ver = -1;
        fido_authenticator_get_verification_method(auth, &user_ver);
-       if(user_ver != -1) {
+       if (user_ver != -1) {
                sprintf(tmp, " | Verification = [%d]", user_ver);
                strcat(str, tmp);
        }
 
        fido_auth_key_protection_type_e key_protection = -1;
        fido_authenticator_get_key_protection_method(auth, &key_protection);
-       if(key_protection != -1) {
+       if (key_protection != -1) {
                sprintf(tmp, " | Key Protection = [%d]", key_protection);
                strcat(str, tmp);
        }
 
        fido_auth_matcher_protection_type_e matcher_protection = -1;
        fido_authenticator_get_matcher_protection_method(auth, &matcher_protection);
-       if(matcher_protection != -1) {
+       if (matcher_protection != -1) {
                sprintf(tmp, " | Matcher Protection = [%d]", matcher_protection);
                strcat(str, tmp);
        }
 
        fido_auth_attachment_hint_e attachment_hint = -1;
        fido_authenticator_get_attachment_hint(auth, &attachment_hint);
-       if(attachment_hint != -1) {
+       if (attachment_hint != -1) {
                sprintf(tmp, " | Attachment Hint = [%d]", attachment_hint);
                strcat(str, tmp);
        }
 
        fido_auth_tc_display_type_e tc_discplay = -1;
        fido_authenticator_get_tc_discplay(auth, &tc_discplay);
-       if(tc_discplay != -1) {
+       if (tc_discplay != -1) {
                sprintf(tmp, " | Tc Display = [%d]", tc_discplay);
                strcat(str, tmp);
        }
 
        char *tc_display_type = NULL;
        fido_authenticator_get_tc_display_type(auth, &tc_display_type);
-       if(tc_display_type) {
+       if (tc_display_type) {
                sprintf(tmp, " | Tc Display Type = [%s]", tc_display_type);
                strcat(str, tmp);
        }
@@ -236,7 +236,7 @@ __print_authinfo(const fido_authenticator_h auth, appdata_s *ad)
 
        char *icon = NULL;
        fido_authenticator_get_icon(auth, &icon);
-       if(icon) {
+       if (icon) {
                sprintf(tmp, " | Icon = [%s]", icon);
                strcat(str, tmp);
        }
@@ -283,8 +283,7 @@ start_check_policy(void *data, Evas_Object *obj, void *event_info)
                sprintf(str, "[%s]", error_string);
                create_popup(str, (appdata_s *) data);
                free(error_string);
-       }
-       else {
+       } else {
                if (is_supported == true)
                        sprintf(str, "TRUE");
                else
@@ -309,8 +308,7 @@ _process_cb(fido_error_e tizen_error_code, const char *uaf_response, void *user_
 
                create_popup(popup_str, (appdata_s *) user_data);
                free(popup_str);
-       }
-       else {
+       } else {
                __show_error(tizen_error_code, (appdata_s *)user_data);
        }
 }
@@ -379,8 +377,7 @@ _process_cb_for_notify_pos(fido_error_e tizen_error_code, const char *uaf_respon
                char *error_string = get_error_code(tizen_error_code);
                create_popup(error_string, (appdata_s *) user_data);
                free(error_string);
-       }
-       else {
+       } else {
                __show_error(tizen_error_code, (appdata_s *)user_data);
        }
 }
@@ -399,8 +396,7 @@ _process_cb_for_notify_neg(fido_error_e tizen_error_code, const char *uaf_respon
                char *error_string = get_error_code(tizen_error_code);
                create_popup(error_string, (appdata_s *) user_data);
                free(error_string);
-       }
-       else {
+       } else {
                __show_error(tizen_error_code, (appdata_s *)user_data);
        }
 }
index 63dd85e..0609e1b 100644 (file)
@@ -2,10 +2,10 @@ SET(FIDO_SHELL_TC fido-shell-tc)
 
 INCLUDE(FindPkgConfig)
 pkg_check_modules(FIDO_SHELL_TC_PKGS REQUIRED
-                dlog
-                glib-2.0
-                gio-unix-2.0
-                capi-base-common
+                               dlog
+                               glib-2.0
+                               gio-unix-2.0
+                               capi-base-common
 )
 
 FOREACH(flag ${FIDO_SHELL_TC_PKGS_CFLAGS})
index 72088dd..a30e46f 100644 (file)
@@ -18,7 +18,7 @@ __get_error_code(fido_error_e error_code)
 
        char *error_str = calloc(1, 128);
 
-       if(error_code == FIDO_ERROR_NONE)
+       if (error_code == FIDO_ERROR_NONE)
                strcpy(error_str, "SUCCESS");
        else if (error_code == FIDO_ERROR_OUT_OF_MEMORY)
                strcpy(error_str, "FIDO_ERROR_OUT_OF_MEMORY");
@@ -68,8 +68,7 @@ __process_cb(fido_error_e tizen_error_code, const char *uaf_response, void *user
 
                printf("%s\n", uaf_response);
                free(display_str);
-       }
-       else {
+       } else {
                __show_error(tizen_error_code);
        }
        get_user_choice();
@@ -83,7 +82,7 @@ void fido_attestation_type_cb_list(fido_auth_attestation_type_e att_type, void *
        char *str = (char *) user_data;
 
        char tmp[STRING_SIZE_1024] = {0,};
-       if(att_type != -1) {
+       if (att_type != -1) {
                snprintf(tmp, STRING_SIZE_1024 - 1, " | Attestation Type = [%d]", att_type);
                strncat(str, tmp, STRING_SIZE_1024 - 1);
        }
@@ -99,7 +98,7 @@ __get_authinfo_string(const fido_authenticator_h auth)
 
        char *title =  NULL;
        fido_authenticator_get_title(auth, &title);
-       if(title) {
+       if (title) {
                snprintf(tmp, STRING_SIZE_1024 - 1, " | Title = [%s]", title);
                strncat(str, tmp, STRING_SIZE_1024 - 1);
        }
@@ -107,7 +106,7 @@ __get_authinfo_string(const fido_authenticator_h auth)
 
        char *aaid = NULL;
        fido_authenticator_get_aaid(auth, &aaid);
-       if(aaid) {
+       if (aaid) {
                snprintf(tmp, STRING_SIZE_1024 - 1, " | AAID = [%s]", aaid);
                strncat(str, tmp, STRING_SIZE_1024 - 1);
        }
@@ -115,7 +114,7 @@ __get_authinfo_string(const fido_authenticator_h auth)
 
        char *description = NULL;
        fido_authenticator_get_description(auth, &description);
-       if(description) {
+       if (description) {
                snprintf(tmp, STRING_SIZE_1024 - 1, " | Description = [%s]", description);
                strncat(str, tmp, STRING_SIZE_1024 - 1);
        }
@@ -123,7 +122,7 @@ __get_authinfo_string(const fido_authenticator_h auth)
 
        char *scheme = NULL;
        fido_authenticator_get_assertion_scheme(auth, &scheme);
-       if(scheme) {
+       if (scheme) {
                snprintf(tmp, STRING_SIZE_1024 - 1, " | Scheme = [%s]", scheme);
                strncat(str, tmp, STRING_SIZE_1024 - 1);
        }
@@ -133,49 +132,49 @@ __get_authinfo_string(const fido_authenticator_h auth)
 
        fido_auth_algo_e get_algo = -1;
        fido_authenticator_get_algorithm(auth, &get_algo);
-       if(get_algo != -1) {
+       if (get_algo != -1) {
                snprintf(tmp, STRING_SIZE_1024 - 1, " | Algo = [%d]", get_algo);
                strncat(str, tmp, STRING_SIZE_1024 - 1);
        }
 
        fido_auth_user_verify_type_e user_ver = -1;
        fido_authenticator_get_verification_method(auth, &user_ver);
-       if(user_ver != -1) {
+       if (user_ver != -1) {
                snprintf(tmp, STRING_SIZE_1024 - 1, " | Verification = [%d]", user_ver);
                strncat(str, tmp, STRING_SIZE_1024 - 1);
        }
 
        fido_auth_key_protection_type_e key_protection = -1;
        fido_authenticator_get_key_protection_method(auth, &key_protection);
-       if(key_protection != -1) {
+       if (key_protection != -1) {
                snprintf(tmp, STRING_SIZE_1024 - 1, " | Key Protection = [%d]", key_protection);
                strncat(str, tmp, STRING_SIZE_1024 - 1);
        }
 
        fido_auth_matcher_protection_type_e matcher_protection = -1;
        fido_authenticator_get_matcher_protection_method(auth, &matcher_protection);
-       if(matcher_protection != -1) {
+       if (matcher_protection != -1) {
                snprintf(tmp, STRING_SIZE_1024 - 1, " | Matcher Protection = [%d]", matcher_protection);
                strncat(str, tmp, STRING_SIZE_1024 - 1);
        }
 
        fido_auth_attachment_hint_e attachment_hint = -1;
        fido_authenticator_get_attachment_hint(auth, &attachment_hint);
-       if(attachment_hint != -1) {
+       if (attachment_hint != -1) {
                snprintf(tmp, STRING_SIZE_1024 - 1, " | Attachment Hint = [%d]", attachment_hint);
                strncat(str, tmp, STRING_SIZE_1024 - 1);
        }
 
        fido_auth_tc_display_type_e tc_discplay = -1;
        fido_authenticator_get_tc_discplay(auth, &tc_discplay);
-       if(tc_discplay != -1) {
+       if (tc_discplay != -1) {
                snprintf(tmp, STRING_SIZE_1024 - 1, " | Tc Display = [%d]", tc_discplay);
                strncat(str, tmp, STRING_SIZE_1024 - 1);
        }
 
        char *tc_display_type = NULL;
        fido_authenticator_get_tc_display_type(auth, &tc_display_type);
-       if(tc_display_type) {
+       if (tc_display_type) {
                snprintf(tmp, STRING_SIZE_1024 - 1, " | Tc Display Type = [%s]", tc_display_type);
                strncat(str, tmp, STRING_SIZE_1024 - 1);
        }
@@ -183,7 +182,7 @@ __get_authinfo_string(const fido_authenticator_h auth)
 
        char *icon = NULL;
        fido_authenticator_get_icon(auth, &icon);
-       if(icon) {
+       if (icon) {
                snprintf(tmp, STRING_SIZE_1024 - 1, " | Icon = [%s]", icon);
                strncat(str, tmp, STRING_SIZE_1024 - 1);
        }
@@ -224,13 +223,11 @@ check_supported(void)
                printf("Check policy resonse: %s\n", error_string);
                fflush(stdout);
                free(error_string);
-       }
-       else {
+       } else {
                if (is_supported == true) {
                        printf("Check policy resonse: TRUE\n");
                        fflush(stdout);
-               }
-               else {
+               } else {
                        printf("Check policy resonse: FALSE\n");
                        fflush(stdout);
                }
@@ -255,8 +252,7 @@ _process_cb(fido_error_e tizen_error_code, const char *uaf_response, void *user_
                fflush(stdout);
                printf("UAF Response =%s\n", uaf_response);
                fflush(stdout);
-       }
-       else {
+       } else {
                __show_error(tizen_error_code);
        }
        get_user_choice();
@@ -309,8 +305,7 @@ _process_cb_for_notify_pos(fido_error_e tizen_error_code, const char *uaf_respon
                printf("%s\n", str);
                fflush(stdout);
                free(str);
-       }
-       else {
+       } else {
                __show_error(tizen_error_code);
        }
        get_user_choice();
@@ -337,15 +332,13 @@ _process_cb_for_notify_neg(fido_error_e tizen_error_code, const char *uaf_respon
                int ret = fido_uaf_set_server_result(0, uaf_response);
                if (ret == FIDO_ERROR_NONE) {
                        printf("SUCCESS\n");
-               }
-               else {
+               } else {
                        char *str = __get_error_code(ret);
                        printf("Error Code = %s\n", str);
                        free(str);
                }
-               fflush(stdout);         
-       }
-       else {
+               fflush(stdout);
+       } else {
                __show_error(tizen_error_code);
        }
        get_user_choice();
index add632c..e306b6f 100644 (file)
 
 #ifdef ROOTSTRAP_OUT
 
-#define LOGD(...)                                 \
-do                                                \
-{                                                 \
-    printf("<%s:%d>", __FUNCTION__, __LINE__);    \
-    printf(TEXT_CYAN);                            \
-    printf(__VA_ARGS__);                          \
-    printf(TEXT_RESET "\n");                      \
-} while(0)
-
-#define LOGI(...)                                 \
-do                                                \
-{                                                 \
-    printf("<%s:%d>", __FUNCTION__, __LINE__);    \
-    printf(TEXT_GREEN);                           \
-    printf(__VA_ARGS__);                          \
-    printf(TEXT_RESET "\n");                      \
-} while(0)
-
-#define LOGW(...)                                 \
-do                                                \
-{                                                 \
-    printf("<%s:%d>", __FUNCTION__, __LINE__);    \
-    printf(TEXT_YELLOW);                          \
-    printf(__VA_ARGS__);                          \
-    printf(TEXT_RESET "\n");                      \
-} while(0)
-
-#define LOGE(...)                                 \
-do                                                \
-{                                                 \
-    printf("<%s:%d>", __FUNCTION__, __LINE__);    \
-    printf(TEXT_RED);                             \
-    printf(__VA_ARGS__);                          \
-    printf(TEXT_RESET "\n");                      \
-} while(0)
+#define LOGD(...)                                     \
+do {                                                  \
+       printf("<%s:%d>", __FUNCTION__, __LINE__);    \
+       printf(TEXT_CYAN);                            \
+       printf(__VA_ARGS__);                          \
+       printf(TEXT_RESET "\n");                      \
+} while (0)
+
+#define LOGI(...)                                     \
+do {                                                  \
+       printf("<%s:%d>", __FUNCTION__, __LINE__);    \
+       printf(TEXT_GREEN);                           \
+       printf(__VA_ARGS__);                          \
+       printf(TEXT_RESET "\n");                      \
+} while (0)
+
+#define LOGW(...)                                     \
+do {                                                  \
+       printf("<%s:%d>", __FUNCTION__, __LINE__);    \
+       printf(TEXT_YELLOW);                          \
+       printf(__VA_ARGS__);                          \
+       printf(TEXT_RESET "\n");                      \
+} while (0)
+
+#define LOGE(...)                                     \
+do {                                                  \
+       printf("<%s:%d>", __FUNCTION__, __LINE__);    \
+       printf(TEXT_RED);                             \
+       printf(__VA_ARGS__);                          \
+       printf(TEXT_RESET "\n");                      \
+} while (0)
 
 #endif
 
 
-typedef enum
-{
-    FAIL_OR_SUCCESSS,
-    FAIL_OR_DONE
+typedef enum {
+       FAIL_OR_SUCCESSS,
+       FAIL_OR_DONE
 } notification_type_e;
 
 /**
@@ -69,8 +64,8 @@ typedef enum
  * @param [in] action_return_value   Return value of action
  */
 void print_fail_result(
-        const char *action_name,
-        int action_return_value);
+       const char *action_name,
+       int action_return_value);
 
 /**
  * @brief Prints success result of action.
@@ -97,9 +92,9 @@ void print_success_result(const char *action_name);
  * @param [in] notification_type_e   Type of notification
  */
 void print_action_result(
-        const char *action_name,
-        int action_return_value,
-        notification_type_e notification_type_e);
+       const char *action_name,
+       int action_return_value,
+       notification_type_e notification_type_e);
 
 /**
  * @brief Gets srting from console.
@@ -172,9 +167,9 @@ bool show_confirm_dialog(const char *title);
  *         otherwise a negative error value
  */
 int show_menu(
-        const char *title,
-        const int *options,
-        const char **names,
-        int number_of_option);
+       const char *title,
+       const int *options,
+       const char **names,
+       int number_of_option);
 
 #endif /* __FIDO_SHELL_TC_UTIL_H_ */