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

This file was deleted.

This file was deleted.

This file was deleted.

5 changes: 3 additions & 2 deletions Applet/Applet/src/com/android/javacard/keymaster/KMArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.android.javacard.keymaster;

import javacard.framework.ISO7816;
import javacard.framework.ISOException;

public class KMArray extends KMType {
private KMType[] vals;
Expand Down Expand Up @@ -67,15 +68,15 @@ public KMArray withLength(short length) {

public KMArray add(short index, KMType val) {
if (index >= length) {
throw new KMException(ISO7816.SW_WRONG_LENGTH);
ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);
}
vals[(short) (startOff + index)] = val;
return this;
}

public KMType get(short index) {
if (index >= length) {
throw new KMException(ISO7816.SW_WRONG_LENGTH);
ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);
}
return vals[(short) (startOff + index)];
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.android.javacard.keymaster;

import javacard.framework.ISO7816;
import javacard.framework.ISOException;

public class KMBoolTag extends KMTag {

Expand Down Expand Up @@ -81,7 +82,7 @@ public byte getVal() {
// create default assignBlob without any value
public static KMBoolTag instance(short key) {
if (!validateKey(key)) {
throw new KMException(ISO7816.SW_DATA_INVALID);
ISOException.throwIt(ISO7816.SW_DATA_INVALID);
}
KMBoolTag tag = repository.newBoolTag();
tag.key = key;
Expand Down
13 changes: 7 additions & 6 deletions Applet/Applet/src/com/android/javacard/keymaster/KMByteBlob.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.android.javacard.keymaster;

import javacard.framework.ISO7816;
import javacard.framework.ISOException;
import javacard.framework.Util;

// Byte val represents contiguous memory buffer.
Expand Down Expand Up @@ -48,7 +49,7 @@ public static KMByteBlob instance() {
// copy the blob
public static KMByteBlob instance(byte[] blob, short startOff, short length) {
if ((length <= 0) || ((short)(startOff+length) > blob.length)) {
throw new KMException(ISO7816.SW_WRONG_LENGTH);
ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);
}
KMByteBlob inst = instance(length);
Util.arrayCopyNonAtomic(blob, startOff, inst.val, inst.startOff, inst.length);
Expand All @@ -58,7 +59,7 @@ public static KMByteBlob instance(byte[] blob, short startOff, short length) {
// returns empty blob with given length
public static KMByteBlob instance(short length) {
if (length <= 0) {
throw new KMException(ISO7816.SW_WRONG_LENGTH);
ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);
}
KMByteBlob inst = instance();
inst.startOff = repository.newByteArray(length);
Expand All @@ -83,20 +84,20 @@ public KMByteBlob withLength(short len) {

public void add(short index, byte val) {
if (index >= this.length) {
throw new KMException(ISO7816.SW_WRONG_LENGTH);
ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);
}
if (this.val == null) {
throw new KMException(ISO7816.SW_DATA_INVALID);
ISOException.throwIt(ISO7816.SW_DATA_INVALID);
}
this.val[(short) (startOff + index)] = val;
}

public byte get(short index) {
if (index >= this.length) {
throw new KMException(ISO7816.SW_WRONG_LENGTH);
ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);
}
if (this.val == null) {
throw new KMException(ISO7816.SW_DATA_INVALID);
ISOException.throwIt(ISO7816.SW_DATA_INVALID);
}
return this.val[(short) (startOff + index)];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.android.javacard.keymaster;

import javacard.framework.ISO7816;
import javacard.framework.ISOException;

public class KMByteTag extends KMTag {

Expand Down Expand Up @@ -74,7 +75,7 @@ public static KMByteTag instance() {

public static KMByteTag instance(short key) {
if (!validateKey(key)) {
throw new KMException(ISO7816.SW_DATA_INVALID);
ISOException.throwIt(ISO7816.SW_DATA_INVALID);
}
KMByteTag tag = repository.newByteTag();
tag.key = key;
Expand All @@ -93,7 +94,7 @@ public static void create(KMByteTag[] byteTagRefTable) {
// create default assignBlob without any value
public static KMByteTag instance(short key, KMByteBlob array) {
if (!validateKey(key)) {
throw new KMException(ISO7816.SW_DATA_INVALID);
ISOException.throwIt(ISO7816.SW_DATA_INVALID);
}
KMByteTag tag = repository.newByteTag();
tag.key = key;
Expand Down
Loading