Lines Matching refs:cmdApdu
34 int CommandApdu_toByteArray(CommandApdu cmdApdu, char* commandApduArray) { in CommandApdu_toByteArray() argument
35 int commandApduArraySize = CommandApdu_getSize(cmdApdu); in CommandApdu_toByteArray()
37 if (cmdApdu.lc > MAX_CMD_APDU_DATA_LENGTH) { in CommandApdu_toByteArray()
41 commandApduArray[0] = cmdApdu.cla; in CommandApdu_toByteArray()
42 commandApduArray[1] = cmdApdu.ins; in CommandApdu_toByteArray()
43 commandApduArray[2] = cmdApdu.p1; in CommandApdu_toByteArray()
44 commandApduArray[3] = cmdApdu.p2; in CommandApdu_toByteArray()
46 if (cmdApdu.lc > 0) { in CommandApdu_toByteArray()
47 commandApduArray[4] = cmdApdu.lc; in CommandApdu_toByteArray()
48 memcpy(commandApduArray + 5, cmdApdu.data, cmdApdu.lc); in CommandApdu_toByteArray()
51 if (cmdApdu.le >= 0) { in CommandApdu_toByteArray()
52 commandApduArray[commandApduArraySize - 1] = cmdApdu.le; in CommandApdu_toByteArray()
69 int CommandApdu_getSize(CommandApdu cmdApdu) { in CommandApdu_getSize() argument
73 if (cmdApdu.lc > 0) { in CommandApdu_getSize()
75 size += 1 + cmdApdu.lc; in CommandApdu_getSize()
78 if (cmdApdu.le >= 0) { in CommandApdu_getSize()
97 char* cmdData, char le, CommandApdu* cmdApdu) { in CommandApdu_formApduType4() argument
102 cmdApdu->cla = cla; in CommandApdu_formApduType4()
103 cmdApdu->ins = ins; in CommandApdu_formApduType4()
104 cmdApdu->p1 = p1; in CommandApdu_formApduType4()
105 cmdApdu->p2 = p2; in CommandApdu_formApduType4()
106 cmdApdu->lc = lc; in CommandApdu_formApduType4()
108 memcpy(cmdApdu->data, cmdData, lc); in CommandApdu_formApduType4()
110 cmdApdu->le = le; in CommandApdu_formApduType4()
112 return CommandApdu_getSize(*cmdApdu); in CommandApdu_formApduType4()
127 CommandApdu* cmdApdu) { in CommandApdu_formApduType2() argument
128 cmdApdu->cla = cla; in CommandApdu_formApduType2()
129 cmdApdu->ins = ins; in CommandApdu_formApduType2()
130 cmdApdu->p1 = p1; in CommandApdu_formApduType2()
131 cmdApdu->p2 = p2; in CommandApdu_formApduType2()
132 cmdApdu->le = le; in CommandApdu_formApduType2()
133 cmdApdu->lc = 0; in CommandApdu_formApduType2()
135 return CommandApdu_getSize(*cmdApdu); in CommandApdu_formApduType2()