error names changed for tizen common error
authorDong Sun Lee <ds73.lee@samsung.com>
Thu, 24 Jul 2014 04:38:04 +0000 (13:38 +0900)
committerBartlomiej Grzelewski <b.grzelewski@samsung.com>
Fri, 12 Sep 2014 12:59:17 +0000 (14:59 +0200)
Signed-off-by: Dong Sun Lee <ds73.lee@samsung.com>
src/include/ckmc/ckmc-control.h
src/include/ckmc/ckmc-error.h
src/include/ckmc/ckmc-manager.h
src/include/ckmc/ckmc-type.h
src/manager/client-capi/ckmc-manager.cpp
src/manager/client-capi/ckmc-type.cpp

index defde47..0fed5b2 100644 (file)
@@ -51,11 +51,11 @@ extern "C" {
  * @param[in] password used in decrypting a user key.
  *
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
+ * @retval #CKMC_ERROR_NONE Successful
  * @retval #CKMC_ERROR_SERVER_ERROR failed to unlock user key
- * @retval #CKMC_ERROR_INPUT_PARAM invalid input parameter
+ * @retval #CKMC_ERROR_INVALID_PARAMETER invalid input parameter
  * @retval #CKMC_ERROR_AUTHENTICATION_FAILED not correct password
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @see ckmc_lock_user_key()
  * @see ckmc_remove_user_data()
@@ -74,9 +74,9 @@ int ckmc_unlock_user_key(uid_t user, const char *password);
  * @param[in] user a uid of a user whose key is removed from memory.
  *
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM invalid input parameter
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER invalid input parameter
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @see ckmc_unlock_user_key()
  * @see ckmc_remove_user_data()
@@ -95,9 +95,9 @@ int ckmc_lock_user_key(uid_t user);
  * @param[in] user a uid of a user whose data and key are removed
  *
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM invalid input parameter
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER invalid input parameter
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @see ckmc_unlock_user_key()
  * @see ckmc_lock_user_key()
@@ -118,11 +118,11 @@ int ckmc_remove_user_data(uid_t user);
  * @param[in] new_password used in re-encrypting a user key.
  *
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM invalid input parameter
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER invalid input parameter
  * @retval #CKMC_ERROR_AUTHENTICATION_FAILED not correct password
  * @retval #CKMC_ERROR_BAD_REQUEST no information about old password
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @see ckmc_unlock_user_key()
  * @see ckmc_lock_user_key()
@@ -142,10 +142,10 @@ int ckmc_change_user_password(uid_t user, const char *old_password, const char *
  * @param[in] new_password is used in re-encrypting a user key.
  *
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM invalid input parameter
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER invalid input parameter
  * @retval #CKMC_ERROR_BAD_REQUEST a user key is not unlocked.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
  *
index 601bc62..31a3e9d 100644 (file)
@@ -40,27 +40,27 @@ extern "C" {
  * @since_tizen 2.3
  */
 typedef enum{
-       CKMC_SUCCESS                        = TIZEN_ERROR_NONE,               /**< Successful */
-       CKMC_ERROR_INPUT_PARAM              = TIZEN_ERROR_INVALID_PARAMETER,  /**< Invalid function parameter */
+       CKMC_ERROR_NONE                     = TIZEN_ERROR_NONE,               /**< Successful */
+       CKMC_ERROR_INVALID_PARAMETER        = TIZEN_ERROR_INVALID_PARAMETER,  /**< Invalid function parameter */
        CKMC_ERROR_OUT_OF_MEMORY            = TIZEN_ERROR_OUT_OF_MEMORY,      /**< Out of memory */
-       CKMC_ERROR_ACCESS_DENIED            = TIZEN_ERROR_PERMISSION_DENIED,  /**< Permission denied */
-       CKMC_ERROR_BAD_REQUEST              = TIZEN_ERROR_INVALID_OPERATION,  /**< Invalid request from client */
+       CKMC_ERROR_PERMISSION_DENIED        = TIZEN_ERROR_PERMISSION_DENIED,  /**< Permission denied */
 
        CKMC_ERROR_SOCKET                   = KEY_MANAGER_ERROR_CLASS | 0x01, /**< Socket error between client and Central Key Manager */
-       CKMC_ERROR_BAD_RESPONSE             = KEY_MANAGER_ERROR_CLASS | 0x02, /**< Invalid response from Central Key Manager */
-       CKMC_ERROR_SEND_FAILED              = KEY_MANAGER_ERROR_CLASS | 0x03, /**< Transmitting request failed */
-       CKMC_ERROR_RECV_FAILED              = KEY_MANAGER_ERROR_CLASS | 0x04, /**< Receiving response failed */
-       CKMC_ERROR_AUTHENTICATION_FAILED    = KEY_MANAGER_ERROR_CLASS | 0x05, /**< Authentication between client and manager failed */
-       CKMC_ERROR_BUFFER_TOO_SMALL         = KEY_MANAGER_ERROR_CLASS | 0x06, /**< The output buffer size which is passed as parameter is too small */
-       CKMC_ERROR_SERVER_ERROR             = KEY_MANAGER_ERROR_CLASS | 0x07, /**< Central Key Manager has been failed for some reason */
-       CKMC_ERROR_DB_LOCKED                = KEY_MANAGER_ERROR_CLASS | 0x08, /**< The database was not unlocked - user did not login */
-       CKMC_ERROR_DB_ERROR                 = KEY_MANAGER_ERROR_CLASS | 0x09, /**< An internal error inside the database */
-       CKMC_ERROR_DB_ALIAS_EXISTS          = KEY_MANAGER_ERROR_CLASS | 0x0A, /**< Provided alias already exists in the database */
-       CKMC_ERROR_DB_ALIAS_UNKNOWN         = KEY_MANAGER_ERROR_CLASS | 0x0B, /**< No data for given alias */
-       CKMC_ERROR_VERIFICATION_FAILED      = KEY_MANAGER_ERROR_CLASS | 0x0C, /**< CA certificate(s) were unknown and chain could not be created */
-       CKMC_ERROR_INVALID_FORMAT           = KEY_MANAGER_ERROR_CLASS | 0x11, /**< A provided file or binary has not a valid format */
-       CKMC_ERROR_FILE_ACCESS_DENIED       = KEY_MANAGER_ERROR_CLASS | 0x12, /**< A provided file or binary has not a valid format */
-       CKMC_ERROR_UNKNOWN                  = KEY_MANAGER_ERROR_CLASS | 0x13, /**< A provided file or binary has not a valid format */
+       CKMC_ERROR_BAD_REQUEST                  = KEY_MANAGER_ERROR_CLASS | 0x02,  /**< Invalid request from client */
+       CKMC_ERROR_BAD_RESPONSE             = KEY_MANAGER_ERROR_CLASS | 0x03, /**< Invalid response from Central Key Manager */
+       CKMC_ERROR_SEND_FAILED              = KEY_MANAGER_ERROR_CLASS | 0x04, /**< Transmitting request failed */
+       CKMC_ERROR_RECV_FAILED              = KEY_MANAGER_ERROR_CLASS | 0x05, /**< Receiving response failed */
+       CKMC_ERROR_AUTHENTICATION_FAILED    = KEY_MANAGER_ERROR_CLASS | 0x06, /**< Authentication between client and manager failed */
+       CKMC_ERROR_BUFFER_TOO_SMALL         = KEY_MANAGER_ERROR_CLASS | 0x07, /**< The output buffer size which is passed as parameter is too small */
+       CKMC_ERROR_SERVER_ERROR             = KEY_MANAGER_ERROR_CLASS | 0x08, /**< Central Key Manager has been failed for some reason */
+       CKMC_ERROR_DB_LOCKED                = KEY_MANAGER_ERROR_CLASS | 0x09, /**< The database was not unlocked - user did not login */
+       CKMC_ERROR_DB_ERROR                 = KEY_MANAGER_ERROR_CLASS | 0x0A, /**< An internal error inside the database */
+       CKMC_ERROR_DB_ALIAS_EXISTS          = KEY_MANAGER_ERROR_CLASS | 0x0B, /**< Provided alias already exists in the database */
+       CKMC_ERROR_DB_ALIAS_UNKNOWN         = KEY_MANAGER_ERROR_CLASS | 0x0C, /**< No data for given alias */
+       CKMC_ERROR_VERIFICATION_FAILED      = KEY_MANAGER_ERROR_CLASS | 0x0D, /**< CA certificate(s) were unknown and chain could not be created */
+       CKMC_ERROR_INVALID_FORMAT           = KEY_MANAGER_ERROR_CLASS | 0x0E, /**< A provided file or binary has not a valid format */
+       CKMC_ERROR_FILE_ACCESS_DENIED       = KEY_MANAGER_ERROR_CLASS | 0x0F, /**< A provided file or binary has not a valid format */
+       CKMC_ERROR_UNKNOWN                  = KEY_MANAGER_ERROR_CLASS | 0x10, /**< A provided file or binary has not a valid format */
 } key_manager_error_e;
 
 
index a2352a7..3be5a5a 100644 (file)
@@ -56,13 +56,13 @@ extern "C" {
  * @param[in] policy about how to store a key securely.
  *
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
  * @retval #CKMC_ERROR_DB_ALIAS_EXISTS alias already exists.
  * @retval #CKMC_ERROR_INVALID_FORMAT the format of raw_key is not valid.
  * @retval #CKMC_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
  *
@@ -86,12 +86,12 @@ int ckmc_save_key(const char *alias, const ckmc_key_s key, const ckmc_policy_s p
  * @param[in] alias the name of a key to be removed
  *
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
  * @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
  *
@@ -116,12 +116,12 @@ int ckmc_remove_key(const char *alias);
  * @param[out] ppkey a pointer to a newly created ckmc_key_s handle
  *
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
  * @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
  *
@@ -144,11 +144,11 @@ int ckmc_get_key(const char *alias, const char *password, ckmc_key_s **ppkey);
  * @param[out] ppalias_list a pointer to a newly created ckmc_alias_list_s handle containing all available alias of keys. If there is no available key alias, *ppalias_list will be null.
  *
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
  * @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
  *
@@ -173,13 +173,13 @@ int ckmc_get_key_alias_list(ckmc_alias_list_s** ppalias_list);
  * @param[in] policy about how to store a certificate securely.
  *
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
  * @retval #CKMC_ERROR_DB_ALIAS_EXISTS alias already exists.
  * @retval #CKMC_ERROR_INVALID_FORMAT the format of raw_cert is not valid.
  * @retval #CKMC_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
  *
@@ -203,12 +203,12 @@ int ckmc_save_cert(const char *alias, const ckmc_cert_s cert, const ckmc_policy_
  * @param[in] alias the name of a certificate to be removed
  *
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
  * @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
  *
@@ -233,12 +233,12 @@ int ckmc_remove_cert(const char *alias);
  * @param[out] ppcert a pointer to a newly created ckmc_cert_s handle
  *
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
  * @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
  *
@@ -261,11 +261,11 @@ int ckmc_get_cert(const char *alias, const char *password, ckmc_cert_s **ppcert)
  * @param[out] ppalias_list a pointer to a newly created ckmc_alias_list_s handle containing all available alias of keys. If there is no available key alias, *ppalias_list will be null.
  *
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
  * @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
  *
@@ -290,12 +290,12 @@ int ckmc_get_cert_alias_list(ckmc_alias_list_s** ppalias_list);
  * @param[in] policy about how to store a data securely.
  *
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
  * @retval #CKMC_ERROR_DB_ALIAS_EXISTS alias already exists.
  * @retval #CKMC_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
  *
@@ -319,12 +319,12 @@ int ckmc_save_data(const char *alias, ckmc_raw_buffer_s data, const ckmc_policy_
  * @param[in] alias the name of a data to be removed
  *
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
  * @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
  *
@@ -349,12 +349,12 @@ int ckmc_remove_data(const char *alias);
  * @param[out] ppdata a pointer to a newly created ckmc_raw_buffer_s handle
  *
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
  * @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
  *
@@ -377,11 +377,11 @@ int ckmc_get_data(const char *alias, const char *password, ckmc_raw_buffer_s **p
  * @param[out] ppalias_list a pointer to a newly created ckmc_alias_list_s handle containing all available alias of keys. If there is no available key alias, *ppalias_list will be null.
  *
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
  * @retval #CKMC_ERROR_DB_ERROR failed due to the error with unknown reason
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
  *
@@ -410,12 +410,12 @@ int ckmc_get_data_alias_list(ckmc_alias_list_s** ppalias_list);
  * @param[in] policy_public_key about how to store a public key securely.
  *
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
  * @retval #CKMC_ERROR_DB_ALIAS_EXISTS alias already exists.
  * @retval #CKMC_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
  *
@@ -441,12 +441,12 @@ int ckmc_create_key_pair_rsa(const size_t size, const char *private_key_alias, c
  * @param[in] policy_public_key about how to store a public key securely.
  *
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
  * @retval #CKMC_ERROR_DB_ALIAS_EXISTS alias already exists.
  * @retval #CKMC_ERROR_DB_ERROR failed due to other DB transaction unexpectedly.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
  *
@@ -476,11 +476,11 @@ int ckmc_create_key_pair_ecdsa(const ckmc_ec_type_e type, const char *private_ke
  * @param[out] ppsignature a pointer to a newly created signature's. If an error occurs, *ppsignature will be null.
  *
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_NONE Successful
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
  *
@@ -510,12 +510,12 @@ int ckmc_create_signature(const char *private_key_alias, const char *password, c
  * @param[in] padding the RSA padding algorithm used in verifying signature. It is used only when the signature algorithm is RSA.
  *
  * @return 0 on success and the signature is valid, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
+ * @retval #CKMC_ERROR_NONE Successful
  * @retval #CKMC_ERROR_VERIFICATION_FAILED the signature is invalid
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
  *
@@ -542,12 +542,12 @@ int ckmc_verify_signature(const char *public_key_alias, const char *password, co
  * @param[out] ppcert_chain_list a pointer to a newly created certificate chain's handle. If an error occurs, *ppcert_chain_list will be null.
  *
  * @return 0 on success and the signature is valid, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
+ * @retval #CKMC_ERROR_NONE Successful
  * @retval #CKMC_ERROR_VERIFICATION_FAILED the certificate chain is not valid
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
  * @retval #CKMC_ERROR_INVALID_FORMAT the format of certificate is not valid.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
  *
@@ -571,13 +571,13 @@ int ckmc_get_cert_chain(const ckmc_cert_s *cert, const ckmc_cert_list_s *untrust
  * @param[out] ppcert_chain_list a pointer to a newly created certificate chain's handle. If an error occurs, *ppcert_chain_list will be null.
  *
  * @return 0 on success and the signature is valid, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
+ * @retval #CKMC_ERROR_NONE Successful
  * @retval #CKMC_ERROR_VERIFICATION_FAILED the certificate chain is not valid
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_DB_LOCKED a user key is not loaded in memory(a user is not logged in)
  * @retval #CKMC_ERROR_DB_ALIAS_UNKNOWN alias doesn't exists.
  * @retval #CKMC_ERROR_INVALID_FORMAT the format of certificate is not valid.
- * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
+ * @retval #CKMC_ERROR_PERMISSION_DENIED failed to access key manager
  *
  * @pre User must be already logged in and his user key is already loaded into memory in plain text form.
  *
index 50d97ad..30f7c0f 100644 (file)
@@ -179,7 +179,7 @@ typedef struct __ckmc_cert_list {
  * @param[in] password byte array used to decrypt raw_key inside key manager. If raw_key is not encrypted, password can be null.
  * @param[out] ppkey a pointer to a newly created ckmc_key_s handle
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_OUT_OF_MEMORY not enough memory
  * @see ckmc_key_free()
  * @see #ckmc_key_s
@@ -213,7 +213,7 @@ void ckmc_key_free(ckmc_key_s *key);
  * @param[in] size the byte size of buffer
  * @param[out] ppbuffer a pointer to a newly created ckmc_buffer_s handle
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_OUT_OF_MEMORY not enough memory
  * @see ckmc_buffer_free()
  * @see #ckmc_raw_buffer_s
@@ -247,7 +247,7 @@ void ckmc_buffer_free(ckmc_raw_buffer_s *buffer);
  * @param[in] data_format the encoding format of raw_cert
  * @param[out] ppcert a pointer to a newly created ckmc_cert_s handle
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_OUT_OF_MEMORY not enough memory
  * @see ckmc_cert_free()
  * @see ckmc_load_cert_from_file()
@@ -282,8 +282,8 @@ void ckmc_cert_free(ckmc_cert_s *cert);
  *
  * @param[in] file_path a path of certificate file to be loaded. The  only DER or PEM encoded certificate file is supported.
  * @param[out] cert the pointer of newly created ckmc_cert_s handle
- * @return #CKMC_SUCCESS on success, otherwise a negative error value
- * @retval #CKMC_SUCCESS Successful
+ * @return #CKMC_ERROR_NONE on success, otherwise a negative error value
+ * @retval #CKMC_ERROR_NONE Successful
  * @retval #CKMC_ERROR_OUT_OF_MEMORY not enough memory space
  * @retval #CKMC_ERROR_INVALID_FORMAT invalid certificate file format
  * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
@@ -308,8 +308,8 @@ int ckmc_load_cert_from_file(const char *file_path, ckmc_cert_s **cert);
  * @param[out] private_key the pointer of newly created ckmc_key_s handle for a private key
  * @param[out] cert the pointer of newly created ckmc_cert_s handle for a certificate. It is null if the PKCS12 file doesn't contain a certificate.
  * @param[out] ca_cert_list the pointer of newly created ckmc_cert_list_s handle for CA certificates. It is null if the PKCS12 file doesn't contain CA certificates.
- * @return #CKMC_SUCCESS on success, otherwise a negaprevious == NULL || tive error value
- * @retval #CKMC_SUCCESS Successful
+ * @return #CKMC_ERROR_NONE on success, otherwise a negative error value
+ * @retval #CKMC_ERROR_NONE Successful
  * @retval #CKMC_ERROR_OUT_OF_MEMORY not enough memory space
  * @retval #CKMC_ERROR_INVALID_FORMAT invalid PKCS12 file format
  * @retval #CKMC_ERROR_FILE_ACCESS_DENIED provided file doesn't exists or cannot be accessed
@@ -337,7 +337,7 @@ int ckmc_load_from_pkcs12_file(const char *file_path, const char *passphrase,
  * @param[in] alias the first item to be set in the newly created ckmc_alias_list_s.
  * @param[out] ppalias_list a pointer to a newly created ckmc_alias_list_s handle
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_OUT_OF_MEMORY not enough memory
  * @see ckmc_alias_list_add()
  * @see ckmc_alias_list_free()
@@ -358,7 +358,7 @@ int ckmc_alias_list_new(char *alias, ckmc_alias_list_s **ppalias_list);
  * @param[in] alias an item to be set in the newly created ckmc_alias_list_s.
  * @param[out] pplast a pointer to a newly created and added ckmc_alias_list_s handle
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_OUT_OF_MEMORY not enough memory
  * @see ckmc_alias_list_add()
  * @see ckmc_alias_list_free()
@@ -417,7 +417,7 @@ void ckmc_alias_list_all_free(ckmc_alias_list_s *first);
  * @param[in] cert the first item to be set in the newly created ckmc_cert_list_s.
  * @param[out] ppalias_list a pointer to a newly created ckmc_alias_list_s handle
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_OUT_OF_MEMORY not enough memory
  * @see ckmc_cert_list_add()
  * @see ckmc_cert_list_free()
@@ -438,7 +438,7 @@ int ckmc_cert_list_new(ckmc_cert_s *cert, ckmc_cert_list_s **ppalias_list);
  * @param[in] cert an item to be set in the newly created ckmc_cert_list_s.
  * @param[out] pplast a pointer to a newly created and added ckmc_alias_list_s handle
  * @return 0 on success, otherwise a negative error value
- * @retval #CKMC_ERROR_INPUT_PARAM input parameter is invalid
+ * @retval #CKMC_ERROR_INVALID_PARAMETER input parameter is invalid
  * @retval #CKMC_ERROR_OUT_OF_MEMORY not enough memory
  * @see ckmc_cert_list_add()
  * @see ckmc_cert_list_free()
index ce4cb63..ddefbbd 100644 (file)
@@ -64,7 +64,7 @@ ckmc_cert_list_s *_toNewCkmCertList(CKM::CertificateShPtrVector &certVector)
                }else {
                        ret = ckmc_cert_list_add(plist, pcert, &plist);
                }
-               if(ret != CKMC_SUCCESS) {
+               if(ret != CKMC_ERROR_NONE) {
                        ckmc_cert_list_all_free(start);
                        return NULL;
                }
@@ -78,12 +78,12 @@ int ckmc_save_key(const char *alias, const ckmc_key_s key, const ckmc_policy_s p
        CKM::ManagerShPtr mgr = CKM::Manager::create();
 
        if(alias == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
        CKM::Alias ckmAlias(alias);
 
        if(key.raw_key == NULL || key.key_size <= 0) {
-                       return CKMC_ERROR_INPUT_PARAM;
+                       return CKMC_ERROR_INVALID_PARAMETER;
        }
        CKM::RawBuffer buffer(key.raw_key, key.raw_key + key.key_size);
        CKM::KeyShPtr ckmKey = CKM::Key::create(buffer, _tostring(key.password));
@@ -105,7 +105,7 @@ int ckmc_remove_key(const char *alias)
        CKM::ManagerShPtr mgr = CKM::Manager::create();
 
        if(alias == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
        CKM::Alias ckmAlias(alias);
 
@@ -120,7 +120,7 @@ int ckmc_get_key(const char *alias, const char *password, ckmc_key_s **key)
        CKM::KeyShPtr ckmKey;
 
        if(alias == NULL || key == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
        CKM::Alias ckmAlias(alias);
 
@@ -143,7 +143,7 @@ int ckmc_get_key_alias_list(ckmc_alias_list_s** alias_list)
        int ret;
 
        if(alias_list == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
 
        CKM::AliasVector aliasVector;
@@ -164,25 +164,25 @@ int ckmc_get_key_alias_list(ckmc_alias_list_s** alias_list)
                }else {
                        ret = ckmc_alias_list_add(plist, alias, &plist);
                }
-               if(ret != CKMC_SUCCESS) {
+               if(ret != CKMC_ERROR_NONE) {
                        ckmc_alias_list_all_free(*alias_list);
                        return ret;
                }
        }
 
-       return CKMC_SUCCESS;
+       return CKMC_ERROR_NONE;
 }
 
 KEY_MANAGER_CAPI
 int ckmc_save_cert(const char *alias, const ckmc_cert_s cert, const ckmc_policy_s policy)
 {
        if(alias == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
        CKM::Alias ckmAlias(alias);
 
        if(cert.raw_cert == NULL || cert.cert_size <= 0) {
-                       return CKMC_ERROR_INPUT_PARAM;
+                       return CKMC_ERROR_INVALID_PARAMETER;
        }
        CKM::CertificateShPtr ckmCert = _toCkmCertificate(&cert);
        if(ckmCert.get() == NULL) {
@@ -201,7 +201,7 @@ KEY_MANAGER_CAPI
 int ckmc_remove_cert(const char *alias)
 {
        if(alias == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
        CKM::Alias ckmAlias(alias);
 
@@ -218,7 +218,7 @@ int ckmc_get_cert(const char *alias, const char *password, ckmc_cert_s **cert)
        int ret;
 
        if(alias == NULL || cert == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
        CKM::Alias ckmAlias(alias);
 
@@ -238,7 +238,7 @@ int ckmc_get_cert_alias_list(ckmc_alias_list_s** alias_list) {
        int ret;
 
        if(alias_list == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
 
        CKM::AliasVector aliasVector;
@@ -261,25 +261,25 @@ int ckmc_get_cert_alias_list(ckmc_alias_list_s** alias_list) {
                        ret = ckmc_alias_list_add(plist, alias, &plist);
 
                }
-               if(ret != CKMC_SUCCESS) {
+               if(ret != CKMC_ERROR_NONE) {
                        ckmc_alias_list_all_free(*alias_list);
                        return ret;
                }
        }
 
-       return CKMC_SUCCESS;
+       return CKMC_ERROR_NONE;
 }
 
 KEY_MANAGER_CAPI
 int ckmc_save_data(const char *alias, ckmc_raw_buffer_s data, const ckmc_policy_s policy)
 {
        if(alias == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
        CKM::Alias ckmAlias(alias);
 
        if(data.data == NULL || data.size <= 0) {
-                       return CKMC_ERROR_INPUT_PARAM;
+                       return CKMC_ERROR_INVALID_PARAMETER;
        }
        CKM::RawBuffer buffer(data.data, data.data + data.size);
 
@@ -295,7 +295,7 @@ KEY_MANAGER_CAPI
 int ckmc_remove_data(const char *alias)
 {
        if(alias == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
        CKM::Alias ckmAlias(alias);
 
@@ -311,7 +311,7 @@ int ckmc_get_data(const char *alias, const char *password, ckmc_raw_buffer_s **d
        int ret;
 
        if(alias == NULL || data == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
        CKM::Alias ckmAlias(alias);
 
@@ -331,7 +331,7 @@ int ckmc_get_data_alias_list(ckmc_alias_list_s** alias_list){
        int ret;
 
        if(alias_list == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
 
        CKM::AliasVector aliasVector;
@@ -352,13 +352,13 @@ int ckmc_get_data_alias_list(ckmc_alias_list_s** alias_list){
                }else {
                        ret = ckmc_alias_list_add(plist, alias, &plist);
                }
-               if(ret != CKMC_SUCCESS) {
+               if(ret != CKMC_ERROR_NONE) {
                        ckmc_alias_list_all_free(*alias_list);
                        return ret;
                }
        }
 
-       return CKMC_SUCCESS;
+       return CKMC_ERROR_NONE;
 }
 
 KEY_MANAGER_CAPI
@@ -372,7 +372,7 @@ int ckmc_create_key_pair_rsa(const size_t size,
        CKM::ManagerShPtr mgr = CKM::Manager::create();
 
        if(private_key_alias == NULL || public_key_alias == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
 
        CKM::Alias ckmPrivakeKeyAlias(private_key_alias);
@@ -394,7 +394,7 @@ int ckmc_create_key_pair_ecdsa(const ckmc_ec_type_e type,
        CKM::ManagerShPtr mgr = CKM::Manager::create();
 
        if(private_key_alias == NULL || public_key_alias == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
 
        CKM::ElipticCurve ckmType = static_cast<CKM::ElipticCurve>(static_cast<int>(type));
@@ -420,7 +420,7 @@ int ckmc_create_signature(const char *private_key_alias,
        CKM::RawBuffer ckmSignature;
 
        if(private_key_alias == NULL || signature == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
 
        CKM::Alias ckmPrivakeKeyAlias(private_key_alias);
@@ -456,7 +456,7 @@ int ckmc_verify_signature(const char *public_key_alias,
        CKM::ManagerShPtr mgr = CKM::Manager::create();
 
        if(public_key_alias == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
 
        CKM::Alias ckmPublicKeyAlias(public_key_alias);
@@ -475,7 +475,7 @@ int ckmc_verify_signature(const char *public_key_alias,
                return to_ckmc_error(ret);
        }
 
-       return CKMC_SUCCESS;
+       return CKMC_ERROR_NONE;
 }
 
 KEY_MANAGER_CAPI
@@ -486,7 +486,7 @@ int ckmc_get_cert_chain(const ckmc_cert_s *cert, const ckmc_cert_list_s *untrust
        CKM::CertificateShPtrVector ckmCertChain;
 
        if(cert == NULL || cert->raw_cert == NULL || cert->cert_size <= 0 || cert_chain_list == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
 
        CKM::CertificateShPtr ckmCert = _toCkmCertificate(cert);
@@ -515,7 +515,7 @@ int ckmc_get_cert_chain(const ckmc_cert_s *cert, const ckmc_cert_list_s *untrust
 
        *cert_chain_list = _toNewCkmCertList(ckmCertChain);
 
-       return CKMC_SUCCESS;
+       return CKMC_ERROR_NONE;
 }
 
 KEY_MANAGER_CAPI
@@ -527,7 +527,7 @@ int ckmc_get_cert_chain_with_alias(const ckmc_cert_s *cert, const ckmc_alias_lis
 
 
        if(cert == NULL || cert->raw_cert == NULL || cert->cert_size <= 0 || cert_chain_list == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
 
     CKM::CertificateShPtr ckmCert = _toCkmCertificate(cert);
@@ -544,7 +544,7 @@ int ckmc_get_cert_chain_with_alias(const ckmc_cert_s *cert, const ckmc_alias_lis
                        next = current->next;
 
                        if(current->alias == NULL){
-                               return CKMC_ERROR_INPUT_PARAM;
+                               return CKMC_ERROR_INVALID_PARAMETER;
                        }
                        CKM::Alias ckmAlias(current->alias);
                        ckmUntrustedAliases.push_back(ckmAlias);
@@ -557,6 +557,6 @@ int ckmc_get_cert_chain_with_alias(const ckmc_cert_s *cert, const ckmc_alias_lis
 
        *cert_chain_list = _toNewCkmCertList(ckmCertChain);
 
-       return CKMC_SUCCESS;
+       return CKMC_ERROR_NONE;
 }
 
index ad8c1a2..7864a8c 100644 (file)
@@ -41,7 +41,7 @@ int ckmc_key_new(unsigned char *raw_key, size_t key_size, ckmc_key_type_e key_ty
        ckmc_key_s *pkey;
 
        if(raw_key == NULL || key_size <= 0 || ppkey == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
 
        pkey = new ckmc_key_s;
@@ -73,7 +73,7 @@ int ckmc_key_new(unsigned char *raw_key, size_t key_size, ckmc_key_type_e key_ty
 
        *ppkey = pkey;
 
-       return CKMC_SUCCESS;
+       return CKMC_ERROR_NONE;
 }
 
 KEY_MANAGER_CAPI
@@ -98,7 +98,7 @@ int ckmc_buffer_new(unsigned char *data, size_t size,ckmc_raw_buffer_s **ppbuffe
        ckmc_raw_buffer_s *pbuff;
 
        if(data == NULL || size <= 0 || ppbuffer == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
 
        pbuff = new ckmc_raw_buffer_s;
@@ -115,7 +115,7 @@ int ckmc_buffer_new(unsigned char *data, size_t size,ckmc_raw_buffer_s **ppbuffe
        pbuff->size = size;
        *ppbuffer = pbuff;
 
-       return CKMC_SUCCESS;
+       return CKMC_ERROR_NONE;
 }
 
 KEY_MANAGER_CAPI
@@ -137,7 +137,7 @@ int ckmc_cert_new(unsigned char *raw_cert, size_t cert_size, ckmc_data_format_e
        ckmc_cert_s *pcert;
 
        if(raw_cert == NULL || cert_size <= 0 || ppcert == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
 
        pcert = new ckmc_cert_s;
@@ -155,7 +155,7 @@ int ckmc_cert_new(unsigned char *raw_cert, size_t cert_size, ckmc_data_format_e
        pcert->data_format = data_format;
 
        *ppcert = pcert;
-       return CKMC_SUCCESS;
+       return CKMC_ERROR_NONE;
 }
 
 KEY_MANAGER_CAPI
@@ -177,7 +177,7 @@ int ckmc_load_cert_from_file(const char *file_path, ckmc_cert_s **cert)
        }
 
        int ret = _ckmc_load_cert_from_x509(pcert, cert);
-       if(ret != CKMC_SUCCESS) {
+       if(ret != CKMC_ERROR_NONE) {
                X509_free(pcert);
        }
        return ret;
@@ -206,7 +206,7 @@ int ckmc_load_from_pkcs12_file(const char *file_path, const char *passphrase, ck
                        pkey = NULL;
                        x509Cert = NULL;
                        ca = NULL;
-                       ret = CKMC_SUCCESS;
+                       ret = CKMC_ERROR_NONE;
                        retPrivateKey = NULL;
                        retCkmCert = NULL;
                        retCaCertList = NULL;
@@ -224,7 +224,7 @@ int ckmc_load_from_pkcs12_file(const char *file_path, const char *passphrase, ck
                                sk_X509_pop_free(ca, X509_free);
                        EVP_cleanup();
 
-                       if(ret != CKMC_SUCCESS) {
+                       if(ret != CKMC_ERROR_NONE) {
                                if(retPrivateKey != NULL){
                                        ckmc_key_free(retPrivateKey);
                                        retPrivateKey = NULL;
@@ -254,14 +254,14 @@ int ckmc_load_from_pkcs12_file(const char *file_path, const char *passphrase, ck
                        if((ret = PKCS12_parse(p12, pass, &pkey, &x509Cert, &ca)) != 1) {
                                return CKMC_ERROR_INVALID_FORMAT;
                        }
-                       return CKMC_SUCCESS;
+                       return CKMC_ERROR_NONE;
                }
 
                int toCkmCert() {
-                       if( (ret =_ckmc_load_cert_from_x509(x509Cert,&retCkmCert)) != CKMC_SUCCESS) {
+                       if( (ret =_ckmc_load_cert_from_x509(x509Cert,&retCkmCert)) != CKMC_ERROR_NONE) {
                                return ret;
                        }
-                       return CKMC_SUCCESS;
+                       return CKMC_ERROR_NONE;
                }
 
                int toCkmKey() {
@@ -302,7 +302,7 @@ int ckmc_load_from_pkcs12_file(const char *file_path, const char *passphrase, ck
                        ckmc_cert_s *popedCkmCert = NULL;
                        ckmc_cert_list_s *tmpCertList = NULL;
                        while((popedCert = sk_X509_pop(ca)) != NULL) {
-                               if( (tmpRet =_ckmc_load_cert_from_x509(popedCert, &popedCkmCert)) != CKMC_SUCCESS) {
+                               if( (tmpRet =_ckmc_load_cert_from_x509(popedCert, &popedCkmCert)) != CKMC_ERROR_NONE) {
                                        return CKMC_ERROR_OUT_OF_MEMORY;
                                }
                                if(tmpCertList == NULL) { // first
@@ -311,30 +311,30 @@ int ckmc_load_from_pkcs12_file(const char *file_path, const char *passphrase, ck
                                }else {
                                        tmpRet = ckmc_cert_list_add(tmpCertList, popedCkmCert, &tmpCertList);
                                }
-                               if(tmpRet != CKMC_SUCCESS) {
+                               if(tmpRet != CKMC_ERROR_NONE) {
                                        ckmc_cert_list_all_free(retCaCertList);
                                        retCaCertList = NULL;
                                        return tmpRet;
                                }
                        }
-                       return CKMC_SUCCESS;
+                       return CKMC_ERROR_NONE;
                }
 
        };
 
-       int ret = CKMC_SUCCESS;
+       int ret = CKMC_ERROR_NONE;
 
        Pkcs12Converter converter;
-       if((ret = converter.parsePkcs12(file_path, passphrase)) != CKMC_SUCCESS) {
+       if((ret = converter.parsePkcs12(file_path, passphrase)) != CKMC_ERROR_NONE) {
                return ret;
        }
-       if((ret = converter.toCkmCert()) != CKMC_SUCCESS) {
+       if((ret = converter.toCkmCert()) != CKMC_ERROR_NONE) {
                return ret;
        }
-       if((ret = converter.toCkmKey()) != CKMC_SUCCESS) {
+       if((ret = converter.toCkmKey()) != CKMC_ERROR_NONE) {
                return ret;
        }
-       if((ret = converter.toCaCkmCertList()) != CKMC_SUCCESS) {
+       if((ret = converter.toCaCkmCertList()) != CKMC_ERROR_NONE) {
                return ret;
        }
 
@@ -342,7 +342,7 @@ int ckmc_load_from_pkcs12_file(const char *file_path, const char *passphrase, ck
        *ckmcert = converter.retCkmCert;
        *ca_cert_list = converter.retCaCertList;
 
-       return CKMC_SUCCESS;
+       return CKMC_ERROR_NONE;
 }
 
 KEY_MANAGER_CAPI
@@ -371,7 +371,7 @@ int ckmc_alias_list_add(ckmc_alias_list_s *previous, char *alias, ckmc_alias_lis
        ckmc_alias_list_s *plist;
 
        if(alias == NULL || pplast == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
 
        plist = new ckmc_alias_list_s;
@@ -387,7 +387,7 @@ int ckmc_alias_list_add(ckmc_alias_list_s *previous, char *alias, ckmc_alias_lis
        }
        *pplast = plist;
 
-       return CKMC_SUCCESS;
+       return CKMC_ERROR_NONE;
 }
 
 KEY_MANAGER_CAPI
@@ -435,7 +435,7 @@ int ckmc_cert_list_add(ckmc_cert_list_s *previous, ckmc_cert_s *cert, ckmc_cert_
        ckmc_cert_list_s *plist;
 
        if(cert == NULL || pplast == NULL) {
-               return CKMC_ERROR_INPUT_PARAM;
+               return CKMC_ERROR_INVALID_PARAMETER;
        }
 
        plist = new ckmc_cert_list_s;
@@ -451,7 +451,7 @@ int ckmc_cert_list_add(ckmc_cert_list_s *previous, ckmc_cert_s *cert, ckmc_cert_
 
        *pplast = plist;
 
-       return CKMC_SUCCESS;
+       return CKMC_ERROR_NONE;
 }
 
 KEY_MANAGER_CAPI
@@ -510,17 +510,17 @@ int _ckmc_load_cert_from_x509(X509 *xCert, ckmc_cert_s **cert)
 
 int to_ckmc_error(int ckm_error) {
        switch(ckm_error) {
-       case CKM_API_SUCCESS:                     return CKMC_SUCCESS;
+       case CKM_API_SUCCESS:                     return CKMC_ERROR_NONE;
        case CKM_API_ERROR_SOCKET:                return CKMC_ERROR_SOCKET;
        case CKM_API_ERROR_BAD_REQUEST:           return CKMC_ERROR_BAD_REQUEST;
        case CKM_API_ERROR_BAD_RESPONSE:          return CKMC_ERROR_BAD_RESPONSE;
        case CKM_API_ERROR_SEND_FAILED:           return CKMC_ERROR_SEND_FAILED;
        case CKM_API_ERROR_RECV_FAILED:           return CKMC_ERROR_RECV_FAILED;
        case CKM_API_ERROR_AUTHENTICATION_FAILED: return CKMC_ERROR_AUTHENTICATION_FAILED;
-       case CKM_API_ERROR_INPUT_PARAM:           return CKMC_ERROR_INPUT_PARAM;
+       case CKM_API_ERROR_INPUT_PARAM:           return CKMC_ERROR_INVALID_PARAMETER;
        case CKM_API_ERROR_BUFFER_TOO_SMALL:      return CKMC_ERROR_BUFFER_TOO_SMALL;
        case CKM_API_ERROR_OUT_OF_MEMORY:         return CKMC_ERROR_OUT_OF_MEMORY;
-       case CKM_API_ERROR_ACCESS_DENIED:         return CKMC_ERROR_ACCESS_DENIED;
+       case CKM_API_ERROR_ACCESS_DENIED:         return CKMC_ERROR_PERMISSION_DENIED;
        case CKM_API_ERROR_SERVER_ERROR:          return CKMC_ERROR_SERVER_ERROR;
        case CKM_API_ERROR_DB_LOCKED:             return CKMC_ERROR_DB_LOCKED;
        case CKM_API_ERROR_DB_ERROR:              return CKMC_ERROR_DB_ERROR;