# FPGA Implementation of Mutual Authentication Protocol for Medication Security System
## 3 Medication Safety WSN Authentication Scheme
### Definition of the Proposed Medication Safety WSN Protocol  
As shown in Figures 1-3, the proposed protocol considers a multi-sensor node or gateway node environment as the network model where the participants in this model would be the users, with the hospital information system (HIS) and the pharmacy as the involved entities. We divided our scheme into three phases: registration phase, login/authentication phase, and password change phase. During this process, a genuine user produces their registration parameters over the network to the registration center (HIS), which is considered to be trusted. Successful registration of the user happens only after verification of the produced details. To access the information, the user produces their login credentials into the login/authentication phase. Then, the login request is received to verify the messages. In addition, a registered user executes the password change phase to update/modify their current password. In the beginning, the user sends a request to the HIS, two pairs of random numbers are generated, and these numbers are stored in the HIS. The details of the operation for each phase are explained below. Table 1 defines the nomenclature for the mutual authentication protocol. The first section is the registration phase, which includes 10 steps, as shown in Figure 1. \begin{table}
\begin{tabular}{c c} \hline \hline
**Symbol** & **Description** \\ \hline UserID & User identification \\ PWD & User password \\ RN & Random number \\ Rt\({}_{\text{R}}\), Rmx\({}_{\text{x}}\) & Random number \\ Padgen (0) & Coding function \\ In\({}_{\text{-CCPWx}}\) & Input cover coding password \\ In\({}_{\text{-CCMSg}}\), & Input cover coding message \\ Out\({}_{\text{-CCPWx}}\) & Output cover coding password \\ Out\({}_{\text{-CCMSg}}\), & Output cover coding message \\ Req & Request \\ PADx\({}_{\text{x}}\) & Encryption pad \\ CRC & Cyclic redundancy code \\ \(\oplus\) & XOR \\ \(\parallel\) & Concatenation \\ NPWD & New password \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Customized authentication WSN symbol definition table. Figure 1: Registration phase. The details of the operation are as follows:  
Step 1: UserID and ReqR are sent to HIS from User, generating two sets of random numbers {RT1, RM1}, {RT2, RM2}. Step 2: {RT1, RM1}, {RT2, RM2} random numbers are stored in HIS. Step 3: Two sets of random numbers {RT1, RM1}, {RT2, RM2} are sent to User party. Step 4: Same two sets of random numbers are sent to the Pharmacy party. Step 5: PAD1, PAD2, PAD3, and PAD4 are obtained by selecting UserID or PWD with the specific random numbers for Padgen function operation. Then, CCMsgx is computed, followed by CRC encoding. Step 6: CCPWD, CCMsgM1 \(\parallel\) CRC and CCMsgL1 \(\parallel\) CRC are sent to HIS. Step 7: PAD1 to PAD6 are produced by selecting UserID or PWD with the specific random numbers for Padgen function operation. Afterward, through XOR operation, MsgM, MsgL, PWD, Out_CCMsgM \(\parallel\) CRC, and out_CCMsgL \(\parallel\) CRC are obtained. Step 8: UserID, CCPWD, CCMsgM2 \(\parallel\) CRC, and CCMsgL2 \(\parallel\) CRC are sent to Pharmacy party. Step 9: PAD1, PAD2, PAD5, and PAD6 are obtained by selecting UserID or PWD with the specific random numbers for Padgen function operation. Then PWD, MsgM, and MsgL are computed through XOR operation. Step 10: At last, a successful Req signal is sent to HIS, indicating completion of the phase. The second section is the login/authentication phase, which includes 11 steps, as shown in Figure 2.  
The details of the operation are as follows:  
Step 1: UserID* and PWD* are entered by the User and sent to the Pharmacy party. Step 2: Pharmacy identifies UserID* and PWD* for matching saved data. Step 3: Reg is sent to HIS from Pharmacy. Step 4: HIS generates a set of random numbers {RT3, RM3}. Step 5: A set of random numbers {RT3, RM3} is sent to Pharmacy. Step 6: A set of random numbers {RT3, RM3} is sent to the User.