diff libtomcrypt/src/modes/lrw/lrw_process.c @ 1471:6dba84798cd5

Update to libtomcrypt 1.18.1, merged with Dropbear changes
author Matt Johnston <matt@ucc.asn.au>
date Fri, 09 Feb 2018 21:44:05 +0800
parents f849a5ca2efc
children
line wrap: on
line diff
--- a/libtomcrypt/src/modes/lrw/lrw_process.c	Thu Feb 08 23:11:40 2018 +0800
+++ b/libtomcrypt/src/modes/lrw/lrw_process.c	Fri Feb 09 21:44:05 2018 +0800
@@ -5,8 +5,6 @@
  *
  * The library is free for all purposes without any express
  * guarantee it works.
- *
- * Tom St Denis, [email protected], http://libtom.org
  */
 #include "tomcrypt.h"
 
@@ -30,7 +28,7 @@
 {
    unsigned char prod[16];
    int           x, err;
-#ifdef LRW_TABLES
+#ifdef LTC_LRW_TABLES
    int           y;
 #endif
 
@@ -49,18 +47,18 @@
       /* increment IV */
       for (x = 15; x >= 0; x--) {
           lrw->IV[x] = (lrw->IV[x] + 1) & 255;
-          if (lrw->IV[x]) { 
+          if (lrw->IV[x]) {
               break;
           }
       }
 
       /* update pad */
-#ifdef LRW_TABLES
+#ifdef LTC_LRW_TABLES
       /* for each byte changed we undo it's affect on the pad then add the new product */
       for (; x < 16; x++) {
 #ifdef LTC_FAST
           for (y = 0; y < 16; y += sizeof(LTC_FAST_TYPE)) {
-              *((LTC_FAST_TYPE *)(lrw->pad + y)) ^= *((LTC_FAST_TYPE *)(&lrw->PC[x][lrw->IV[x]][y])) ^ *((LTC_FAST_TYPE *)(&lrw->PC[x][(lrw->IV[x]-1)&255][y]));
+              *(LTC_FAST_TYPE_PTR_CAST(lrw->pad + y)) ^= *(LTC_FAST_TYPE_PTR_CAST(&lrw->PC[x][lrw->IV[x]][y])) ^ *(LTC_FAST_TYPE_PTR_CAST(&lrw->PC[x][(lrw->IV[x]-1)&255][y]));
           }
 #else
           for (y = 0; y < 16; y++) {
@@ -75,7 +73,7 @@
       /* xor prod */
 #ifdef LTC_FAST
       for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) {
-           *((LTC_FAST_TYPE *)(ct + x)) = *((LTC_FAST_TYPE *)(pt + x)) ^ *((LTC_FAST_TYPE *)(prod + x));
+           *(LTC_FAST_TYPE_PTR_CAST(ct + x)) = *(LTC_FAST_TYPE_PTR_CAST(pt + x)) ^ *(LTC_FAST_TYPE_PTR_CAST(prod + x));
       }
 #else
       for (x = 0; x < 16; x++) {
@@ -92,19 +90,19 @@
          if ((err = cipher_descriptor[lrw->cipher].ecb_decrypt(ct, ct, &lrw->key)) != CRYPT_OK) {
             return err;
          }
-      }               
+      }
 
       /* xor prod */
 #ifdef LTC_FAST
       for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) {
-           *((LTC_FAST_TYPE *)(ct + x)) = *((LTC_FAST_TYPE *)(ct + x)) ^ *((LTC_FAST_TYPE *)(prod + x));
+           *(LTC_FAST_TYPE_PTR_CAST(ct + x)) = *(LTC_FAST_TYPE_PTR_CAST(ct + x)) ^ *(LTC_FAST_TYPE_PTR_CAST(prod + x));
       }
 #else
       for (x = 0; x < 16; x++) {
          ct[x] = ct[x] ^ prod[x];
       }
 #endif
-   
+
       /* move to next */
       pt  += 16;
       ct  += 16;
@@ -113,8 +111,8 @@
 
    return CRYPT_OK;
 }
-      
+
 #endif
-/* $Source$ */
-/* $Revision$ */
-/* $Date$ */
+/* ref:         $Format:%D$ */
+/* git commit:  $Format:%H$ */
+/* commit time: $Format:%ai$ */