pcsc-relay: fixed handling ATR for vpcd emulator
This commit is contained in:
@@ -20,8 +20,4 @@
|
||||
<aid-filter android:name="@string/aid_isoapplet"/>
|
||||
</aid-group>
|
||||
|
||||
<aid-group android:description="@string/applet_paccess" android:category="other">
|
||||
<aid-filter android:name="@string/aid_paccess"/>
|
||||
</aid-group>
|
||||
|
||||
</host-apdu-service>
|
||||
|
||||
@@ -90,14 +90,14 @@ static int vicc_receive_capdu(driver_data_t *driver_data,
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (size == 1) {
|
||||
if (size == VPCD_CTRL_LEN) {
|
||||
switch (*capdu[0]) {
|
||||
case 0x00:
|
||||
case 0x01:
|
||||
case 0x02:
|
||||
case VPCD_CTRL_OFF:
|
||||
case VPCD_CTRL_ON:
|
||||
case VPCD_CTRL_RESET:
|
||||
// ignore reset, power on, power off
|
||||
break;
|
||||
case 0x03:
|
||||
case VPCD_CTRL_ATR:
|
||||
if (vicc_transmit(ctx, sizeof atr, atr, NULL) < 0) {
|
||||
RELAY_ERROR("could not send ATR\n");
|
||||
goto err;
|
||||
|
||||
@@ -51,13 +51,6 @@ typedef WORD uint16_t;
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define VPCD_CTRL_LEN 1
|
||||
|
||||
#define VPCD_CTRL_OFF 0
|
||||
#define VPCD_CTRL_ON 1
|
||||
#define VPCD_CTRL_RESET 2
|
||||
#define VPCD_CTRL_ATR 4
|
||||
|
||||
static ssize_t sendToVICC(struct vicc_ctx *ctx, size_t size, const unsigned char *buffer);
|
||||
static ssize_t recvFromVICC(struct vicc_ctx *ctx, unsigned char **buffer);
|
||||
|
||||
|
||||
@@ -26,6 +26,13 @@ typedef int ssize_t;
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#define VPCD_CTRL_LEN 1
|
||||
|
||||
#define VPCD_CTRL_OFF 0
|
||||
#define VPCD_CTRL_ON 1
|
||||
#define VPCD_CTRL_RESET 2
|
||||
#define VPCD_CTRL_ATR 4
|
||||
|
||||
struct vicc_ctx {
|
||||
int server_sock;
|
||||
int client_sock;
|
||||
|
||||
Reference in New Issue
Block a user