mirror of
https://github.com/brmlab/timingattack.git
synced 2025-06-10 01:54:00 +02:00
Log some shits.
This commit is contained in:
parent
3974f61003
commit
de28e95a26
1 changed files with 8 additions and 4 deletions
|
@ -99,13 +99,17 @@ public class HmacKey extends KeyczarKey {
|
||||||
private Mac hmac;
|
private Mac hmac;
|
||||||
private long milis = 0;
|
private long milis = 0;
|
||||||
private int nanos = 0;
|
private int nanos = 0;
|
||||||
|
private boolean delay = false;
|
||||||
|
|
||||||
public HmacStream() throws KeyczarException {
|
public HmacStream() throws KeyczarException {
|
||||||
|
|
||||||
if ((System.getProperty("millis") != null) && (System.getProperty("nanos") != null)) {
|
if ((System.getProperty("milis") != null) && (System.getProperty("nanos") != null)) {
|
||||||
this.milis = Long.parseLong(System.getProperty("millis"));
|
this.milis = Long.parseLong(System.getProperty("milis"));
|
||||||
this.nanos = Integer.parseInt(System.getProperty("nanos"));
|
this.nanos = Integer.parseInt(System.getProperty("nanos"));
|
||||||
|
if (milis != 0 && nanos != 0) delay = true;
|
||||||
}
|
}
|
||||||
|
if (delay) System.out.println("Delay setting: milis="+milis+", nanos="+nanos);
|
||||||
|
else System.out.println("Delay setting: none");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
hmac = Mac.getInstance(MAC_ALGORITHM);
|
hmac = Mac.getInstance(MAC_ALGORITHM);
|
||||||
|
@ -154,7 +158,7 @@ public class HmacKey extends KeyczarKey {
|
||||||
if (macResult[pos] != sigBytes[pos]) {
|
if (macResult[pos] != sigBytes[pos]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((milis!=0) || (nanos!=0)) {
|
if (delay) {
|
||||||
try { Thread.sleep(milis, nanos); } catch (InterruptedException e) {}
|
try { Thread.sleep(milis, nanos); } catch (InterruptedException e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue