From 612d66655df8d592b57f33753cc6adadee8731e3 Mon Sep 17 00:00:00 2001 From: martin Date: Sat, 23 Jan 2010 19:12:52 +0000 Subject: [PATCH] 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 --- src/libopensc/errors.c | 1 + src/libopensc/errors.h | 1 + src/libopensc/iso7816.c | 2 +- src/pkcs11/misc.c | 2 ++ 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libopensc/errors.c b/src/libopensc/errors.c index e84884d4..0b248d28 100644 --- a/src/libopensc/errors.c +++ b/src/libopensc/errors.c @@ -63,6 +63,7 @@ const char *sc_strerror(int error) "PIN code or key incorrect", "File already exists", "Data object not found", + "Not enough memory on card", }; const int card_base = -SC_ERROR_CARD_CMD_FAILED; const char *arg_errors[] = { diff --git a/src/libopensc/errors.h b/src/libopensc/errors.h index d27d19f1..1fa31470 100644 --- a/src/libopensc/errors.h +++ b/src/libopensc/errors.h @@ -65,6 +65,7 @@ extern "C" { #define SC_ERROR_PIN_CODE_INCORRECT -1214 #define SC_ERROR_FILE_ALREADY_EXISTS -1215 #define SC_ERROR_DATA_OBJECT_NOT_FOUND -1216 +#define SC_ERROR_NOT_ENOUGH_MEMORY -1217 /* Returned by OpenSC library when called with invalid arguments */ #define SC_ERROR_INVALID_ARGUMENTS -1300 diff --git a/src/libopensc/iso7816.c b/src/libopensc/iso7816.c index 7863240a..4963210a 100644 --- a/src/libopensc/iso7816.c +++ b/src/libopensc/iso7816.c @@ -58,7 +58,7 @@ static const struct sc_card_error iso7816_errors[] = { { 0x6A81, SC_ERROR_NO_CARD_SUPPORT, "Function not supported" }, { 0x6A82, SC_ERROR_FILE_NOT_FOUND, "File 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" }, { 0x6A86, SC_ERROR_INCORRECT_PARAMETERS,"Incorrect parameters P1-P2" }, { 0x6A87, SC_ERROR_INCORRECT_PARAMETERS,"Lc inconsistent with P1-P2" }, diff --git a/src/pkcs11/misc.c b/src/pkcs11/misc.c index 53828dbd..d7c77ee5 100644 --- a/src/pkcs11/misc.c +++ b/src/pkcs11/misc.c @@ -78,6 +78,8 @@ CK_RV sc_to_cryptoki_error(int rc, int reader) return CKR_DATA_INVALID; case SC_ERROR_CARD_UNRESPONSIVE: 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); return CKR_GENERAL_ERROR;