libopensc: SM related errors

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5439 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
vtarasov 2011-05-13 12:50:24 +00:00
parent 4fbb37ae7e
commit e6a3d92de7
2 changed files with 32 additions and 0 deletions

View File

@ -119,6 +119,21 @@ const char *sc_strerror(int error)
};
const int p15i_base = -SC_ERROR_PKCS15INIT;
const int sm_base = -SC_ERROR_SM;
const char *sm_errors[] = {
"Generic Secure Messaging error",
"Data enciphering error",
"Invalid secure messaging level",
"No session keys",
"Invalid session keys",
"Secure Messaging not initialized",
"Cannot authenticate card",
"Random generation error",
"Secure messaging keyset not found",
"IFD data missing"
};
const char *misc_errors[] = {
"Unknown error",
"PKCS#15 compatible smart card not found",
@ -138,6 +153,10 @@ const char *sc_strerror(int error)
errors = misc_errors;
count = DIM(misc_errors);
err_base = misc_base;
} else if (error >= sm_base) {
errors = sm_errors;
count = DIM(sm_errors);
err_base = sm_base;
} else if (error >= p15i_base) {
errors = p15i_errors;
count = DIM(p15i_errors);

View File

@ -108,6 +108,19 @@ extern "C" {
#define SC_ERROR_INVALID_PIN_REFERENCE -1509
#define SC_ERROR_FILE_TOO_SMALL -1510
/* Related to secure messaging */
#define SC_ERROR_SM -1600
#define SC_ERROR_SM_ENCRYPT_FAILED -1601
#define SC_ERROR_SM_INVALID_LEVEL -1602
#define SC_ERROR_SM_NO_SESSION_KEYS -1603
#define SC_ERROR_SM_INVALID_SESSION_KEY -1604
#define SC_ERROR_SM_NOT_INITIALIZED -1605
#define SC_ERROR_SM_AUTHENTICATION_FAILED -1606
#define SC_ERROR_SM_RAND_FAILED -1607
#define SC_ERROR_SM_KEYSET_NOT_FOUND -1608
#define SC_ERROR_SM_IFD_DATA_MISSING -1609
/* Errors that do not fit the categories above */
#define SC_ERROR_UNKNOWN -1900
#define SC_ERROR_PKCS15_APP_NOT_FOUND -1901