Languages

Menu
Sites
Language
Shared Libraries ckmc_get_data error
1. call source
  //call.h
    char*           (*get_f)(char*, char*);  

  //call.c
   lib_handle = dlopen("lib_so.so", RTLD_NOW);
   get_f      = dlsym(lib_handle, "get_v");

   const char *value  = NULL;
   char *str_air  = "air";
   char *str_key = "key";
   value             = get_f(str_air, str_key);

2. shared library
  //shared_lib.h
  EXPORT_API char *get_v(char *str_air, char *str_key);

  //shared_lib.c
  char *get_v(char *str_air, char *str_key)
  {
        int ret = CKMC_ERROR_NONE;
    char *str;
 //str = calloc(1, sizeof(char) * 251);
 //strcpy(str, str_air);
 //strcat(str, str_key);
 char  str[251] = {'\0'};
 eina_strlcpy(str, str_air, strlen(str_air)+1);
 eina_strlcat(str, str_key, strlen(str_air)+strlen(str_key)+1);

 char* alias        = str;
 char* key_password = NULL;
 char* error_c      = NULL; 
 ckmc_raw_buffer_s *_data;
 ret = ckmc_get_data(alias, key_password, &_data);  //-31522804
 if (CKMC_ERROR_NONE != ret)
 {
             switch (ret) {
  case CKMC_ERROR_INVALID_PARAMETER  : snprintf(error_c, DISP_STR_SIZE, "%s", "error : 1"); return error_c;
  case CKMC_ERROR_DB_LOCKED          : snprintf(error_c, DISP_STR_SIZE, "%s", "error : 2"); return error_c;
  case CKMC_ERROR_DB_ALIAS_EXISTS    : snprintf(error_c, DISP_STR_SIZE, "%s", "error : 3"); return error_c;
  case CKMC_ERROR_INVALID_FORMAT     : snprintf(error_c, DISP_STR_SIZE, "%s", "error : 4"); return error_c;
  case CKMC_ERROR_DB_ERROR           : snprintf(error_c, DISP_STR_SIZE, "%s", "error : 5"); return error_c;
  case CKMC_ERROR_PERMISSION_DENIED  : snprintf(error_c, DISP_STR_SIZE, "%s", "error : 5"); return error_c;
                default : snprintf(error_c, DISP_STR_SIZE, "error code : %d", ret); return error_c;  // => -31522804 Returned
 }

 char *ret_str;
 ret_str = calloc(1, sizeof(char) * DISP_STR_SIZE);

 eina_strlcpy(ret_str, magic_data->data, magic_data->size+1);

 ckmc_buffer_free(magic_data);


 return ret_str;
  }

~ret = ckmc_get_data (alias, key_password, & _data); //   -31522804
   - The return value is the value does not get inflated the value of returns as -31522804.
   - The general non-shared library code gets the normal value.

What do you have problems?

Responses

2 Replies
pius lee

You can get string error message with get_error_message() in tizen.h.

-31522804 means "No data for given alias"

ckmc_get_data() return saved data that stored with ckmc_save_data().

in your code, can't look ckmc_save_data.

Sameer Prakash Pradhan

ret = ckmc_get_data(name, NULL, &ckmc_raw_buffer);
        if (ret != CKMC_ERROR_NONE) {
                _SE("ckmc_get_data failed [%x]", ret);
               return NULL;
         }

Its returning an error sometime with the below message:

"ckmc_get_data failed [fe1f00c]"

So fe1f00c belongs to which error category among the below:

 

CKMC_ERROR_NONE Successful
CKMC_ERROR_INVALID_PARAMETER Input parameter is invalid
CKMC_ERROR_DB_LOCKED A user key is not loaded in memory (a user is not logged in)
CKMC_ERROR_DB_ERROR Failed due to the error with unknown reason
CKMC_ERROR_DB_ALIAS_UNKNOWN Alias does not exist
CKMC_ERROR_PERMISSION_DENIED Failed to access key manager
CKMC_ERROR_AUTHENTICATION_FAILED Decryption failed because password is incorrect.