#include "fido_internal_types.h"
#include "fido_uaf_authenticator.h"
#include "fido_logs.h"
+#include "fido_uaf_utils.h"
EXPORT_API int
fido_authenticator_get_title(const fido_authenticator_h auth, char **title)
{
+ RET_IF_FAIL(is_fido_supported() == FEATURE_STATE_ENABLED, FIDO_ERROR_NOT_SUPPORTED);
+
RET_IF_FAIL(auth != NULL, FIDO_ERROR_INVALID_PARAMETER);
RET_IF_FAIL(title != NULL, FIDO_ERROR_INVALID_PARAMETER);
EXPORT_API int
fido_authenticator_get_aaid(const fido_authenticator_h auth, char **aaid)
{
+ RET_IF_FAIL(is_fido_supported() == FEATURE_STATE_ENABLED,
+ FIDO_ERROR_NOT_SUPPORTED);
+
RET_IF_FAIL(auth != NULL, FIDO_ERROR_INVALID_PARAMETER);
RET_IF_FAIL(aaid != NULL, FIDO_ERROR_INVALID_PARAMETER);
EXPORT_API int
fido_authenticator_get_description(const fido_authenticator_h auth, char **desc)
{
+ RET_IF_FAIL(is_fido_supported() == FEATURE_STATE_ENABLED,
+ FIDO_ERROR_NOT_SUPPORTED);
+
RET_IF_FAIL(auth != NULL, FIDO_ERROR_INVALID_PARAMETER);
RET_IF_FAIL(desc != NULL, FIDO_ERROR_INVALID_PARAMETER);
EXPORT_API int
fido_authenticator_get_assertion_scheme(const fido_authenticator_h auth, char **scheme)
{
+ RET_IF_FAIL(is_fido_supported() == FEATURE_STATE_ENABLED,
+ FIDO_ERROR_NOT_SUPPORTED);
+
RET_IF_FAIL(auth != NULL, FIDO_ERROR_INVALID_PARAMETER);
RET_IF_FAIL(scheme != NULL, FIDO_ERROR_INVALID_PARAMETER);
EXPORT_API int
fido_authenticator_get_algorithm(const fido_authenticator_h auth, fido_auth_algo_e *algo)
{
+ RET_IF_FAIL(is_fido_supported() == FEATURE_STATE_ENABLED,
+ FIDO_ERROR_NOT_SUPPORTED);
+
RET_IF_FAIL(auth != NULL, FIDO_ERROR_INVALID_PARAMETER);
fido_authenticator_s *priv = (fido_authenticator_s*)auth;
fido_authenticator_foreach_attestation_type(const fido_authenticator_h auth, fido_attestation_type_cb cb,
void *user_data)
{
+ RET_IF_FAIL(is_fido_supported() == FEATURE_STATE_ENABLED,
+ FIDO_ERROR_NOT_SUPPORTED);
+
RET_IF_FAIL(auth != NULL, FIDO_ERROR_INVALID_PARAMETER);
fido_authenticator_s *priv = (fido_authenticator_s*)auth;
EXPORT_API int
fido_authenticator_get_verification_method(const fido_authenticator_h auth, fido_auth_user_verify_type_e *user_verification)
{
+ RET_IF_FAIL(is_fido_supported() == FEATURE_STATE_ENABLED,
+ FIDO_ERROR_NOT_SUPPORTED);
+
RET_IF_FAIL(auth != NULL, FIDO_ERROR_INVALID_PARAMETER);
fido_authenticator_s *priv = (fido_authenticator_s*)auth;
EXPORT_API int
fido_authenticator_get_key_protection_method(const fido_authenticator_h auth, fido_auth_key_protection_type_e *key_protection)
{
+ RET_IF_FAIL(is_fido_supported() == FEATURE_STATE_ENABLED,
+ FIDO_ERROR_NOT_SUPPORTED);
+
RET_IF_FAIL(auth != NULL, FIDO_ERROR_INVALID_PARAMETER);
fido_authenticator_s *priv = (fido_authenticator_s*)auth;
EXPORT_API int
fido_authenticator_get_matcher_protection_method(const fido_authenticator_h auth, fido_auth_matcher_protection_type_e *matcher_protection)
{
+ RET_IF_FAIL(is_fido_supported() == FEATURE_STATE_ENABLED,
+ FIDO_ERROR_NOT_SUPPORTED);
+
RET_IF_FAIL(auth != NULL, FIDO_ERROR_INVALID_PARAMETER);
fido_authenticator_s *priv = (fido_authenticator_s*)auth;
EXPORT_API int
fido_authenticator_get_attachment_hint(const fido_authenticator_h auth, fido_auth_attachment_hint_e *attachment_hint)
{
+ RET_IF_FAIL(is_fido_supported() == FEATURE_STATE_ENABLED,
+ FIDO_ERROR_NOT_SUPPORTED);
+
RET_IF_FAIL(auth != NULL, FIDO_ERROR_INVALID_PARAMETER);
fido_authenticator_s *priv = (fido_authenticator_s*)auth;
EXPORT_API bool
fido_authenticator_get_is_second_factor_only(const fido_authenticator_h auth)
{
+ RET_IF_FAIL(is_fido_supported() == FEATURE_STATE_ENABLED,
+ false);
+
RET_IF_FAIL(auth != NULL, false);
fido_authenticator_s *priv = (fido_authenticator_s*)auth;
EXPORT_API int
fido_authenticator_get_tc_discplay(const fido_authenticator_h auth, fido_auth_tc_display_type_e *tc_display)
{
+ RET_IF_FAIL(is_fido_supported() == FEATURE_STATE_ENABLED,
+ FIDO_ERROR_NOT_SUPPORTED);
+
RET_IF_FAIL(auth != NULL, FIDO_ERROR_INVALID_PARAMETER);
fido_authenticator_s *priv = (fido_authenticator_s*)auth;
EXPORT_API int
fido_authenticator_get_tc_display_type(const fido_authenticator_h auth, char **tc_display_content_type)
{
+ RET_IF_FAIL(is_fido_supported() == FEATURE_STATE_ENABLED,
+ FIDO_ERROR_NOT_SUPPORTED);
+
RET_IF_FAIL(auth != NULL, FIDO_ERROR_INVALID_PARAMETER);
RET_IF_FAIL(tc_display_content_type != NULL, FIDO_ERROR_INVALID_PARAMETER);
EXPORT_API int
fido_authenticator_get_icon(const fido_authenticator_h auth, char **icon)
{
+ RET_IF_FAIL(is_fido_supported() == FEATURE_STATE_ENABLED,
+ FIDO_ERROR_NOT_SUPPORTED);
+
RET_IF_FAIL(auth != NULL, FIDO_ERROR_INVALID_PARAMETER);
RET_IF_FAIL(icon != NULL, FIDO_ERROR_INVALID_PARAMETER);
#include "fido-stub.h"
#include "fido_keys.h"
#include "fido_uaf_authenticator.h"
+#include "fido_uaf_utils.h"
static Fido *_fido_dbus_obj = NULL;
}
_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");
EXPORT_API int
fido_foreach_authenticator(fido_authenticator_cb callback, void *user_data)
{
+ RET_IF_FAIL(is_fido_supported() == FEATURE_STATE_ENABLED, FIDO_ERROR_NOT_SUPPORTED);
+
if (callback == NULL) {
_ERR("callback can not be NULL [FIDO_ERROR_INVALID_PARAMETER]");
return FIDO_ERROR_INVALID_PARAMETER;
EXPORT_API int
fido_get_client_vendor(char **vendor_name)
{
+ RET_IF_FAIL(is_fido_supported() == FEATURE_STATE_ENABLED, FIDO_ERROR_NOT_SUPPORTED);
+
if (vendor_name == NULL)
return FIDO_ERROR_INVALID_PARAMETER;
EXPORT_API int
fido_get_client_version(int *client_major_version, int *client_minor_version)
{
+ RET_IF_FAIL(is_fido_supported() == FEATURE_STATE_ENABLED, FIDO_ERROR_NOT_SUPPORTED);
+
if ((client_major_version == NULL) || (client_minor_version == NULL))
return FIDO_ERROR_INVALID_PARAMETER;
EXPORT_API int
fido_uaf_is_supported(const char *uaf_message_json, bool *is_supported)
{
+ RET_IF_FAIL(is_fido_supported() == FEATURE_STATE_ENABLED, FIDO_ERROR_NOT_SUPPORTED);
+
if (uaf_message_json == NULL) {
_ERR("uaf_message_json can not be NULL [FIDO_ERROR_INVALID_PARAMETER]");
return FIDO_ERROR_INVALID_PARAMETER;
fido_uaf_get_response_message(const char *uaf_request_json, const char *channel_binding_json,
fido_uaf_response_message_cb callback, void *user_data)
{
+ RET_IF_FAIL(is_fido_supported() == FEATURE_STATE_ENABLED, FIDO_ERROR_NOT_SUPPORTED);
+
if (callback == NULL) {
_ERR("callback can not be NULL [FIDO_ERROR_INVALID_PARAMETER]");
return FIDO_ERROR_INVALID_PARAMETER;
EXPORT_API int
fido_uaf_set_server_result(int response_code, const char *uaf_response_json)
{
+ RET_IF_FAIL(is_fido_supported() == FEATURE_STATE_ENABLED, 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;
--- /dev/null
+/*
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#ifndef FIDO_UAF_UTILS_H
+#define FIDO_UAF_UTILS_H
+
+typedef enum {
+ FEATURE_STATE_INVALID = -1,
+ FEATURE_STATE_DISABLED,
+ FEATURE_STATE_ENABLED
+} feature_state;
+
+feature_state is_fido_supported(void);
+
+#endif // FIDO_UAF_UTILS_H