Introduce SC_ERROR_NOT_ENOUGH_MEMORY <=> CKR_DEVICE_MEMORY.

When trying to import a too large keyfile as a data object, TrueCrypt received a CKR_GENERAL_ERROR before this.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3926 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
martin 2010-01-23 19:12:52 +00:00
parent f48ec9528e
commit 612d66655d
4 changed files with 5 additions and 1 deletions

View File

@ -63,6 +63,7 @@ const char *sc_strerror(int error)
"PIN code or key incorrect", "PIN code or key incorrect",
"File already exists", "File already exists",
"Data object not found", "Data object not found",
"Not enough memory on card",
}; };
const int card_base = -SC_ERROR_CARD_CMD_FAILED; const int card_base = -SC_ERROR_CARD_CMD_FAILED;
const char *arg_errors[] = { const char *arg_errors[] = {

View File

@ -65,6 +65,7 @@ extern "C" {
#define SC_ERROR_PIN_CODE_INCORRECT -1214 #define SC_ERROR_PIN_CODE_INCORRECT -1214
#define SC_ERROR_FILE_ALREADY_EXISTS -1215 #define SC_ERROR_FILE_ALREADY_EXISTS -1215
#define SC_ERROR_DATA_OBJECT_NOT_FOUND -1216 #define SC_ERROR_DATA_OBJECT_NOT_FOUND -1216
#define SC_ERROR_NOT_ENOUGH_MEMORY -1217
/* Returned by OpenSC library when called with invalid arguments */ /* Returned by OpenSC library when called with invalid arguments */
#define SC_ERROR_INVALID_ARGUMENTS -1300 #define SC_ERROR_INVALID_ARGUMENTS -1300

View File

@ -58,7 +58,7 @@ static const struct sc_card_error iso7816_errors[] = {
{ 0x6A81, SC_ERROR_NO_CARD_SUPPORT, "Function not supported" }, { 0x6A81, SC_ERROR_NO_CARD_SUPPORT, "Function not supported" },
{ 0x6A82, SC_ERROR_FILE_NOT_FOUND, "File not found" }, { 0x6A82, SC_ERROR_FILE_NOT_FOUND, "File not found" },
{ 0x6A83, SC_ERROR_RECORD_NOT_FOUND, "Record not found" }, { 0x6A83, SC_ERROR_RECORD_NOT_FOUND, "Record not found" },
{ 0x6A84, SC_ERROR_CARD_CMD_FAILED, "Not enough memory space in the file" }, { 0x6A84, SC_ERROR_NOT_ENOUGH_MEMORY, "Not enough memory space in the file" },
{ 0x6A85, SC_ERROR_INCORRECT_PARAMETERS,"Lc inconsistent with TLV structure" }, { 0x6A85, SC_ERROR_INCORRECT_PARAMETERS,"Lc inconsistent with TLV structure" },
{ 0x6A86, SC_ERROR_INCORRECT_PARAMETERS,"Incorrect parameters P1-P2" }, { 0x6A86, SC_ERROR_INCORRECT_PARAMETERS,"Incorrect parameters P1-P2" },
{ 0x6A87, SC_ERROR_INCORRECT_PARAMETERS,"Lc inconsistent with P1-P2" }, { 0x6A87, SC_ERROR_INCORRECT_PARAMETERS,"Lc inconsistent with P1-P2" },

View File

@ -78,6 +78,8 @@ CK_RV sc_to_cryptoki_error(int rc, int reader)
return CKR_DATA_INVALID; return CKR_DATA_INVALID;
case SC_ERROR_CARD_UNRESPONSIVE: case SC_ERROR_CARD_UNRESPONSIVE:
return CKR_DEVICE_ERROR; return CKR_DEVICE_ERROR;
case SC_ERROR_NOT_ENOUGH_MEMORY:
return CKR_DEVICE_MEMORY;
} }
sc_debug(context, "opensc error: %s (%d)\n", sc_strerror(rc), rc); sc_debug(context, "opensc error: %s (%d)\n", sc_strerror(rc), rc);
return CKR_GENERAL_ERROR; return CKR_GENERAL_ERROR;