You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2020/03/04 14:24:17 UTC

[GitHub] [mynewt-core] utzig commented on a change in pull request #2174: Updates to crypto_test app; STM32 crypto HW driver; CBC/CTR speed

utzig commented on a change in pull request #2174: Updates to crypto_test app; STM32 crypto HW driver; CBC/CTR speed
URL: https://github.com/apache/mynewt-core/pull/2174#discussion_r387697896
 
 

 ##########
 File path: hw/drivers/crypto/src/crypto.c
 ##########
 @@ -56,8 +61,20 @@ crypto_do_ctr(struct crypto_dev *crypto, const void *key, uint16_t keylen,
             return sz + rc;
         }
 
-        for (i = 0; i < len; i++) {
-            outbuf8[i] = inbuf8[i] ^ _out[i];
+        /*
+         * For full blocks increase speed by doing 32-bit XOR; maintain the
+         * stream semantics doing byte XORs for smaller sizes (end of buffer).
+         */
+        if (len == AES_BLOCK_LEN) {
+            inbuf32 = (uint32_t *)inbuf8;
+            outbuf32 = (uint32_t *)outbuf8;
+            for (i = 0; i < len / 4; i++) {
+                outbuf32[i] = inbuf32[i] ^ _out32[i];
 
 Review comment:
   This should be fixed now, thanks!

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services