Fix useless/misplaced short conversions
This commit is contained in:
parent
4796f6ea78
commit
79d9342827
@ -28,7 +28,7 @@ import javacardx.crypto.*;
|
|||||||
public final class Constants {
|
public final class Constants {
|
||||||
|
|
||||||
protected static final short INTERNAL_BUFFER_MAX_LENGTH =
|
protected static final short INTERNAL_BUFFER_MAX_LENGTH =
|
||||||
(short)((short)0x500);
|
(short)0x500;
|
||||||
|
|
||||||
protected static final short APDU_MAX_LENGTH = (short)256;
|
protected static final short APDU_MAX_LENGTH = (short)256;
|
||||||
|
|
||||||
@ -42,8 +42,8 @@ public final class Constants {
|
|||||||
protected static final byte USER_PIN_MIN_SIZE_FORMAT_2 = 6;
|
protected static final byte USER_PIN_MIN_SIZE_FORMAT_2 = 6;
|
||||||
protected static final byte USER_PIN_MAX_SIZE_FORMAT_2 = 12;
|
protected static final byte USER_PIN_MAX_SIZE_FORMAT_2 = 12;
|
||||||
protected static final byte[] USER_PIN_DEFAULT = {
|
protected static final byte[] USER_PIN_DEFAULT = {
|
||||||
(byte)0x31, (byte)0x32, (byte)0x33, (byte)0x34,
|
(byte)0x31, (byte)0x32, (byte)0x33, (byte)0x34,
|
||||||
(byte)0x35, (byte)0x36
|
(byte)0x35, (byte)0x36
|
||||||
};
|
};
|
||||||
protected static final boolean USER_PIN_DEFAULT_IS_FORMAT_2 = false;
|
protected static final boolean USER_PIN_DEFAULT_IS_FORMAT_2 = false;
|
||||||
/*
|
/*
|
||||||
@ -69,8 +69,8 @@ public final class Constants {
|
|||||||
protected static final byte ADMIN_PIN_MIN_SIZE_FORMAT_2 = 8;
|
protected static final byte ADMIN_PIN_MIN_SIZE_FORMAT_2 = 8;
|
||||||
protected static final byte ADMIN_PIN_MAX_SIZE_FORMAT_2 = 12;
|
protected static final byte ADMIN_PIN_MAX_SIZE_FORMAT_2 = 12;
|
||||||
protected static final byte[] ADMIN_PIN_DEFAULT = {
|
protected static final byte[] ADMIN_PIN_DEFAULT = {
|
||||||
(byte)0x31, (byte)0x32, (byte)0x33, (byte)0x34,
|
(byte)0x31, (byte)0x32, (byte)0x33, (byte)0x34,
|
||||||
(byte)0x35, (byte)0x36, (byte)0x37, (byte)0x38
|
(byte)0x35, (byte)0x36, (byte)0x37, (byte)0x38
|
||||||
};
|
};
|
||||||
protected static final boolean ADMIN_PIN_DEFAULT_IS_FORMAT_2 = false;
|
protected static final boolean ADMIN_PIN_DEFAULT_IS_FORMAT_2 = false;
|
||||||
/*
|
/*
|
||||||
|
@ -320,7 +320,7 @@ public final class PGPKey {
|
|||||||
off = Common.skipLength(buf, off, (short)(len - (short)(off - boff)));
|
off = Common.skipLength(buf, off, (short)(len - (short)(off - boff)));
|
||||||
template_off = off;
|
template_off = off;
|
||||||
|
|
||||||
if(template_len > (short)(len - ((short)off - boff))) {
|
if(template_len > (short)(len - (short)(off - boff))) {
|
||||||
ISOException.throwIt(ISO7816.SW_WRONG_DATA);
|
ISOException.throwIt(ISO7816.SW_WRONG_DATA);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -353,7 +353,7 @@ public final class PGPKey {
|
|||||||
off = Common.skipLength(buf, off, (short)(len - (short)(off - boff)));
|
off = Common.skipLength(buf, off, (short)(len - (short)(off - boff)));
|
||||||
data_off = off;
|
data_off = off;
|
||||||
|
|
||||||
if(data_len > (short)(len - ((short)off - boff))) {
|
if(data_len > (short)(len - (short)(off - boff))) {
|
||||||
ISOException.throwIt(ISO7816.SW_WRONG_DATA);
|
ISOException.throwIt(ISO7816.SW_WRONG_DATA);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -476,9 +476,9 @@ public final class PGPKey {
|
|||||||
cipher_rsa_pkcs1.init(priv, Cipher.MODE_ENCRYPT);
|
cipher_rsa_pkcs1.init(priv, Cipher.MODE_ENCRYPT);
|
||||||
|
|
||||||
off = cipher_rsa_pkcs1.doFinal(buf, (short)0, lc,
|
off = cipher_rsa_pkcs1.doFinal(buf, (short)0, lc,
|
||||||
buf, (short)lc);
|
buf, lc);
|
||||||
|
|
||||||
return Util.arrayCopyNonAtomic(buf, (short)lc,
|
return Util.arrayCopyNonAtomic(buf, lc,
|
||||||
buf, (short)0,
|
buf, (short)0,
|
||||||
off);
|
off);
|
||||||
|
|
||||||
@ -516,7 +516,7 @@ public final class PGPKey {
|
|||||||
cipher_rsa_pkcs1.init(priv, Cipher.MODE_DECRYPT);
|
cipher_rsa_pkcs1.init(priv, Cipher.MODE_DECRYPT);
|
||||||
|
|
||||||
final short len = cipher_rsa_pkcs1.doFinal(buf, (short)1, (short)(lc - 1),
|
final short len = cipher_rsa_pkcs1.doFinal(buf, (short)1, (short)(lc - 1),
|
||||||
buf, (short)lc);
|
buf, lc);
|
||||||
|
|
||||||
off = Util.arrayCopyNonAtomic(buf, lc,
|
off = Util.arrayCopyNonAtomic(buf, lc,
|
||||||
buf, (short)0,
|
buf, (short)0,
|
||||||
|
@ -291,7 +291,7 @@ public final class SmartPGPApplet extends Applet {
|
|||||||
|
|
||||||
case Constants.TAG_HISTORICAL_BYTES_CARD_SERVICE_CARD_CAPABILITIES:
|
case Constants.TAG_HISTORICAL_BYTES_CARD_SERVICE_CARD_CAPABILITIES:
|
||||||
off = Util.arrayCopyNonAtomic(Constants.HISTORICAL_BYTES, (short)0,
|
off = Util.arrayCopyNonAtomic(Constants.HISTORICAL_BYTES, (short)0,
|
||||||
buf, (short)off,
|
buf, off,
|
||||||
(byte)Constants.HISTORICAL_BYTES.length);
|
(byte)Constants.HISTORICAL_BYTES.length);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1090,17 +1090,17 @@ public final class SmartPGPApplet extends Applet {
|
|||||||
|
|
||||||
case Constants.TAG_GENERATION_DATE_SIG:
|
case Constants.TAG_GENERATION_DATE_SIG:
|
||||||
assertAdmin();
|
assertAdmin();
|
||||||
data.pgp_keys[Persistent.PGP_KEYS_OFFSET_SIG].setGenerationDate(buf, (short)0, (short)lc);
|
data.pgp_keys[Persistent.PGP_KEYS_OFFSET_SIG].setGenerationDate(buf, (short)0, lc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Constants.TAG_GENERATION_DATE_DEC:
|
case Constants.TAG_GENERATION_DATE_DEC:
|
||||||
assertAdmin();
|
assertAdmin();
|
||||||
data.pgp_keys[Persistent.PGP_KEYS_OFFSET_DEC].setGenerationDate(buf, (short)0, (short)lc);
|
data.pgp_keys[Persistent.PGP_KEYS_OFFSET_DEC].setGenerationDate(buf, (short)0, lc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Constants.TAG_GENERATION_DATE_AUT:
|
case Constants.TAG_GENERATION_DATE_AUT:
|
||||||
assertAdmin();
|
assertAdmin();
|
||||||
data.pgp_keys[Persistent.PGP_KEYS_OFFSET_AUT].setGenerationDate(buf, (short)0, (short)lc);
|
data.pgp_keys[Persistent.PGP_KEYS_OFFSET_AUT].setGenerationDate(buf, (short)0, lc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Constants.TAG_RESETTING_CODE:
|
case Constants.TAG_RESETTING_CODE:
|
||||||
|
Loading…
Reference in New Issue
Block a user