#include "ITs-fido-client-common.h"
//& set: FidoClient
-fido_authenticator_h g_hauth;
bool g_bCheckCb = false;
+bool g_bAttestationCb = false;
+bool g_bAuthHandle = false;
bool g_bmsgCheckCb = false;
static char *g_pjson_reg = "[ { \"header\": { \"upv\": { \"major\": 1, \"minor\": 0 },\"op\":\"Reg\", \"serverData\": \"nwV8EPqS5raZdAgH3GD9Z-ytCA9MkiiWaCsr1GHHNJ2yUh3HaV1HHxd4Z67FefJOD5sQYZvipfg5BavhdWPMecD2SH39aJixoXN9ZaNwRlcftJe9WbtPNDC9q5V9WX7Z5jCwkAwehcI\" }, \"challenge\": \"9pIcUwwrY5eD9o3OwfhkeHLnoIl0vaeJUbxSHMe_XgE\", \"username\":\"ryan\", \"policy\": { \"accepted\": [ [ { \"aaid\": [ \"0001#8001\" ] } ], [ { \"aaid\": [ \"53EC#3101\" ] } ] ] } } ]";
#define JSON_INVALID_STRING "\{\"improperjson\": []}"
GET_TC_TYPE g_eGet_TC_Type = TITLE;
+
+/**
+* @function fido_client_attestation_type_cb_p
+* @description Callback Function
+* @parameter void *fido_auth_attestation_type_e, void *user_data
+* @return NA
+*/
+void fido_client_attestation_type_cb_p(fido_auth_attestation_type_e att_type, void *user_data)
+{
+ char *pszAtt = (char *) user_data;
+
+ FPRINTF("[Line : %d][%s] reached inside fido_client_attestation_type_cb_p callback\\n", __LINE__, API_NAMESPACE);
+ if ( strcmp(pszAtt,"DISCOVER RESPONSE") != 0 )
+ {
+ FPRINTF("[Line : %d][%s] value mismatch \\n", __LINE__, API_NAMESPACE);
+ if ( g_pMainLoop )
+ {
+ g_main_loop_quit(g_pMainLoop);
+ }
+ return;
+ }
+ g_bAttestationCb = true;
+ if ( g_pMainLoop )
+ {
+ g_main_loop_quit(g_pMainLoop);
+ }
+}
+
/**
* @function fido_client_auth_list_cb_p
* @description Callback Functionchar *pszTitle = NULL;
char *pszAaid = NULL;
char *pszDescription = NULL;
char *pszScheme = NULL;
- fido_auth_algo_e get_algo = -1;
+ fido_auth_algo_e get_algo = -1;
fido_auth_user_verify_type_e user_ver = -1;
fido_auth_key_protection_type_e key_protection = -1;
fido_auth_attachment_hint_e attachment_hint = -1;
fido_auth_tc_display_type_e tc_discplay = -1;
char *pszIcon = NULL;
fido_auth_matcher_protection_type_e matcher_protection = -1;
-
+
+ const char *pszAttStr = "DISCOVER RESPONSE";
+
if ( auth == NULL )
{
FPRINTF("[Line : %d][%s] Callback fido_client_auth_list_cb invoked auth == NULL \\n", __LINE__, API_NAMESPACE);
+ g_bAuthHandle = false;
return;
}
- g_hauth = auth;
+ g_bAuthHandle = true;
+
g_bCheckCb = true;
+ g_bAttestationCb = false;
+
FPRINTF("[Line : %d][%s] reached fido_client_auth_list_cb callback\\n", __LINE__, API_NAMESPACE);
//check result
stArr_Key_Value[i].bResult = true;
}
break;
+ case ATTESTATION:
+
+ nRet = fido_authenticator_foreach_attestation_type(auth, fido_client_attestation_type_cb_p, pszAttStr);
+ if(nRet != FIDO_ERROR_NONE)
+ {
+ FPRINTF("[Line : %d][%s] fido_authenticator_foreach_attestation_type API calls return error code = %s , \\n", __LINE__, API_NAMESPACE, FidoClientGetError(nRet));
+ }
+
+ else if(!g_bAttestationCb)
+ {
+ FPRINTF("[Line : %d][%s] fido_client_attestation_type_cb_p - Callback not invoked \\n", __LINE__, API_NAMESPACE);
+ }
+ else
+ {
+ FPRINTF("[Line : %d][%s] fido_authenticator_foreach_attestation_type API is Passed \\n", __LINE__, API_NAMESPACE);
+ stArr_Key_Value[i].bResult = true;
+ }
+ break;
default:
break;
}
}
g_bCheckCb = false;
- g_bFidoClientCreation = true;
+ g_bFidoClientCreation = true;
FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_fido_client_startup\\n", __LINE__, API_NAMESPACE);
// Launch fido-asm service daemon in advance
* @apicovered fido_foreach_authenticator
* @passcase When fido_foreach_authenticator is successful.
* @failcase If target API bfido_foreach_authenticator fails
-* @precondition
-* @postcondition
+* @precondition
+* @postcondition
*/
int ITc_fido_foreach_authenticator_p(void)
{
START_TEST;
g_eGet_TC_Type = MAX_ENUM;
g_bCheckCb = false;
+ g_bAuthHandle = false;
int nRet = fido_foreach_authenticator(fido_client_auth_list_cb_p, NULL);
- PRINT_RESULT(FIDO_ERROR_NONE, nRet, "fido_foreach_authenticator", FidoClientGetError(nRet));
- if(g_hauth == NULL)
+ PRINT_RESULT(FIDO_ERROR_NONE, nRet, "fido_foreach_authenticator", FidoClientGetError(nRet));
+
+ if(!g_bCheckCb)
{
- FPRINTF("[Line : %d][%s] g_hauth is null \\n", __LINE__, API_NAMESPACE);
-
+ FPRINTF("[Line : %d][%s] Callback function not invoked in fido_foreach_authenticator \\n", __LINE__, API_NAMESPACE);
return 1;
}
- else if(!g_bCheckCb)
+
+ if(!g_bAuthHandle)
{
- FPRINTF("[Line : %d][%s] Callback function not invoked in fido_foreach_authenticator \\n", __LINE__, API_NAMESPACE);
+ FPRINTF("[Line : %d][%s] auth hanlde recieved in fido_client_auth_list_cb_p as NULL \\n", __LINE__, API_NAMESPACE);
return 1;
}
return 0;
return 0;
}
-/**
-* @function fido_client_attestation_type_cb_p
-* @description Callback Function
-* @parameter void *fido_auth_attestation_type_e, void *user_data
-* @return NA
-*/
-void fido_client_attestation_type_cb_p(fido_auth_attestation_type_e att_type, void *user_data)
-{
- char *pszStr = (char *) user_data;
-
- if ( strcmp(pszStr,"DISCOVER RESPONSE") != 0 )
- {
- FPRINTF("[Line : %d][%s] value mismatch \\n", __LINE__, API_NAMESPACE);
- return;
- }
- FPRINTF("[Line : %d][%s] reached fido_client_attestation_type_cb_p callback\\n", __LINE__, API_NAMESPACE);
-
- g_bCheckCb = true;
- if ( g_pMainLoop )
- {
- g_main_loop_quit(g_pMainLoop);
- }
-}
-//& purpose: Get the attestation_type for Authenticator
+//& purpose: Get the attestation_type for Authenticator
//& type: auto
/**
* @testcase ITc_fido_authenticator_foreach_attestation_type_p
* @author SRID(shilpa.j)
* @reviewer SRID(parshant.v)
* @type auto
-* @description Get the attestation_type for Authenticator
-* @scenario Get the attestation_type for Authenticator
-* @apicovered fido_authenticator_foreach_attestation_type
+* @description Get the attestation_type for Authenticator
+* @scenario Get the attestation_type for Authenticator
+* @apicovered fido_authenticator_foreach_attestation_type
* @passcase When fido_authenticator_foreach_attestation_type is successful.
* @failcase If target API bundle_encode or bundle_decode fails or any precondition and postcondition API fails
* @precondition Authenticator Handle must be created
* @postcondition Authenticator Handle must be released
*/
+
int ITc_fido_authenticator_foreach_attestation_type_p(void)
{
START_TEST;
- g_eGet_TC_Type = MAX_ENUM;
+ g_eGet_TC_Type = ATTESTATION;
g_bCheckCb = false;
+ g_bAttestationCb = false;
+
int nRet = fido_foreach_authenticator(fido_client_auth_list_cb_p, NULL);
- PRINT_RESULT(FIDO_ERROR_NONE, nRet, "fido_foreach_authenticator", FidoClientGetError(nRet));
+ PRINT_RESULT(FIDO_ERROR_NONE, nRet, "fido_foreach_authenticator", FidoClientGetError(nRet));
if(!g_bCheckCb)
{
FPRINTF("[Line : %d][%s] Callback function not invoked in fido_foreach_authenticator \\n", __LINE__, API_NAMESPACE);
return 1;
}
-
- char str[5000] = {0,};
- str[0] = '\0';
- strcpy(str, "DISCOVER RESPONSE");
- g_bCheckCb = false;
- nRet = fido_authenticator_foreach_attestation_type(g_hauth, fido_client_attestation_type_cb_p, str);
- PRINT_RESULT(FIDO_ERROR_NONE, nRet, "fido_authenticator_foreach_attestation_type", FidoClientGetError(nRet));
- if(!g_bCheckCb)
+ if(!g_bAttestationCb)
+ {
+ FPRINTF("[Line : %d][%s] fido_client_attestation_type_cb_p - Callback function not invoked \\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ int nIndex = (int)g_eGet_TC_Type;
+ if(stArr_Key_Value[nIndex].bResult == false)
{
- FPRINTF("[Line : %d][%s] fido_authenticator_foreach_attestation_type -Callback function not invoked \\n", __LINE__, API_NAMESPACE);
return 1;
}
+
return 0;
}