Skip to content
This repository was archived by the owner on May 24, 2026. It is now read-only.
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
2,970 changes: 2,970 additions & 0 deletions Applet/JCardSimProvider/test/com/android/javacard/test/KMFunctionalTest.java

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1,103 changes: 1,103 additions & 0 deletions Applet/JCardSimProvider/test/com/android/javacard/test/KMTestUtils.java

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Applet/src/com/android/javacard/keymaster/KMArray.java
Original file line numberDiff line numberDiff line change
Expand Up@@ -50,7 +50,7 @@ private static KMArray proto(short ptr) {

public static short exp() {
short ptr = instance(ARRAY_TYPE, ARRAY_HEADER_SIZE);
Util.setShort(heap, (short) (ptr + TLV_HEADER_SIZE), (short) 0);
Util.setShort(heap, (short) (ptr + TLV_HEADER_SIZE), KMType.INVALID_VALUE);
Util.setShort(heap, (short) (ptr + TLV_HEADER_SIZE + 2), ANY_ARRAY_LENGTH);
return ptr;
}
Expand All@@ -64,7 +64,7 @@ public static short exp(short type) {

public static short instance(short length) {
short ptr = KMType.instance(ARRAY_TYPE, (short) (ARRAY_HEADER_SIZE + (length * 2)));
Util.setShort(heap, (short) (ptr + TLV_HEADER_SIZE), (short) 0);
Util.setShort(heap, (short) (ptr + TLV_HEADER_SIZE), KMType.INVALID_VALUE);
Util.setShort(heap, (short) (ptr + TLV_HEADER_SIZE + 2), length);
return ptr;
}
Expand Down
2 changes: 1 addition & 1 deletion Applet/src/com/android/javacard/keymaster/KMDecoder.java
Original file line numberDiff line numberDiff line change
Expand Up@@ -442,7 +442,7 @@ private short decodeArray(short exp) {
short type;
short obj;
// check whether array contains one type of objects or multiple types
if (KMArray.cast(exp).containedType() == 0) {// multiple types specified by expression.
if (KMArray.cast(exp).containedType() == KMType.INVALID_VALUE) {// multiple types specified by expression.
if (KMArray.cast(exp).length() != KMArray.ANY_ARRAY_LENGTH) {
if (KMArray.cast(exp).length() != payloadLength) {
ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);
Expand Down
2 changes: 1 addition & 1 deletion Applet/src/com/android/javacard/keymaster/KMError.java
Original file line numberDiff line numberDiff line change
Expand Up@@ -123,12 +123,12 @@ public static short translate(short err) {
case CRYPTO_INVALID_INIT:
case CRYPTO_UNINITIALIZED_KEY:
case GENERIC_UNKNOWN_ERROR:
case CMD_NOT_ALLOWED:
case UNKNOWN_ERROR:
return UNKNOWN_ERROR;
case CRYPTO_NO_SUCH_ALGORITHM:
return UNSUPPORTED_ALGORITHM;
case UNSUPPORTED_INSTRUCTION:
case CMD_NOT_ALLOWED:
case SW_WRONG_LENGTH:
return UNIMPLEMENTED;
}
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -119,6 +119,11 @@ public class KMKeymintDataStore implements KMUpgradable {
private KMRkpMacKey rkpMacKey;
private byte[] oemRootPublicKey;
private short provisionStatus;
private static KMKeymintDataStore kmDataStore;

public static KMKeymintDataStore instance() {
return kmDataStore;
}

public KMKeymintDataStore(KMSEProvider provider, KMRepository repo) {
seProvider = provider;
Expand All@@ -133,6 +138,7 @@ public KMKeymintDataStore(KMSEProvider provider, KMRepository repo) {
}
setDeviceLockPasswordOnly(false);
setDeviceLock(false);
kmDataStore = this;
}

private void initDataTable() {
Expand Down