diff --git a/Applet/src/com/android/javacard/keymaster/KMKeymintDataStore.java b/Applet/src/com/android/javacard/keymaster/KMKeymintDataStore.java index 34a477c7..0d50284f 100644 --- a/Applet/src/com/android/javacard/keymaster/KMKeymintDataStore.java +++ b/Applet/src/com/android/javacard/keymaster/KMKeymintDataStore.java @@ -788,6 +788,9 @@ public void persistOEMRootPublicKey(byte[] inBuff, short inOffset, short inLengt if (inLength != 65) { KMException.throwIt(KMError.INVALID_INPUT_LENGTH); } + if(oemRootPublicKey == null) { + oemRootPublicKey = new byte[65]; + } Util.arrayCopy(inBuff, inOffset, oemRootPublicKey, (short) 0, inLength); } diff --git a/Applet/src/com/android/javacard/keymaster/RemotelyProvisionedComponentDevice.java b/Applet/src/com/android/javacard/keymaster/RemotelyProvisionedComponentDevice.java index 10304cab..282a480b 100644 --- a/Applet/src/com/android/javacard/keymaster/RemotelyProvisionedComponentDevice.java +++ b/Applet/src/com/android/javacard/keymaster/RemotelyProvisionedComponentDevice.java @@ -437,9 +437,9 @@ public void processFinishSendData(APDU apdu) throws Exception { ISOException.throwIt(ISO7816.SW_CONDITIONS_NOT_SATISFIED); } // PubKeysToSignMac - byte[] empty = {}; + short empty = repository.alloc((short)0) ; short len = - ((KMOperation) operation[0]).sign(empty, (short) 0, + ((KMOperation) operation[0]).sign(repository.getHeap(), (short) empty, (short) 0, scratchPad, (short) 0); // release operation releaseOperation(); @@ -561,9 +561,9 @@ private boolean isAdditionalCertificateChainPresent() { private short processFinalData(byte[] scratchPad) { // Call finish on AES GCM Cipher - byte[] empty = {}; + short empty = repository.alloc((short)0) ; short len = - ((KMOperation) operation[0]).finish(empty, (short) 0, (short) 0, scratchPad, (short) 0); + ((KMOperation) operation[0]).finish(repository.getHeap(), (short) empty, (short) 0, scratchPad, (short) 0); return len; } @@ -848,7 +848,7 @@ private KMDeviceUniqueKeyPair createDeviceUniqueKeyPair(boolean testMode, byte[] */ private short createDeviceInfo(byte[] scratchpad) { // Device Info Key Value pairs. - for (short i = 0; i < 30; i++) { + for (short i = 0; i < 32; i++) { rkpTmpVariables[i] = KMType.INVALID_VALUE; } short dataOffset = 2;