# Post-Quantum Authentication in the MQTT Protocol
## 5 Discussion  
Some slight increases in CPU usage could be seen as available memory decreases when using digital signatures for authentication. However, the increases were too slight and inconsistent to result in any noticeable impact in CPU usage. The CPU usage for the broker was consistently greater than that for the publisher and subscriber. However, the broker can usually be expected to be the less constrained device (i.e., a gateway) compared to the publisher and subscriber.  
There was an increase in memory usage for the broker when running dilithium3 and dilithium5 when there was only 1 GB of available memory. This might be linked to the need to read from the disk, something that did not occur when there were 8 GB of available memory. There was also a large amount of disk usage seen for the Broker when only 1 GB of memory was available.  
The value written to the disk is likely consistent, as the size of the generated keys and certificates would be practically the same for all instances of a given security level. There was no change with the reduced available memory, which is as expected, since the size of the keys and certificates should be consistent.  
Network output was more for the broker, which is likely because the broker is the gateway and responsible for communicating with both the subscriber and publisher, whilst the subscriber and publisher only communicate with the broker.  
The time increase observed when the available memory is reduced is in the order of microseconds. This may be cause for concern when considering the use of authentication in MQTT for devices that are even more constrained, with memory in the order of megabytes or even kilobytes, as the increase in time could grow further.  
Signature-based authentication in MQTT has a slight advantage in terms of storage, according to the metric we have considered, compared to KEM-based authentication. However, cases where a device can handle 11 KB but not 17 KB are unlikely, so this advantage is minimal.  
Signature-based authentication in MQTT has a slight advantage in terms of bandwidth compared to KEM-based authentication. However, the bandwidth results are both in the same order of magnitude for both protocols, and it is therefore unlikely that there will be a case where the signature-based version is acceptable but the KEM-based one is not.  
The KEM-based MQTT version has a significant advantage in connection speed. It was, on average, 25 ms faster than the signature-based version, which is a difference of 71%. In [23], a 90% reduction in CPU cycles was seen, which aligns with our results. A full 90% reduction was not expected, as the connection time we measured included the overhead of packet transmission, as well as the actual CPU processing time. This speed increase using KEM would allow subscribers and publishers to connect to and authenticate the broker relatively quickly compared to a traditional signature-based authentication approach.  
Overall, KEM-based authentication has slight disadvantages in terms of bandwidth. However, it has a significant advantage in terms of connection speed. This suggests that in an IoT context, the KEM-based version may be the most suitable, particularly as one of the key focuses of MQTT is to be a fast communication protocol in IoT.  
The extra costs of memory bandwidth and connection speed from adding authentication are low enough to be acceptable in most situations, particularly as CPUs become more powerful and efficient in IoT. However, there may be cases where these additional resources are not acceptable, especially when the IoT devices are quite resource-constrained.