JavaCardOS/FluffyPGP-Applet

Ant build error

Aiosa opened this issue · 0 comments

Aiosa commented

When building with ant, I am getting an error (error: net.ss3t.javacard.gpg.Gpg: unsupported int type of intermediate value, must cast intermediate value to type short or byte.)

The cuprits are 4 lines in changeReferenceData() and resetRetryCounter() where a sum is not cast to a short.

Adding

if (apdu.setIncomingAndReceive() != length ||
    length > (short)(currentLength + MAX_PIN_LENGTH) ||
    length < (short)(currentLength + minLength)) {
  ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);
}

and

  }
  if (length < (short)(rcLength + MIN_PIN1_LENGTH) ||
      length > (short)(rcLength + MAX_PIN_LENGTH)) {
    ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);
  }

solves the problem.