mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
scd: Define new status word
* scd/apdu.h (SW_NO_CURRENT_EF): New. -- This merely to show better diagnostics. Used for example by CardOS 5.3.
This commit is contained in:
parent
5bcbc8cee3
commit
7620473cd0
@ -548,6 +548,7 @@ apdu_strerror (int rc)
|
|||||||
case SW_CHV_BLOCKED : return "CHV blocked";
|
case SW_CHV_BLOCKED : return "CHV blocked";
|
||||||
case SW_REF_DATA_INV : return "referenced data invalidated";
|
case SW_REF_DATA_INV : return "referenced data invalidated";
|
||||||
case SW_USE_CONDITIONS : return "use conditions not satisfied";
|
case SW_USE_CONDITIONS : return "use conditions not satisfied";
|
||||||
|
case SW_NO_CURRENT_EF : return "no current EF selected";
|
||||||
case SW_BAD_PARAMETER : return "bad parameter";
|
case SW_BAD_PARAMETER : return "bad parameter";
|
||||||
case SW_NOT_SUPPORTED : return "not supported";
|
case SW_NOT_SUPPORTED : return "not supported";
|
||||||
case SW_FILE_NOT_FOUND : return "file not found";
|
case SW_FILE_NOT_FOUND : return "file not found";
|
||||||
|
@ -39,6 +39,7 @@ enum {
|
|||||||
SW_CHV_BLOCKED = 0x6983,
|
SW_CHV_BLOCKED = 0x6983,
|
||||||
SW_REF_DATA_INV = 0x6984, /* Referenced data invalidated. */
|
SW_REF_DATA_INV = 0x6984, /* Referenced data invalidated. */
|
||||||
SW_USE_CONDITIONS = 0x6985,
|
SW_USE_CONDITIONS = 0x6985,
|
||||||
|
SW_NO_CURRENT_EF = 0x6986, /* No current EF selected. */
|
||||||
SW_BAD_PARAMETER = 0x6a80, /* (in the data field) */
|
SW_BAD_PARAMETER = 0x6a80, /* (in the data field) */
|
||||||
SW_NOT_SUPPORTED = 0x6a81,
|
SW_NOT_SUPPORTED = 0x6a81,
|
||||||
SW_FILE_NOT_FOUND = 0x6a82,
|
SW_FILE_NOT_FOUND = 0x6a82,
|
||||||
|
@ -63,6 +63,7 @@ map_sw (int sw)
|
|||||||
case SW_CHV_WRONG: ec = GPG_ERR_BAD_PIN; break;
|
case SW_CHV_WRONG: ec = GPG_ERR_BAD_PIN; break;
|
||||||
case SW_CHV_BLOCKED: ec = GPG_ERR_PIN_BLOCKED; break;
|
case SW_CHV_BLOCKED: ec = GPG_ERR_PIN_BLOCKED; break;
|
||||||
case SW_USE_CONDITIONS: ec = GPG_ERR_USE_CONDITIONS; break;
|
case SW_USE_CONDITIONS: ec = GPG_ERR_USE_CONDITIONS; break;
|
||||||
|
case SW_NO_CURRENT_EF: ec = GPG_ERR_ENOENT; break;
|
||||||
case SW_NOT_SUPPORTED: ec = GPG_ERR_NOT_SUPPORTED; break;
|
case SW_NOT_SUPPORTED: ec = GPG_ERR_NOT_SUPPORTED; break;
|
||||||
case SW_BAD_PARAMETER: ec = GPG_ERR_INV_VALUE; break;
|
case SW_BAD_PARAMETER: ec = GPG_ERR_INV_VALUE; break;
|
||||||
case SW_FILE_NOT_FOUND: ec = GPG_ERR_ENOENT; break;
|
case SW_FILE_NOT_FOUND: ec = GPG_ERR_ENOENT; break;
|
||||||
@ -185,27 +186,32 @@ iso7816_select_file (int slot, int tag, int is_dir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Do a select file command with a direct path. If FROM_CDF is set
|
/* Do a select file command with a direct path. If TOPDF is set, the
|
||||||
* the starting point is the current direcory file (feature depends on
|
* actual used path is 3f00/<topdf>/<path>. */
|
||||||
* the card). */
|
|
||||||
gpg_error_t
|
gpg_error_t
|
||||||
iso7816_select_path (int slot, const unsigned short *path, size_t pathlen,
|
iso7816_select_path (int slot, const unsigned short *path, size_t pathlen,
|
||||||
int from_cdf)
|
unsigned short topdf)
|
||||||
{
|
{
|
||||||
int sw, p0, p1;
|
int sw, p0, p1;
|
||||||
unsigned char buffer[100];
|
unsigned char buffer[100];
|
||||||
int buflen;
|
int buflen = 0;
|
||||||
|
|
||||||
if (pathlen/2 >= sizeof buffer)
|
if (pathlen*2 + 2 >= sizeof buffer)
|
||||||
return gpg_error (GPG_ERR_TOO_LARGE);
|
return gpg_error (GPG_ERR_TOO_LARGE);
|
||||||
|
|
||||||
for (buflen = 0; pathlen; pathlen--, path++)
|
if (topdf)
|
||||||
|
{
|
||||||
|
buffer[buflen++] = topdf >> 8;
|
||||||
|
buffer[buflen++] = topdf;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; pathlen; pathlen--, path++)
|
||||||
{
|
{
|
||||||
buffer[buflen++] = (*path >> 8);
|
buffer[buflen++] = (*path >> 8);
|
||||||
buffer[buflen++] = *path;
|
buffer[buflen++] = *path;
|
||||||
}
|
}
|
||||||
|
|
||||||
p0 = from_cdf? 0x09 : 0x08;
|
p0 = 0x08;
|
||||||
p1 = 0x0c; /* No FC return. */
|
p1 = 0x0c; /* No FC return. */
|
||||||
sw = apdu_send_simple (slot, 0, 0x00, CMD_SELECT_FILE,
|
sw = apdu_send_simple (slot, 0, 0x00, CMD_SELECT_FILE,
|
||||||
p0, p1, buflen, (char*)buffer );
|
p0, p1, buflen, (char*)buffer );
|
||||||
|
@ -69,7 +69,7 @@ gpg_error_t iso7816_select_mf (int slot);
|
|||||||
gpg_error_t iso7816_select_file (int slot, int tag, int is_dir);
|
gpg_error_t iso7816_select_file (int slot, int tag, int is_dir);
|
||||||
gpg_error_t iso7816_select_path (int slot,
|
gpg_error_t iso7816_select_path (int slot,
|
||||||
const unsigned short *path, size_t pathlen,
|
const unsigned short *path, size_t pathlen,
|
||||||
int from_cdf);
|
unsigned short topdf);
|
||||||
gpg_error_t iso7816_list_directory (int slot, int list_dirs,
|
gpg_error_t iso7816_list_directory (int slot, int list_dirs,
|
||||||
unsigned char **result, size_t *resultlen);
|
unsigned char **result, size_t *resultlen);
|
||||||
gpg_error_t iso7816_send_apdu (int slot, int extended_mode,
|
gpg_error_t iso7816_send_apdu (int slot, int extended_mode,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user