Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public void handleDeviceBooted() {
@Override
public void process(APDU apdu) {
try {
receiveLen[0] = apdu.setIncomingAndReceive();
handleDeviceBooted();
// If this is select applet apdu which is selecting this applet then return
if (apdu.isISOInterindustryCLA()) {
Expand Down Expand Up @@ -411,7 +412,7 @@ private void processProvisionRkpAdditionalCertChain(APDU apdu) {
// Store the cbor encoded UdsCerts as it is in the persistent memory so cbor decoding is
// required here.
byte[] srcBuffer = apdu.getBuffer();
short recvLen = apdu.setIncomingAndReceive();
short recvLen = receiveLen[0];
short srcOffset = apdu.getOffsetCdata();
short bufferLength = apdu.getIncomingLength();
short bufferStartOffset = repository.allocReclaimableMemory(bufferLength);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public void handleDeviceBooted() {
@Override
public void process(APDU apdu) {
try {
receiveLen[0] = apdu.setIncomingAndReceive();
handleDeviceBooted();
// If this is select applet apdu which is selecting this applet then return
if (apdu.isISOInterindustryCLA()) {
Expand Down Expand Up @@ -404,7 +405,7 @@ private void processProvisionRkpAdditionalCertChain(APDU apdu) {
// Store the cbor encoded UdsCerts as it is in the persistent memory so cbor decoding is
// required here.
byte[] srcBuffer = apdu.getBuffer();
short recvLen = apdu.setIncomingAndReceive();
short recvLen = receiveLen[0];
short srcOffset = apdu.getOffsetCdata();
short bufferLength = apdu.getIncomingLength();
short bufferStartOffset = repository.allocReclaimableMemory(bufferLength);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ public class KMKeymasterApplet extends Applet implements AppletEvent, ExtendedLe
protected static short[] tmpVariables;
protected static short[] data;
protected static byte[] wrappingKey;
protected static short[] receiveLen;


/**
* Registers this applet.
Expand All @@ -317,6 +319,7 @@ protected KMKeymasterApplet(KMSEProvider seImpl) {
tmpVariables =
JCSystem.makeTransientShortArray(TMP_VARIABLE_ARRAY_SIZE, JCSystem.CLEAR_ON_DESELECT);
wrappingKey = JCSystem.makeTransientByteArray((short)(WRAPPING_KEY_SIZE+1), JCSystem.CLEAR_ON_RESET);
receiveLen = JCSystem.makeTransientShortArray((short) 1, JCSystem.CLEAR_ON_RESET);
resetWrappingKey();
opTable = new KMOperationState[MAX_OPERATIONS_COUNT];
short index = 0;
Expand Down Expand Up @@ -906,7 +909,7 @@ public void sendOutgoing(APDU apdu, KMAttestationCert cert, short certStart, sho
*/
public static short receiveIncoming(APDU apdu, short reqExp) {
byte[] srcBuffer = apdu.getBuffer();
short recvLen = apdu.setIncomingAndReceive();
short recvLen = receiveLen[0];
short srcOffset = apdu.getOffsetCdata();
// TODO add logic to handle the extended length buffer. In this case the memory can be reused
// from extended buffer.
Expand Down