# Security Threats and Cryptographic Protocols for Medical Wearables
## 4 Cryptographic Protocols to Secure Medical Devices
The Mirai botnet attacked many IoT devices in 2016 and caused several damage to smart devices since infected devices were used as a launch platform for DDoS attacks [80; 81]. The Ascon AEAD scheme can mitigate such vulnerabilities by improving throughput and security with a field-programmable gate array platform, which provides higher speed, lower cost, faster development time, flexibility and configurability [82]. This improvement prevents attacks and secure the hardware from attacks [83]. In Ascon cipher suite, the authenticated encryption algorithm, \(\mathcal{E}\), and the decryption algorithm, \(\mathcal{D}\), are parameterized by the rate (data block size) \(r\), two internal round numbers, \(a\) and \(b\), and the key length, \(k\). The inputs are a \(k\)-bits secret key \(K\), a nonce (public message number) \(N\) with 128 bits, associated data \(A\) of arbitrary length, and a plaintext \(M\) of arbitrary length, the authenticated encryption procedure output is  
\[ \begin{array}{l}\mathcal{E}:\mathcal{K}\times\mathcal{N}\times\mathcal{A} \times\mathcal{P}\longrightarrow\mathcal{C}\times\mathcal{T}\\ \mathcal{E}_{k,r,a,b}(K,N,A,M)\mapsto(C,T),\end{array} \]where \(C\) is the authenticated ciphertext with the same length as \(M\), and a 128-bits authentication tag, \(T\), which can authenticate the associated data and the encrypted message. The decryption procedure takes the same parameters, \(K,N,A\), and adds the authenticated encryption procedure output, i.e.,  
\[ \begin{array}{c}\mathcal{D}:\mathcal{K}\times\mathcal{N}\times\mathcal{A} \times\mathcal{C}\times\mathcal{T}\longrightarrow M\,\cup\{\bot\}\\ \mathcal{D}_{k,r,a,b}(K,N,A,C,T)=\{M,\bot\},\end{array} \]  
and it obtains the plaintext when the tag is correctly verified or an error, \(\bot\), in case the tag verification fails. Moreover, \(\mathcal{E}_{k,r,a,b}(K,N,A,M)\mapsto(C,T)\) if and only if \(\mathcal{D}_{k,r,a,b}(K,N,A,C,T)=M\). For encryption and decryption procedures, just one pass over the data is required. On the other hand, the family of hash functions for Ascon is defined by parameterizing the extendable output function \(X\) with the rate, \(r\), numbers \(a\) and \(b\) as defined before, and an output length limit \(h\). \[X_{h,r,a,b}(M,l)=H.\]  
Thus, this function maps an input message, \(M\), to a hash output, \(H\), with length \(l\leq h\). Most symmetric-key protocols under NIST consideration use permutation as underlying primitive, this is also the case of Ascon Cryptosystem [84, 85]. The rest of candidate algorithms are based on block-cipher, tweakable block cipher and stream cipher in less percentage. Figure 5 shows how the Ascon suite operates. Four stages are part of this flow [84, 86]:  
1. Initialization: The algorithm starts with the key, \(K\), the nonce, \(N\), the rate, \(r\), and the round numbers \(a\) and \(b\) as 8-bit integers. During this phase, \(a\) rounds of the round transformation \(\pi\) are applied to the initial state. 2. Processing associated data: during this state the data \(A\) is processed in \(r\)-bits blocks. 3. Processing plaintext/ciphertext: the plain text, \(P\) and the ciphertext, \(C\), are processed in blocks of \(r\) bits. 4. Finalization: The encryption algorithm output consist on the tag, \(T\), and the ciphertext blocks, \(C_{i}\), and the decryption one returns the plaintext blocks, \(P_{i}\) (if \(T\) matches the calculated tag from the secret key). Recommended parameters for the Ascon-80 pq scheme are a key size \(k=160\) bits, a nonce and tag size \(n=t=128\) bits (lowercase letters represents the size and capital letters the corresponding parameters), a rate \(r=64\) bits, and \(a=b=12\) for the permutations (both initialization and finalization), \(p^{a}\), and the intermediate permutation, \(p^{b}\), respectively. For both encryption and decryption procedures, these permutations are just only evaluated in one direction, which significantly reduces the computational costs.