From: Ali Younis Date: Wed, 4 Oct 2017 20:16:21 +0000 (-0700) Subject: IV changes X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5e1abb1cc753f2e8d65e862a6c2325fcb551cb8e;p=iotcloud.git IV changes --- diff --git a/version2/src/java/iotcloud/CloudComm.java b/version2/src/java/iotcloud/CloudComm.java index d0a514d..1b10efe 100644 --- a/version2/src/java/iotcloud/CloudComm.java +++ b/version2/src/java/iotcloud/CloudComm.java @@ -247,7 +247,8 @@ class CloudComm { private byte[] createIV(long machineId, long localSequenceNumber) { ByteBuffer buffer = ByteBuffer.allocate(IV_SIZE); buffer.putLong(machineId); - buffer.putLong(localSequenceNumber); + long localSequenceNumberShifted = localSequenceNumber << 16; + buffer.putLong(localSequenceNumberShifted); return buffer.array(); } diff --git a/version2/src/java/iotcloud/Slot.java b/version2/src/java/iotcloud/Slot.java index b881efe..153ef80 100644 --- a/version2/src/java/iotcloud/Slot.java +++ b/version2/src/java/iotcloud/Slot.java @@ -222,11 +222,11 @@ class Slot implements Liveness { public byte[] getSlotCryptIV() { ByteBuffer buffer = ByteBuffer.allocate(CloudComm.IV_SIZE); buffer.putLong(machineid); - buffer.putLong(localSequenceNumber); + long localSequenceNumberShift = localSequenceNumber << 16; + buffer.putLong(localSequenceNumberShift); return buffer.array(); } - public String toString() { return "<" + getSequenceNumber() + ">"; }