Skip to main content
. 2014 Mar 11;14(3):5004–5040. doi: 10.3390/s140305004

Algorithm 2 Dissemination of the code update, including the Data Verification (DV) and Hash Verification (HV) Methods).

1: Base Station:
2:
INPPP×|H(.)|B|MACSK(.)|
3: T ⇐ (p, a, b, G, n, h) elliptic curve domain parameters
4: dS ⇐ random integer number (1 < dS < n − 1)
5: N0 ⇐ 160–bit random number
6: QSdSG
7: VnVersion number
8: Sign Vn, I, N0, QS using GKPri
9: Send SignGKPri({Vn, I, N0, QS}) to node
10: Node:
11: (I, Vn, N0, QS) ⇐ VerifyGKpub (SignGKPri({Vn, I, N0, QS}))
12: if Vnprevious Vn then
13:  Notify BS of an ongoing replay attack.
14:  Halt dissemination protocol for a pre-configured time.
15:  Exit
16: end if
17: previous VnVn
18: dN ⇐ random integer number (1 < dN < n − 1)
19: QNdNG
20: SKH80(dNQS)
21: Free memory reserved by dN, QS
22: N1 ⇐ 160 – bit random number
23: Execute Algorithm 3 (Input: N1) {Optional}
24: Send {QN,EncSK80(N1),MACSK160(QNN0)} to BS
25: Base Station:
26:
Pkt{QN,EncSK80(N1),MACSK160(QNN0)}
27: SKH80(dSQN)
28: MSGPkt[0] ⨁ N0 {Pkt[0] = QN}
29: generated
MACMACSK160(MSG)
30: if generated MAC <> Pkt[2] then
31:  Exit.
32: end if
33:
N1DecSK80(EncSK80(N1))
34: Execute Algorithm 3(Input: N1) {Optional}
35: Encrypt update image with SK
36: Fragment encrypted data as shown in Figure 4
37: for all Pkt0,i in Page0 do
38:  Send {EncSK80(Pkt0,i),MACSK160(EncSK80(Pkt0,i))} to the node
39: end for
40: Node:
41: Free memory reserved by QN
42: while Receives {EncSK80(Pkt0,i),MACSK160(EncSK80(Pkt0,i))} do
43: new MACcalculate MAC of encrypted Pkt0,i
44: if new MAC<>MACSK160(EncSK80(Pkt0,i)) then
45:   Drop packet
46: end if
47: Pkt0,iDecSK80(EncSK80(Pkt0,i))
48:  Store Pkt0,i
49: end while