diff libtomcrypt/src/ciphers/twofish/twofish.c @ 1439:8d24733026c5 coverity

merge
author Matt Johnston <matt@ucc.asn.au>
date Sat, 24 Jun 2017 23:33:16 +0800
parents f849a5ca2efc
children 6dba84798cd5
line wrap: on
line diff
--- a/libtomcrypt/src/ciphers/twofish/twofish.c	Sat Jun 03 00:10:58 2017 +0800
+++ b/libtomcrypt/src/ciphers/twofish/twofish.c	Sat Jun 24 23:33:16 2017 +0800
@@ -6,7 +6,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, [email protected], http://libtomcrypt.com
+ * Tom St Denis, [email protected], http://libtom.org
  */
 
  /** 
@@ -15,12 +15,12 @@
  */
 #include "tomcrypt.h"
 
-#ifdef TWOFISH
+#ifdef LTC_TWOFISH
 
-/* first TWOFISH_ALL_TABLES must ensure TWOFISH_TABLES is defined */
-#ifdef TWOFISH_ALL_TABLES
-#ifndef TWOFISH_TABLES
-#define TWOFISH_TABLES
+/* first LTC_TWOFISH_ALL_TABLES must ensure LTC_TWOFISH_TABLES is defined */
+#ifdef LTC_TWOFISH_ALL_TABLES
+#ifndef LTC_TWOFISH_TABLES
+#define LTC_TWOFISH_TABLES
 #endif
 #endif
 
@@ -68,7 +68,7 @@
    { 1, 0, 1, 1, 0 }
 };
 
-#ifdef TWOFISH_TABLES
+#ifdef LTC_TWOFISH_TABLES
 
 #include "twofish_tab.c"
 
@@ -142,7 +142,7 @@
 }
 #endif /* LTC_CLEAN_STACK */
 
-#endif /* TWOFISH_TABLES */
+#endif /* LTC_TWOFISH_TABLES */
 
 /* computes ab mod p */
 static ulong32 gf_mult(ulong32 a, ulong32 b, ulong32 p)
@@ -167,7 +167,7 @@
 }
 
 /* computes [y0 y1 y2 y3] = MDS . [x0] */
-#ifndef TWOFISH_TABLES
+#ifndef LTC_TWOFISH_TABLES
 static ulong32 mds_column_mult(unsigned char in, int col)
 {
    ulong32 x01, x5B, xEF;
@@ -202,11 +202,11 @@
    return 0;
 }
 
-#else /* !TWOFISH_TABLES */
+#else /* !LTC_TWOFISH_TABLES */
 
 #define mds_column_mult(x, i) mds_tab[i][x]
 
-#endif /* TWOFISH_TABLES */
+#endif /* LTC_TWOFISH_TABLES */
 
 /* Computes [y0 y1 y2 y3] = MDS . [x0 x1 x2 x3] */
 static void mds_mult(const unsigned char *in, unsigned char *out)
@@ -219,7 +219,7 @@
   STORE32L(tmp, out);
 }
 
-#ifdef TWOFISH_ALL_TABLES
+#ifdef LTC_TWOFISH_ALL_TABLES
 /* computes [y0 y1 y2 y3] = RS . [x0 x1 x2 x3 x4 x5 x6 x7] */
 static void rs_mult(const unsigned char *in, unsigned char *out)
 {
@@ -229,7 +229,7 @@
    STORE32L(tmp, out);
 }
 
-#else /* !TWOFISH_ALL_TABLES */
+#else /* !LTC_TWOFISH_ALL_TABLES */
 
 /* computes [y0 y1 y2 y3] = RS . [x0 x1 x2 x3 x4 x5 x6 x7] */
 static void rs_mult(const unsigned char *in, unsigned char *out)
@@ -273,7 +273,7 @@
   mds_mult(y, out);
 }
 
-#ifndef TWOFISH_SMALL
+#ifndef LTC_TWOFISH_SMALL
 
 /* for GCC we don't use pointer aliases */
 #if defined(__GNUC__)
@@ -332,7 +332,7 @@
 }
 #endif /* LTC_CLEAN_STACK */
 
-#endif /* TWOFISH_SMALL */
+#endif /* LTC_TWOFISH_SMALL */
 
  /**
     Initialize the Twofish block cipher
@@ -348,7 +348,7 @@
 int twofish_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
 #endif
 {
-#ifndef TWOFISH_SMALL
+#ifndef LTC_TWOFISH_SMALL
    unsigned char S[4*4], tmpx0, tmpx1;
 #endif
    int k, x, y;
@@ -376,7 +376,7 @@
    }
 
    /* create the S[..] words */
-#ifndef TWOFISH_SMALL
+#ifndef LTC_TWOFISH_SMALL
    for (x = 0; x < k; x++) {
        rs_mult(M+(x*8), S+(x*4));
    }
@@ -410,7 +410,7 @@
        skey->twofish.K[x+x+1] = ROLc(B + B + A, 9);
    }
 
-#ifndef TWOFISH_SMALL
+#ifndef LTC_TWOFISH_SMALL
    /* make the sboxes (large ram variant) */
    if (k == 2) {
         for (x = 0; x < 256; x++) {
@@ -477,7 +477,7 @@
 {
     ulong32 a,b,c,d,ta,tb,tc,td,t1,t2, *k;
     int r;
-#if !defined(TWOFISH_SMALL) && !defined(__GNUC__)
+#if !defined(LTC_TWOFISH_SMALL) && !defined(__GNUC__)
     ulong32 *S1, *S2, *S3, *S4;
 #endif    
 
@@ -485,7 +485,7 @@
     LTC_ARGCHK(ct   != NULL);
     LTC_ARGCHK(skey != NULL);
     
-#if !defined(TWOFISH_SMALL) && !defined(__GNUC__)
+#if !defined(LTC_TWOFISH_SMALL) && !defined(__GNUC__)
     S1 = skey->twofish.S[0];
     S2 = skey->twofish.S[1];
     S3 = skey->twofish.S[2];
@@ -550,7 +550,7 @@
 {
     ulong32 a,b,c,d,ta,tb,tc,td,t1,t2, *k;
     int r;
-#if !defined(TWOFISH_SMALL) && !defined(__GNUC__)
+#if !defined(LTC_TWOFISH_SMALL) && !defined(__GNUC__)
     ulong32 *S1, *S2, *S3, *S4;
 #endif    
 
@@ -558,7 +558,7 @@
     LTC_ARGCHK(ct   != NULL);
     LTC_ARGCHK(skey != NULL);
     
-#if !defined(TWOFISH_SMALL) && !defined(__GNUC__)
+#if !defined(LTC_TWOFISH_SMALL) && !defined(__GNUC__)
     S1 = skey->twofish.S[0];
     S2 = skey->twofish.S[1];
     S3 = skey->twofish.S[2];
@@ -714,6 +714,6 @@
 
 
 
-/* $Source: /cvs/libtom/libtomcrypt/src/ciphers/twofish/twofish.c,v $ */
-/* $Revision: 1.14 $ */
-/* $Date: 2006/12/04 21:34:03 $ */
+/* $Source$ */
+/* $Revision$ */
+/* $Date$ */