From: rtrimana <rtrimana@uci.edu>
Date: Mon, 1 Aug 2016 16:04:16 +0000 (-0700)
Subject: Merging changes
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6ce410e7a90dbe8531857748499c9ea14a2bd97d;p=iotcloud.git

Merging changes
---

diff --git a/doc/iotcloud.tex b/doc/iotcloud.tex
index ad8f80a..c2b7de8 100644
--- a/doc/iotcloud.tex
+++ b/doc/iotcloud.tex
@@ -537,13 +537,13 @@ $\tuple{ck,\tuple{k, v}} \in KV_s \wedge
 \forall \tuple{ck_s,\tuple{k_s, v_s}} \in KV_s, k = k_s$ \\
 
 \begin{algorithmic}[1]
-\Function{PutKVPair}{$KV_s,\tuple{k_s,v_s}$}
-\State $\tuple{ck_s,\tuple{k_s,v_t}} \gets GetKV(KV_s,k_s)$
+\Function{PutKVPair}{$\tuple{k_s,v_s}$}
+\State $\tuple{ck_s,\tuple{k_s,v_t}} \gets GetKV(KV,k_s)$
 \If{$\tuple{ck_s,\tuple{k_s,v_t}} = \emptyset$}
-	\State $KV_s \gets KV_s \cup \{\tuple{ck_p, \tuple{k_s,v_s}}\}$
+	\State $KV \gets KV \cup \{\tuple{ck_p, \tuple{k_s,v_s}}\}$
 	\State $ck_p \gets ck_p + 1$
 \Else
-	\State $KV_s \gets (KV_s - \{\tuple{ck_s, \tuple{k_s,v_t}}\}) \cup 
+	\State $KV \gets (KV - \{\tuple{ck_s, \tuple{k_s,v_t}}\}) \cup 
 	\{\tuple{ck_s, \tuple{k_s,v_s}}\}$
 \EndIf
 \State \Return{$KV_s$}
@@ -596,19 +596,22 @@ $\tuple{ck,\tuple{k, v}} \in KV_s \wedge
 \end{algorithmic}
 
 \begin{algorithmic}[1]
-\Function{ReinsertLastSlot}{$need_s,sl_{s_{last}},max'_s$}
-\If{$need_s$}
-	\State $s_s \gets GetLastS(sl_{s_{last}})$
-	\State $sv_s \gets GetSV(sl_{s_{last}})$
-	\State $\tuple{stat_s,SL_s} \gets \Call{PutSlot}{s_s,sv_s,max'_s}$
-	\State $cr_s \gets \Call{HandleCollision}{\tuple{stat_s,SL_s}}$
-\EndIf
-\State \Return{$cr_s$}
+\Function{ReinsertLastSlot}{$MS_s,SK_s,sl_{s_{last}},max'_s,hmac_{p_s}$}
+\State $s_s \gets MaxLastSeqN(MS_s)$
+\State $sv_s \gets GetSV(sl_{s_{last}})$
+\State $Dat_s \gets Decrypt(SK,sv_s)$
+\State $DE_s \gets GetDatEnt(Dat_s)$
+\State $hmac_{c_s} \gets Hmac(DE_s,SK_s)$
+\State $Dat_s \gets CreateDat(s_s,id_{self},hmac_{p_s},DE_p,hmac_{c_s})$
+\State $hmac_{p_s} \gets hmac_{c_s}$
+\State $\tuple{stat_s,SL_s} \gets \Call{PutSlot}{s_s,sv_s,max'_s}$   
+\State $cr_s \gets \Call{HandleCollision}{\tuple{stat_s,SL_s}}$
+\State \Return{$\tuple{cr_s,hmac_{p_p}}$}
 \EndFunction
 \end{algorithmic}
 \note{Shouldn't this function do something pretty sophisticated about seeing what data we actually need to keep from the last slot and not just insert the entire thing?}
 
-\note{Probably best to just not call this function is $need_s$ is false and not pass in such parameters.  It makes it harder to read.}
+\note{Probably best to just not call this function if $need_s$ is false and not pass in such parameters.  It makes it harder to read.}
 
 
 \begin{algorithmic}[1]
@@ -664,7 +667,10 @@ $\tuple{ck,\tuple{k, v}} \in KV_s \wedge
 \State $sv_p \gets Encrypt(Dat_p,SK)$
 \State $\tuple{stat_p,SL_p} \gets \Call{PutSlot}{s_p,sv_p,max'_p}$
 \State $cr_p \gets \Call{HandleCollision}{\tuple{stat_p,SL_p}}$
-\State $cr_{p_{last}} \gets \Call{ReinsertLastSlot}{need_p,sl_{last},max'_p}$
+\If{$need_p$}
+	\State $\tuple{cr_{p_{last}},hmac_{p_p}} \gets 
+    	\Call{ReinsertLastSlot}{MS,SK,sl_{last},max'_p,hmac_{p_p}}$
+\EndIf
 \EndProcedure
 \end{algorithmic}