apdu format and print works

This commit is contained in:
merlokk committed 2019-07-15 17:26:42 +03:00
1 parent a9d15d85e6
commit df1dd71d14
3 files changed
+18 -12

No files matched your search

+3 -3
View File
@@ -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;
+2 -2
View File
@@ -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