# Towards a Provably Secure Authentication Protocol for Fog-Driven IoT-Based Systems
## 2 Complexity Assumptions
### Login and Authentication Phase  
This phase of proposed protocol finishes with the below-mentioned subsections taken by all the participants:  
Step#1 **Login:**  
\(\mathcal{U}_{k}\) inputs its identity and computes \((Y_{k}\|r_{k})=\overline{Y_{k}}\oplus ID_{k}\), \(RID_{k}=h(ID_{k}\oplus r_{k})\), \(X^{\prime}_{k}=Y_{k}\oplus RID_{k}\). After that, \(\mathcal{U}_{k}\) verifies \(Z_{k}\stackrel{{?}}{{=}}h(X^{\prime}_{k}\|ID_{k}\|TID_{k}\|RID_{k})\). If the condition is true, \(\mathcal{U}_{k}\) generates arbitrary numbers \(r_{3}\), \(r_{4}\) and calculates \(M_{1}=(r_{3}\|r4)\oplus X^{\prime}_{k}\), \(auth_{k}=h(ID_{k}\|ID_{csp}\|X_{k}\|r_{4})\) and forwards the login request message \(\{M_{1},TID_{k},auth_{k}\}\) towards \(\mathcal{FN}_{f}\). Otherwise, the login request by \(\mathcal{U}_{k}\) is rejected. \(\mathcal{U}_{k}\rightarrow\mathcal{FN}_{f}:\{M_{1},TID_{k},auth_{k}\}\). Step#2 **Login:**  
After receiving the authentication request from \(\mathcal{U}_{k}\), \(\mathcal{FN}_{f}\) generates an arbitrary numbers \(r_{5}\), \(r_{6}\) and computes \(X^{\prime}_{f}=ID_{f}\oplus Y_{f}\), \(M_{2}=(r_{5}\|r_{6})\oplus X^{\prime}_{f}\), \(auth_{f}=h(ID_{f}\|ID_{csp}\|X^{\prime}_{f}\|r_{6})\). \(\mathcal{FN}_{f}\) forwards \(\{M_{1},M_{2},TID_{k},TID_{f},auth_{k},auth_{f}\}\) to the \(\mathcal{CSP}\). \(\mathcal{FN}_{f}\rightarrow\mathcal{CSP}:\{M_{1},M_{2},TID_{k},TID_{f},auth_{ k},auth_{f}\}\). Step#3 **Authentication & Key Establishment:**  
After receiving the authentication request message from \(\mathcal{FN}_{f}\), \(\mathcal{CSP}\) extracts user's \(ID_{k}\) corresponding to \(TID_{k}\) from its database using \(x\), and determines \(X_{k}=h(ID_{x}\|x)\), \((r_{3}\|r_{4})=X_{k}\oplus M_{1}\). For authenticating the user, \(\mathcal{CSP}\) verifies \(auth_{k}\stackrel{{?}}{{=}}h(ID_{k}\|ID_{csp}\|X_{k}\|r_{4})\). If the condition is false, the current session will be ended. Otherwise, \(\mathcal{CSP}\) extracts fog-node \(ID_{f}\) corresponding to \(TID_{f}\) from its database using \(x\), and determines \(X_{f}=h(ID_{f}\|x)\), \((r_{5}\|r_{6})=X_{f}\oplus M_{2}\). Now, for authenticating the fog-node, \(\mathcal{CSP}\) verifies \(auth_{f}\stackrel{{?}}{{=}}h(ID_{f}\|ID_{csp}\|X_{f}\|r_{6})\). If this condition is wrong, the session will be aborted. Once the aforementioned conditions are true, \(\mathcal{CSP}\) then generates an arbitrary number \(r_{7}\in Z^{*}_{p}\) and computes \(N_{1}=r_{3}\oplus(r_{5}\|r_{7})\), \(N_{2}=r_{5}\oplus(r_{3}\|r_{7})\), \(SK_{k-f-csp}=h((r_{3}\oplus r_{5}\oplus r_{7})\|N_{1}\|ID_{csp})\), \(auth_{csp1}=h(ID_{k}\|ID_{csp}\|X_{k}\|SK_{k-f-csp}\|r_{4}\|r_{7})\) \(auth_{csp2}=h(ID_{f}\|ID_{csp}\|X_{k-f-csp}\|r_{6}\|r_{7})\). Furthermore, \(\mathcal{CSP}\) selects \(TID^{new}_{k}\) for the user and \(TID^{new}_{f}\) for the fog-node and computes \(Q_{k}=r_{4}\oplus TID^{new}_{k}\), \(Q_{f}=r_{6}\oplus TID^{new}_{f}\) and updates the value of \(TID^{new}_{k}\) and \(TID^{new}_{f}\) for the user and the fog-node in its database and transmits the response message \(\left\{N_{1},N_{2},Q_{k},Q_{f},auth_{csp1},auth_{csp2}\right\}\) to the \(\mathcal{FN}_{f}\). \(\mathcal{CSP}\rightarrow\mathcal{FN}_{f}:\{N_{1},N_{2},Q_{k},Q_{f},auth_{csp1}, auth_{csp2}\}\). Step#4 **Key Establishment:**  
On receiving the response message from \(\mathcal{CSP}\), \(\mathcal{FN}_{f}\) computes \((r_{3}\|r_{7})=N_{2}\oplus r_{5}\), \(SK_{k-f-csp}=h((r_{3}\oplus r_{5}\oplus r_{7})\|N_{1}\|ID_{csp})\). Furthermore, \(\mathcal{FN}_{f}\) authenticates \(\mathcal{CSP}\) by verifying \(auth^{\prime}_{csp2}\stackrel{{? }}{{=}}h(ID_{f}\|ID_{csp}\|X_{f}\| SK_{k-f-csp}\|r_{6}\|r_{7})\). If this condition is wrong, the current session will be ended. Otherwise, it will calculate \(TID^{new}_{f}=Q_{f}\oplus r_{6}\) and update the value of \(TID^{New}_{k}\) in the tamper-proof device \(\mathcal{TPD}_{k}\) of the fog-node and relays \(\{N_{1},Q_{k},auth_{csp1}\}\) to \(\mathcal{U}_{k}\). \(\mathcal{FN}_{f}\rightarrow\mathcal{U}_{k}:\{N_{1},Q_{k},auth_{csp1}\}\).