IV changes
authorAli Younis <ayounis@uci.edu>
Wed, 4 Oct 2017 20:16:21 +0000 (13:16 -0700)
committerAli Younis <ayounis@uci.edu>
Wed, 4 Oct 2017 20:16:21 +0000 (13:16 -0700)
version2/src/java/iotcloud/CloudComm.java
version2/src/java/iotcloud/Slot.java

index d0a514d..1b10efe 100644 (file)
@@ -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();
 
        }
index b881efe..153ef80 100644 (file)
@@ -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() + ">";
        }