Skip to content

Commit

Permalink
clear also some ram buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
bitgamma committed Jun 6, 2023
1 parent e79d84b commit 44adec5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/im/status/keycard/KeycardApplet.java
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,7 @@ private short logicrShift(short v, short amount) {
private void clearKeys() {
keyPathLen = 0;
pinlessPathLen = 0;
tmpPathLen = 0;
isExtended = false;
masterPrivate.clearKey();
masterPublic.clearKey();
Expand All @@ -1030,6 +1031,8 @@ private void clearKeys() {
Util.arrayFillNonAtomic(altChainCode, (short) 0, (short) altChainCode.length, (byte) 0);
Util.arrayFillNonAtomic(keyPath, (short) 0, (short) keyPath.length, (byte) 0);
Util.arrayFillNonAtomic(pinlessPath, (short) 0, (short) pinlessPath.length, (byte) 0);
Util.arrayFillNonAtomic(tmpPath, (short) 0, (short) tmpPath.length, (byte) 0);
Util.arrayFillNonAtomic(derivationOutput, (short) 0, (short) derivationOutput.length, (byte) 0);
Util.arrayFillNonAtomic(keyUID, (short) 0, (short) keyUID.length, (byte) 0);
}

Expand Down Expand Up @@ -1059,6 +1062,7 @@ private void factoryReset(APDU apdu) {

clearKeys();
pin = null;
mainPIN = null;
altPIN = null;
puk = null;
secureChannel = null;
Expand Down

0 comments on commit 44adec5

Please sign in to comment.