Optimize #undef DES_UNROLL for size.
authorAndy Polyakov <appro@openssl.org>
Mon, 22 Dec 2008 14:10:42 +0000 (14:10 +0000)
committerAndy Polyakov <appro@openssl.org>
Mon, 22 Dec 2008 14:10:42 +0000 (14:10 +0000)
crypto/des/des_enc.c
crypto/des/ecb_enc.c
crypto/des/fcrypt_b.c

index ab0b4380833848f6c76d0ba8f5a04ca03c806dee..828feba208af3ff066173f4b42919eccc29e4618 100644 (file)
@@ -108,12 +108,10 @@ void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc)
                D_ENCRYPT(l,r,28); /*  15 */
                D_ENCRYPT(r,l,30); /*  16 */
 #else
                D_ENCRYPT(l,r,28); /*  15 */
                D_ENCRYPT(r,l,30); /*  16 */
 #else
-               for (i=0; i<32; i+=8)
+               for (i=0; i<32; i+=4)
                        {
                        D_ENCRYPT(l,r,i+0); /*  1 */
                        D_ENCRYPT(r,l,i+2); /*  2 */
                        {
                        D_ENCRYPT(l,r,i+0); /*  1 */
                        D_ENCRYPT(r,l,i+2); /*  2 */
-                       D_ENCRYPT(l,r,i+4); /*  3 */
-                       D_ENCRYPT(r,l,i+6); /*  4 */
                        }
 #endif
                }
                        }
 #endif
                }
@@ -137,12 +135,10 @@ void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc)
                D_ENCRYPT(l,r, 2); /*  2 */
                D_ENCRYPT(r,l, 0); /*  1 */
 #else
                D_ENCRYPT(l,r, 2); /*  2 */
                D_ENCRYPT(r,l, 0); /*  1 */
 #else
-               for (i=30; i>0; i-=8)
+               for (i=30; i>0; i-=4)
                        {
                        D_ENCRYPT(l,r,i-0); /* 16 */
                        D_ENCRYPT(r,l,i-2); /* 15 */
                        {
                        D_ENCRYPT(l,r,i-0); /* 16 */
                        D_ENCRYPT(r,l,i-2); /* 15 */
-                       D_ENCRYPT(l,r,i-4); /* 14 */
-                       D_ENCRYPT(r,l,i-6); /* 13 */
                        }
 #endif
                }
                        }
 #endif
                }
@@ -204,12 +200,10 @@ void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc)
                D_ENCRYPT(l,r,28); /*  15 */
                D_ENCRYPT(r,l,30); /*  16 */
 #else
                D_ENCRYPT(l,r,28); /*  15 */
                D_ENCRYPT(r,l,30); /*  16 */
 #else
-               for (i=0; i<32; i+=8)
+               for (i=0; i<32; i+=4)
                        {
                        D_ENCRYPT(l,r,i+0); /*  1 */
                        D_ENCRYPT(r,l,i+2); /*  2 */
                        {
                        D_ENCRYPT(l,r,i+0); /*  1 */
                        D_ENCRYPT(r,l,i+2); /*  2 */
-                       D_ENCRYPT(l,r,i+4); /*  3 */
-                       D_ENCRYPT(r,l,i+6); /*  4 */
                        }
 #endif
                }
                        }
 #endif
                }
@@ -233,12 +227,10 @@ void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc)
                D_ENCRYPT(l,r, 2); /*  2 */
                D_ENCRYPT(r,l, 0); /*  1 */
 #else
                D_ENCRYPT(l,r, 2); /*  2 */
                D_ENCRYPT(r,l, 0); /*  1 */
 #else
-               for (i=30; i>0; i-=8)
+               for (i=30; i>0; i-=4)
                        {
                        D_ENCRYPT(l,r,i-0); /* 16 */
                        D_ENCRYPT(r,l,i-2); /* 15 */
                        {
                        D_ENCRYPT(l,r,i-0); /* 16 */
                        D_ENCRYPT(r,l,i-2); /* 15 */
-                       D_ENCRYPT(l,r,i-4); /* 14 */
-                       D_ENCRYPT(r,l,i-6); /* 13 */
                        }
 #endif
                }
                        }
 #endif
                }
index 0861988323c6063fb1bfc73aec476c71bdc32c59..0684e769b3e0892db41e1e8b716861721e296e6c 100644 (file)
@@ -91,7 +91,7 @@ const char *DES_options(void)
 #ifdef DES_UNROLL
                unroll="16";
 #else
 #ifdef DES_UNROLL
                unroll="16";
 #else
-               unroll="4";
+               unroll="2";
 #endif
                if (sizeof(DES_LONG) != sizeof(long))
                        size="int";
 #endif
                if (sizeof(DES_LONG) != sizeof(long))
                        size="int";
index 1390138787ff93e8e304922f39e25909e5de07f2..8822816938ddddfc2cdf6f2f341959f0e55978c8 100644 (file)
@@ -100,12 +100,10 @@ void fcrypt_body(DES_LONG *out, DES_key_schedule *ks, DES_LONG Eswap0,
 #ifndef DES_UNROLL
                register int i;
 
 #ifndef DES_UNROLL
                register int i;
 
-               for (i=0; i<32; i+=8)
+               for (i=0; i<32; i+=4)
                        {
                        D_ENCRYPT(l,r,i+0); /*  1 */
                        D_ENCRYPT(r,l,i+2); /*  2 */
                        {
                        D_ENCRYPT(l,r,i+0); /*  1 */
                        D_ENCRYPT(r,l,i+2); /*  2 */
-                       D_ENCRYPT(l,r,i+4); /*  1 */
-                       D_ENCRYPT(r,l,i+6); /*  2 */
                        }
 #else
                D_ENCRYPT(l,r, 0); /*  1 */
                        }
 #else
                D_ENCRYPT(l,r, 0); /*  1 */