if (is_success == FALSE) {
_ERR("fido_call_fido_uaf_notify_result_sync failed [%d]", tizen_error_code);
- if (dbus_err) {
+ if (dbus_err)
_ERR("GError = [%s]", dbus_err->message);
- }
+
return FIDO_ERROR_PROTOCOL_ERROR;
}
*outlen = bptr->length;
int i;
- for (i =0; i < *outlen ; i++) {
+ for (i = 0; i < *outlen ; i++) {
if (output[i] == '+')
output[i] = '-';
return TRUE;
- CATCH:
+CATCH:
if (generator != NULL && *generator != NULL) {
g_object_unref(*generator);
*generator = NULL;
return TRUE;
- CATCH:
+CATCH:
if (generator != NULL && *generator != NULL) {
g_object_unref(*generator);
*generator = NULL;
return TRUE;
- CATCH:
- if ((node !=NULL) && (*node != NULL)) {
+CATCH:
+ if ((node != NULL) && (*node != NULL)) {
json_node_free(*node);
*node = NULL;
}
return TRUE;
- CATCH:
+CATCH:
if (node != NULL && *node != NULL) {
json_node_free(*node);
*node = NULL;
if (auth_in->key_ids) {
JsonArray *ids = json_array_new();
- for (iter = auth_in->key_ids; iter != NULL; iter = g_list_next(iter)) {
- json_array_add_string_element(ids, (char *)iter->data);
- }
+ for (iter = auth_in->key_ids; iter != NULL; iter = g_list_next(iter))
+ json_array_add_string_element(ids, (char *)iter->data);
json_object_set_array_member(obj, _JSON_KEY_KEY_IDS, ids);
}
return TRUE;
- CATCH:
+CATCH:
if (*node != NULL) {
json_node_free(*node);
*node = NULL;
_match_criteria_t *match_criteria = (_match_criteria_t*)calloc(1, sizeof(_match_criteria_t));
JsonArray *aaid_arr = json_object_get_array_member(match_obj, _JSON_KEY_AAID);
- if (aaid_arr != NULL) {
+ if (aaid_arr != NULL)
match_criteria->aaid_list = __get_string_list_from_json_array(aaid_arr);
- }
JsonArray *vendor_arr = json_object_get_array_member(match_obj, _JSON_KEY_VENDOR_ID);
- if (vendor_arr != NULL) {
+ if (vendor_arr != NULL)
match_criteria->vendor_list = __get_string_list_from_json_array(vendor_arr);
- }
JsonArray *key_id_arr = json_object_get_array_member(match_obj, _JSON_KEY_KEY_IDS);
- if (key_id_arr != NULL) {
+ if (key_id_arr != NULL)
match_criteria->key_id_list = __get_string_list_from_json_array(key_id_arr);
- }
match_criteria->user_verification = __get_int_from_json_object(match_obj, _JSON_KEY_USER_VERIFICATION);
}
JsonArray *assertion_schm_arr = json_object_get_array_member(match_obj, _JSON_KEY_ASSERT_SCHEMES);
- if (assertion_schm_arr) {
+ if (assertion_schm_arr)
match_criteria->assertion_scheme_list = __get_string_list_from_json_array(assertion_schm_arr);
- }
JsonArray *att_type_arr = json_object_get_array_member(match_obj, _JSON_KEY_ATT_TYPES);
- if (att_type_arr) {
+ if (att_type_arr)
match_criteria->attestation_type_list = __get_string_list_from_json_array(att_type_arr);
- }
match_criteria->auth_version = __get_int_from_json_object(match_obj, _JSON_KEY_AUTH_VERSION);
_INFO("ASM Response = %s", asm_resp->asm_response_json);
}
- if (asm_resp->error_code == FIDO_ERROR_NONE
+ if ((asm_resp->error_code == FIDO_ERROR_NONE)
&&
- asm_resp->asm_response_json != NULL) {
+ (asm_resp->asm_response_json != NULL)) {
JsonParser *parser = json_parser_new();
CATCH_IF_FAIL(parser != NULL);
return 0;
- CATCH:
+CATCH:
if (generator != NULL) {
g_object_unref(generator);
generator = NULL;
GError *chb_err = NULL;
bool chb_parsed = json_parser_load_from_data(chb_parser, ch_bin, -1, &chb_err);
- if (chb_parsed == FALSE) {
+ if (chb_parsed == FALSE)
return NULL;
- }
JsonNode *chb_root = json_parser_get_root(chb_parser);
RET_IF_FAIL(chb_root != NULL, NULL);
GError *chb_err = NULL;
bool chb_parsed = json_parser_load_from_data(chb_parser, ch_bin, -1, &chb_err);
- if (chb_parsed == FALSE) {
+ if (chb_parsed == FALSE)
return NULL;
- }
JsonNode *chb_root = json_parser_get_root(chb_parser);
- if (chb_root == NULL) {
+ if (chb_root == NULL)
return NULL;
- }
JsonObject *chb_root_obj = json_node_get_object(chb_root);
- if (chb_root_obj == NULL) {
+ if (chb_root_obj == NULL)
return NULL;
- }
char *end_pt = (char*)json_object_get_string_member(chb_root_obj, _JSON_KEY_SERVER_END_POINT);
char *cert = (char*)json_object_get_string_member(chb_root_obj, _JSON_KEY_TLS_SERVER_CERT);
/*tcDisplayPNGCharacteristics*/
JsonObject *tc_disp_obj = json_object_get_object_member(tr_obj, _JSON_KEY_TC_DISP_PNG_CHARS);
- if (tc_disp_obj != NULL) {
+ if (tc_disp_obj != NULL)
trans->display_charac = __get_png_data(tr_obj);
- }
trans_list = g_list_append(trans_list, trans);
}
_dereg_request_t *dereg_req_temp = (_dereg_request_t *)calloc(1, sizeof(_dereg_request_t));
JsonArray *auth_arr = json_object_get_array_member(uaf_object, _JSON_KEY_AUTHENTICATORS_SMALL);
- if (auth_arr != NULL) {
+ if (auth_arr != NULL)
json_array_foreach_element(auth_arr, __dereg_auth_parser, dereg_req_temp);
- }
return dereg_req_temp;
}
int idx = 0;
for (; idx < id_arr_len; idx++) {
const char *id = json_array_get_string_element(id_arr, idx);
- if (id != NULL) {
+ if (id != NULL)
app_id_list = g_list_append(app_id_list, strdup(id));
- }
}
}
}
json_array_foreach_element(auth_data_arr, _auth_arr_cb, NULL);
- CATCH:
+CATCH:
if (parser != NULL) {
g_object_unref(parser);
parser = NULL;
if (parse_err != NULL) {
g_error_free(parse_err);
parse_err = NULL;
- }
+ }
SAFE_DELETE(ui_auth);
ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]);
ret = ui_app_main(argc, argv, &event_callback, &ad);
- if (ret != APP_ERROR_NONE) {
+ if (ret != APP_ERROR_NONE)
_INFO("app_main() is failed. err = %d", ret);
- }
return ret;
}
memcpy(output, bptr->data, bptr->length);
output[bptr->length] = 0;
- if(b64)
+ if (b64)
BIO_free_all(b64);
return (char*)output;
ret = EVP_Digest(der_pubkey, der_len, pubkey_der_digest, (unsigned int*)&hashed_len, EVP_sha256(), NULL);
- if (ret != 1 ) {
+ if (ret != 1) {
_ERR("EVP_Digest failed");
OPENSSL_free(der_pubkey);
_INFO("");
-CATCH :
-
+CATCH:
_INFO("Before return");
pkgmgrinfo_pkginfo_destroy_certinfo(cert_handle);
_INFO("_verify_and_get_facet_id");
char *app_id = __get_appid_of_dbus_caller(invocation);
- if (app_id == NULL) {
+ 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 _ui_q;
_ui_q = g_queue_new();
- if (_ui_q == NULL) {
+ if (_ui_q == NULL)
_ERR("Out of memory");
- }
return _ui_q;
}
if (asm_response_list == NULL)
_ERR("Discover response failed");
- else {
+ else
asm_auth_list = _uaf_parser_parse_asm_response_discover(asm_response_list, &error);
- }
(cb_data->cb)(error, 0, asm_auth_list, cb_data->user_data);
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) && g_list_length(allowed_auth_list) > 0) {
-
+ 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);
available_authenticators_full);
g_list_free_full(available_authenticators_full, _free_asm_auth_list);
- if ((matched_auth_list != NULL) && g_list_length(matched_auth_list) > 0) {
-
+ 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);
- }
if (matched_auth_list != NULL)
g_list_free_full(matched_auth_list, __free_matched_dereg_auth_data_list_item);
error_code = _handle_process_message(cb_data);
- if (error_code != FIDO_ERROR_NONE) {
+ if (error_code != FIDO_ERROR_NONE)
_send_process_response(cb_data, error_code, NULL);
- }
}
gboolean
}
gboolean
-_dbus_handle_process_or_check_policy(Fido *object, GDBusMethodInvocation *invocation,
+_dbus_handle_process_or_check_policy(Fido *object, GDBusMethodInvocation *invocation,
const gchar *uaf_request_json, const gchar *channel_binding,
_process_type_t type)
{
return;
}
-char *get_error_code(fido_error_e error_code)
+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");
char *title = NULL;
fido_authenticator_get_title(auth, &title);
- if(title) {
+ if (title != NULL) {
sprintf(tmp, " | Title = [%s]", title);
strcat(str, tmp);
}
char *aaid = NULL;
fido_authenticator_get_aaid(auth, &aaid);
- if(aaid) {
+ if (aaid != NULL) {
sprintf(tmp, " | AAID = [%s]", aaid);
strcat(str, tmp);
}
char *description = NULL;
fido_authenticator_get_description(auth, &description);
- if(description) {
+ if (description != NULL) {
sprintf(tmp, " | Description = [%s]", description);
strcat(str, tmp);
}
char *scheme = NULL;
fido_authenticator_get_assertion_scheme(auth, &scheme);
- if(scheme) {
+ if (scheme != NULL) {
sprintf(tmp, " | Scheme = [%s]", scheme);
strcat(str, tmp);
}
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_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 != NULL) {
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 != NULL) {
sprintf(tmp, " | Icon = [%s]", icon);
strcat(str, tmp);
}
sprintf(str, "[%s]", error_string);
create_popup(str, (appdata_s *) data);
free(error_string);
- }
- else {
+ } else {
if (is_supported == true)
sprintf(str, "TRUE");
else
static void
_process_cb(fido_error_e tizen_error_code, const char *uaf_response, void *user_data)
{
- dlog_print(DLOG_INFO, "org.tizen.Fidosample", "process response = [%d]", tizen_error_code);
+ dlog_print(DLOG_INFO, "org.tizen.Fidosample", "process response = [%d]", tizen_error_code);
if (tizen_error_code == 0 && uaf_response != NULL) {
dlog_print(DLOG_INFO, "org.tizen.Fidosample", "uaf response = %s", uaf_response);
create_popup(popup_str, (appdata_s *) user_data);
free(popup_str);
- }
- else {
+ } else {
__show_error(tizen_error_code, (appdata_s *)user_data);
}
}
dlog_print(DLOG_INFO, "org.tizen.Fidosample", "uaf response = %s", uaf_response);
int ret = fido_uaf_set_server_result(FIDO_SERVER_STATUS_CODE_OK, uaf_response);
- dlog_print(DLOG_INFO, "org.tizen.Fidosample", "fido_uaf_set_server_result =[%d]", ret);
+ dlog_print(DLOG_INFO, "org.tizen.Fidosample", "fido_uaf_set_server_result =[%d]", ret);
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);
}
}
static void
_process_cb_for_notify_neg(fido_error_e tizen_error_code, const char *uaf_response, void *user_data)
{
- dlog_print(DLOG_INFO, "org.tizen.Fidosample", "process response = [%d]", tizen_error_code);
+ dlog_print(DLOG_INFO, "org.tizen.Fidosample", "process response = [%d]", tizen_error_code);
if (tizen_error_code == 0) {
dlog_print(DLOG_INFO, "org.tizen.Fidosample", "uaf response = %s", uaf_response);
int ret = fido_uaf_set_server_result(0, uaf_response);
- dlog_print(DLOG_INFO, "org.tizen.Fidosample", "fido_uaf_set_server_result =[%d]", ret);
+ dlog_print(DLOG_INFO, "org.tizen.Fidosample", "fido_uaf_set_server_result =[%d]", ret);
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);
}
}
ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]);
ret = ui_app_main(argc, argv, &event_callback, &ad);
- if (ret != APP_ERROR_NONE) {
+ if (ret != APP_ERROR_NONE)
dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret);
- }
return ret;
}
_INFO("request type=[%s]", req_type);
- if (strcmp(req_type, "GetInfo") == 0) {
+ if (strcmp(req_type, "GetInfo") == 0)
dummyasm_complete_asm_request(object, invocation, 0, _GET_INFO_RESPONSE);
- }
- if (strcmp(req_type, "Register") == 0) {
+ if (strcmp(req_type, "Register") == 0)
dummyasm_complete_asm_request(object, invocation, 0, _REG_RESPONSE);
- }
- if (strcmp(req_type, "Authenticate") == 0) {
+ if (strcmp(req_type, "Authenticate") == 0)
dummyasm_complete_asm_request(object, invocation, 0, _AUTH_RESPONSE);
- }
- if (strcmp(req_type, "Deregister") == 0) {
+ if (strcmp(req_type, "Deregister") == 0)
dummyasm_complete_asm_request(object, invocation, 0, _DEREG_RESPONSE);
- }
- if (strcmp(req_type, "GetRegistrations") == 0) {
+ if (strcmp(req_type, "GetRegistrations") == 0)
dummyasm_complete_asm_request(object, invocation, 0, _GET_REGISTRATIONS_RESPONSE);
- }
return true;
}
GDBusInterfaceSkeleton* interface = NULL;
__dbus_obj = dummyasm_skeleton_new();
- if (__dbus_obj == NULL) {
+ 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)) {
+ 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",
ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]);
ret = ui_app_main(argc, argv, &event_callback, &ad);
- if (ret != APP_ERROR_NONE) {
+ if (ret != APP_ERROR_NONE)
dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret);
- }
return ret;
}
{
int ret = fido_foreach_authenticator(auth_list_cb, NULL);
- if (ret != FIDO_ERROR_NONE) {
+ if (ret != FIDO_ERROR_NONE)
__show_error(ret);
- }
+
get_user_choice();
}
{
int sel_opt = 0;
const int options[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
- const char *names[8] = { "Find Authenticator",
+ const char *names[8] = { "Find Authenticator",
"Check UAF Message Supported",
"Registration",
"Authentication",
action_name);
}
-void
+void
print_done_result(const char *action_name)
{
printf(TEXT_YELLOW
action_name);
}
-void
+void
print_success_result(const char *action_name)
{
printf(TEXT_GREEN
"\n", action_name);
}
-void
+void
print_action_result(
const char *action_name,
int action_return_value,
}
}
-int
+int
input_string(const char *prompt, size_t max_len, char **string)
{
printf("\n");
return strlen(*string);
}
-int
+int
input_size(const char *prompt, size_t max_size, size_t *size)
{
printf("\n");
return (*value < min_value || *value > max_value ? -1 : 0);
}
-int
+int
input_double(
const char *prompt,
double min_value,
return (*value < min_value || *value > max_value ? -1 : 0);
}
-bool
+bool
show_confirm_dialog(const char *title)
{
const int options[2] = {1, 2};
return answer;
}
-int
+int
show_menu(
const char *title,
const int *options,