[riot-notifications] [RIOT-OS/RIOT] chacha20poly1305: Initial implementation of AEAD cipher. (#10220)

Koen Zandberg notifications at github.com
Sun Feb 3 21:45:24 CET 2019


bergzand commented on this pull request.



> +        ((uint32_t)p[2] << 16) |
+        ((uint32_t)p[3] << 24));
+}
+
+/* Single round */
+void _r(uint32_t *a, uint32_t *b, uint32_t *d, unsigned c)
+{
+    *a += *b;
+    uint32_t tmp = *a ^ *d;
+    *d = (tmp << c) | (tmp >> (32 - c));
+}
+
+void _add_initial(chacha20poly1305_ctx_t *ctx, const uint8_t *key,
+                  const uint8_t *nonce, uint32_t blk)
+{
+    for (unsigned i = 0; i < 4; i++) {

> Is it standard to use just unsigned? Would it be better to specify unsigned int or just size_t?

IMHO just a personal preference, I don't mind changing it to `unsigned int`.

> Also maybe you could unroll the loop (I don't know if that can help with compiler optimizations in M4s)?

I'd really like to leave this as an exercise to the reader if you don't mind :)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10220#discussion_r253318624
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190203/50a0d282/attachment.html>


More information about the notifications mailing list