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