Rename of SC_NO_ERROR to SC_SUCCESS.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4954 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
6b10272caa
commit
50567141f0
|
@ -802,7 +802,7 @@ static int atrust_acos_check_sw(struct sc_card *card, unsigned int sw1,
|
||||||
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "sw1 = 0x%02x, sw2 = 0x%02x\n", sw1, sw2);
|
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "sw1 = 0x%02x, sw2 = 0x%02x\n", sw1, sw2);
|
||||||
|
|
||||||
if (sw1 == 0x90)
|
if (sw1 == 0x90)
|
||||||
return SC_NO_ERROR;
|
return SC_SUCCESS;
|
||||||
if (sw1 == 0x63 && (sw2 & ~0x0fU) == 0xc0 )
|
if (sw1 == 0x63 && (sw2 & ~0x0fU) == 0xc0 )
|
||||||
{
|
{
|
||||||
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "Verification failed (remaining tries: %d)\n",
|
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "Verification failed (remaining tries: %d)\n",
|
||||||
|
|
|
@ -247,9 +247,9 @@ static const struct sc_card_error cardos_errors[] = {
|
||||||
{ 0x6f00, SC_ERROR_CARD_CMD_FAILED, "technical error (see eToken developers guide)"},
|
{ 0x6f00, SC_ERROR_CARD_CMD_FAILED, "technical error (see eToken developers guide)"},
|
||||||
|
|
||||||
/* no error, maybe a note */
|
/* no error, maybe a note */
|
||||||
{ 0x9000, SC_NO_ERROR, NULL},
|
{ 0x9000, SC_SUCCESS, NULL},
|
||||||
{ 0x9001, SC_NO_ERROR, "success, but eeprom weakness detected"},
|
{ 0x9001, SC_SUCCESS, "success, but eeprom weakness detected"},
|
||||||
{ 0x9850, SC_NO_ERROR, "over/underflow useing in/decrease"}
|
{ 0x9850, SC_SUCCESS, "over/underflow useing in/decrease"}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int cardos_check_sw(sc_card_t *card, unsigned int sw1, unsigned int sw2)
|
static int cardos_check_sw(sc_card_t *card, unsigned int sw1, unsigned int sw2)
|
||||||
|
|
|
@ -861,13 +861,13 @@ static int entersafe_set_security_env(sc_card_t *card,
|
||||||
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, SC_ERROR_OUT_OF_MEMORY);
|
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, SC_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
memcpy(card->drv_data,env,sizeof(*env));
|
memcpy(card->drv_data,env,sizeof(*env));
|
||||||
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, SC_NO_ERROR);
|
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, SC_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int entersafe_restore_security_env(sc_card_t *card, int se_num)
|
static int entersafe_restore_security_env(sc_card_t *card, int se_num)
|
||||||
{
|
{
|
||||||
SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);
|
SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);
|
||||||
return SC_NO_ERROR;
|
return SC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -137,9 +137,9 @@ static const struct sc_card_error incrypto34_errors[] = {
|
||||||
{ 0x6f00, SC_ERROR_CARD_CMD_FAILED, "technical error (see incrypto34 developers guide)"},
|
{ 0x6f00, SC_ERROR_CARD_CMD_FAILED, "technical error (see incrypto34 developers guide)"},
|
||||||
|
|
||||||
/* no error, maybe a note */
|
/* no error, maybe a note */
|
||||||
{ 0x9000, SC_NO_ERROR, NULL},
|
{ 0x9000, SC_SUCCESS, NULL},
|
||||||
{ 0x9001, SC_NO_ERROR, "success, but eeprom weakness detected"},
|
{ 0x9001, SC_SUCCESS, "success, but eeprom weakness detected"},
|
||||||
{ 0x9850, SC_NO_ERROR, "over/underflow useing in/decrease"}
|
{ 0x9850, SC_SUCCESS, "over/underflow useing in/decrease"}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int incrypto34_check_sw(sc_card_t *card, unsigned int sw1, unsigned int sw2)
|
static int incrypto34_check_sw(sc_card_t *card, unsigned int sw1, unsigned int sw2)
|
||||||
|
|
|
@ -186,7 +186,7 @@ static const struct sc_card_error rutoken_errors[] = {
|
||||||
{ 0x6F85, SC_ERROR_CARD_CMD_FAILED, "In the current folder the maximum quantity of file system objects is already created"},
|
{ 0x6F85, SC_ERROR_CARD_CMD_FAILED, "In the current folder the maximum quantity of file system objects is already created"},
|
||||||
{ 0x6F86, SC_ERROR_CARD_CMD_FAILED, "Invalid access right. Already login"},
|
{ 0x6F86, SC_ERROR_CARD_CMD_FAILED, "Invalid access right. Already login"},
|
||||||
|
|
||||||
{ 0x9000, SC_NO_ERROR, NULL}
|
{ 0x9000, SC_SUCCESS, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int rutoken_check_sw(sc_card_t *card, unsigned int sw1, unsigned int sw2)
|
static int rutoken_check_sw(sc_card_t *card, unsigned int sw1, unsigned int sw2)
|
||||||
|
@ -523,7 +523,7 @@ static int set_sec_attr_from_acl(sc_card_t *card, sc_file_t *file)
|
||||||
size_t i, n_conv_attr;
|
size_t i, n_conv_attr;
|
||||||
const sc_acl_entry_t *entry;
|
const sc_acl_entry_t *entry;
|
||||||
sc_SecAttrV2_t attr = { 0 };
|
sc_SecAttrV2_t attr = { 0 };
|
||||||
int ret = SC_NO_ERROR;
|
int ret = SC_SUCCESS;
|
||||||
|
|
||||||
SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_NORMAL);
|
SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_NORMAL);
|
||||||
|
|
||||||
|
@ -1002,7 +1002,7 @@ static int rutoken_cipher_p(sc_card_t *card, const u8 * crgram, size_t crgram_le
|
||||||
ret = sc_transmit_apdu(card, &apdu);
|
ret = sc_transmit_apdu(card, &apdu);
|
||||||
SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, ret, "APDU transmit failed");
|
SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, ret, "APDU transmit failed");
|
||||||
ret = sc_check_sw(card, apdu.sw1, apdu.sw2);
|
ret = sc_check_sw(card, apdu.sw1, apdu.sw2);
|
||||||
if (ret == SC_NO_ERROR)
|
if (ret == SC_SUCCESS)
|
||||||
{
|
{
|
||||||
if (isIV)
|
if (isIV)
|
||||||
{
|
{
|
||||||
|
@ -1019,9 +1019,9 @@ static int rutoken_cipher_p(sc_card_t *card, const u8 * crgram, size_t crgram_le
|
||||||
outlen_tail -= apdu.resplen;
|
outlen_tail -= apdu.resplen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (ret == SC_NO_ERROR && crgram_len != 0);
|
} while (ret == SC_SUCCESS && crgram_len != 0);
|
||||||
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "len out cipher %d\n", outlen - outlen_tail);
|
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "len out cipher %d\n", outlen - outlen_tail);
|
||||||
if (ret == SC_NO_ERROR)
|
if (ret == SC_SUCCESS)
|
||||||
ret = (outlen_tail == 0) ? (int)outlen : SC_ERROR_WRONG_LENGTH;
|
ret = (outlen_tail == 0) ? (int)outlen : SC_ERROR_WRONG_LENGTH;
|
||||||
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, ret);
|
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, ret);
|
||||||
}
|
}
|
||||||
|
@ -1086,7 +1086,7 @@ static int rutoken_compute_mac_gost(sc_card_t *card,
|
||||||
ret = sc_transmit_apdu(card, &apdu);
|
ret = sc_transmit_apdu(card, &apdu);
|
||||||
SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, ret, "APDU transmit failed");
|
SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, ret, "APDU transmit failed");
|
||||||
ret = sc_check_sw(card, apdu.sw1, apdu.sw2);
|
ret = sc_check_sw(card, apdu.sw1, apdu.sw2);
|
||||||
} while (ret == SC_NO_ERROR && ilen != 0);
|
} while (ret == SC_SUCCESS && ilen != 0);
|
||||||
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, ret);
|
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1194,11 +1194,11 @@ static int rutoken_card_ctl(sc_card_t *card, unsigned long cmd, void *ptr)
|
||||||
/*|| cmd == SC_CARDCTL_ERASE_CARD */
|
/*|| cmd == SC_CARDCTL_ERASE_CARD */
|
||||||
|| cmd == SC_CARDCTL_RUTOKEN_FORMAT_INIT
|
|| cmd == SC_CARDCTL_RUTOKEN_FORMAT_INIT
|
||||||
|| cmd == SC_CARDCTL_RUTOKEN_FORMAT_END
|
|| cmd == SC_CARDCTL_RUTOKEN_FORMAT_END
|
||||||
) ? SC_NO_ERROR : SC_ERROR_INVALID_ARGUMENTS;
|
) ? SC_SUCCESS : SC_ERROR_INVALID_ARGUMENTS;
|
||||||
|
|
||||||
SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);
|
SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);
|
||||||
|
|
||||||
if (ret == SC_NO_ERROR)
|
if (ret == SC_SUCCESS)
|
||||||
{
|
{
|
||||||
switch (cmd)
|
switch (cmd)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1233,7 +1233,7 @@ static int starcos_check_sw(sc_card_t *card, unsigned int sw1, unsigned int sw2)
|
||||||
"sw1 = 0x%02x, sw2 = 0x%02x\n", sw1, sw2);
|
"sw1 = 0x%02x, sw2 = 0x%02x\n", sw1, sw2);
|
||||||
|
|
||||||
if (sw1 == 0x90)
|
if (sw1 == 0x90)
|
||||||
return SC_NO_ERROR;
|
return SC_SUCCESS;
|
||||||
if (sw1 == 0x63 && (sw2 & ~0x0fU) == 0xc0 )
|
if (sw1 == 0x63 && (sw2 & ~0x0fU) == 0xc0 )
|
||||||
{
|
{
|
||||||
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "Verification failed (remaining tries: %d)\n",
|
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "Verification failed (remaining tries: %d)\n",
|
||||||
|
|
|
@ -26,7 +26,6 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SC_SUCCESS 0
|
#define SC_SUCCESS 0
|
||||||
#define SC_NO_ERROR 0
|
|
||||||
|
|
||||||
/* Errors related to reader operation */
|
/* Errors related to reader operation */
|
||||||
#define SC_ERROR_READER -1100
|
#define SC_ERROR_READER -1100
|
||||||
|
|
|
@ -91,7 +91,7 @@ static int iso7816_check_sw(sc_card_t *card, unsigned int sw1, unsigned int sw2)
|
||||||
return SC_ERROR_WRONG_LENGTH;
|
return SC_ERROR_WRONG_LENGTH;
|
||||||
}
|
}
|
||||||
if (sw1 == 0x90)
|
if (sw1 == 0x90)
|
||||||
return SC_NO_ERROR;
|
return SC_SUCCESS;
|
||||||
if (sw1 == 0x63U && (sw2 & ~0x0fU) == 0xc0U ) {
|
if (sw1 == 0x63U && (sw2 & ~0x0fU) == 0xc0U ) {
|
||||||
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "Verification failed (remaining tries: %d)",
|
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "Verification failed (remaining tries: %d)",
|
||||||
(sw2 & 0x0f));
|
(sw2 & 0x0f));
|
||||||
|
|
|
@ -631,7 +631,7 @@ static int sc_pkcs15_bind_internal(sc_pkcs15_card_t *p15card)
|
||||||
if ((err == SC_ERROR_FILE_NOT_FOUND) &&
|
if ((err == SC_ERROR_FILE_NOT_FOUND) &&
|
||||||
(card->app_count < 1)) {
|
(card->app_count < 1)) {
|
||||||
sc_format_path("3F00", &p15card->file_app->path);
|
sc_format_path("3F00", &p15card->file_app->path);
|
||||||
err = SC_NO_ERROR;
|
err = SC_SUCCESS;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
|
|
|
@ -87,7 +87,7 @@ openct_reader_init(sc_context_t *ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return SC_NO_ERROR;
|
return SC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -138,7 +138,7 @@ openct_add_reader(sc_context_t *ctx, unsigned int num, ct_info_t *info)
|
||||||
static int openct_reader_finish(sc_context_t *ctx)
|
static int openct_reader_finish(sc_context_t *ctx)
|
||||||
{
|
{
|
||||||
SC_FUNC_CALLED(ctx, SC_LOG_DEBUG_VERBOSE);
|
SC_FUNC_CALLED(ctx, SC_LOG_DEBUG_VERBOSE);
|
||||||
return SC_NO_ERROR;
|
return SC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -159,7 +159,7 @@ static int openct_reader_release(sc_reader_t *reader)
|
||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return SC_NO_ERROR;
|
return SC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -218,7 +218,7 @@ openct_reader_connect(sc_reader_t *reader)
|
||||||
}
|
}
|
||||||
|
|
||||||
reader->atr_len = rc;
|
reader->atr_len = rc;
|
||||||
return SC_NO_ERROR;
|
return SC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -243,7 +243,7 @@ static int openct_reader_disconnect(sc_reader_t *reader)
|
||||||
if (data->h)
|
if (data->h)
|
||||||
ct_reader_disconnect(data->h);
|
ct_reader_disconnect(data->h);
|
||||||
data->h = NULL;
|
data->h = NULL;
|
||||||
return SC_NO_ERROR;
|
return SC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
Loading…
Reference in New Issue