apdu format and print works
This commit is contained in:
@@ -317,7 +317,7 @@ const char *GetAPDUCodeDescription(uint8_t sw1, uint8_t sw2) {
|
||||
return APDUCodeTable[0].Description; //empty string
|
||||
}
|
||||
|
||||
int APDUDecode(uint8_t *data, size_t len, APDUStruct *apdu) {
|
||||
int APDUDecode(uint8_t *data, int len, APDUStruct *apdu) {
|
||||
ExtAPDUHeader *hapdu = (ExtAPDUHeader *)data;
|
||||
|
||||
apdu->cla = hapdu->cla;
|
||||
@@ -417,11 +417,11 @@ int APDUDecode(uint8_t *data, size_t len, APDUStruct *apdu) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APDUEncode(APDUStruct *apdu, uint8_t *data, size_t *len) {
|
||||
int APDUEncode(APDUStruct *apdu, uint8_t *data, int *len) {
|
||||
if (len)
|
||||
*len = 0;
|
||||
|
||||
if (apdu->le > 0x10000 || apdu->lc != 0xffff)
|
||||
if (apdu->le > 0x10000 || apdu->lc > 0xffff)
|
||||
return 1;
|
||||
|
||||
size_t dptr = 0;
|
||||
|
||||
@@ -52,8 +52,8 @@ typedef struct {
|
||||
uint8_t case_type;
|
||||
} __attribute__((packed)) APDUStruct;
|
||||
|
||||
extern int APDUDecode(uint8_t *data, size_t len, APDUStruct *apdu);
|
||||
extern int APDUEncode(APDUStruct *apdu, uint8_t *data, size_t *len);
|
||||
extern int APDUDecode(uint8_t *data, int len, APDUStruct *apdu);
|
||||
extern int APDUEncode(APDUStruct *apdu, uint8_t *data, int *len);
|
||||
extern void APDUPrint(APDUStruct apdu);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user