Remove all .cvsignore files
[openssl.git] / crypto / modes / cfb128.c
index b6d1e886b9c38592485db56894c52e59e98d60b6..4e6f5d35e13ba2925f9556983f618a9d0e57a620 100644 (file)
@@ -48,7 +48,8 @@
  *
  */
 
-#include "modes.h"
+#include <openssl/crypto.h>
+#include "modes_lcl.h"
 #include <string.h>
 
 #ifndef MODES_DEBUG
 #endif
 #include <assert.h>
 
-#define STRICT_ALIGNMENT
-#if defined(__i386) || defined(__i386__) || \
-    defined(__x86_64) || defined(__x86_64__) || \
-    defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64) || \
-    defined(__s390__) || defined(__s390x__)
-#  undef STRICT_ALIGNMENT
-#endif
-
 /* The input and output encrypted as though 128bit cfb mode is being
  * used.  The extra state information to record how much of the
  * 128bit block we have used is contained in *num;
@@ -96,15 +89,15 @@ void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,
 #endif
                while (len>=16) {
                        (*block)(ivec, ivec, key);
-                       for (n=0; n<16; n+=sizeof(size_t)) {
+                       for (; n<16; n+=sizeof(size_t)) {
                                *(size_t*)(out+n) =
                                *(size_t*)(ivec+n) ^= *(size_t*)(in+n);
                        }
                        len -= 16;
                        out += 16;
                        in  += 16;
+                       n = 0;
                }
-               n = 0;
                if (len) {
                        (*block)(ivec, ivec, key);
                        while (len--) {
@@ -141,7 +134,7 @@ void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,
 #endif
                while (len>=16) {
                        (*block)(ivec, ivec, key);
-                       for (n=0; n<16; n+=sizeof(size_t)) {
+                       for (; n<16; n+=sizeof(size_t)) {
                                size_t t = *(size_t*)(in+n);
                                *(size_t*)(out+n) = *(size_t*)(ivec+n) ^ t;
                                *(size_t*)(ivec+n) = t;
@@ -149,8 +142,8 @@ void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,
                        len -= 16;
                        out += 16;
                        in  += 16;
+                       n = 0;
                }
-               n = 0;
                if (len) {
                        (*block)(ivec, ivec, key);
                        while (len--) {
@@ -224,7 +217,6 @@ void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out,
     assert(in && out && key && ivec && num);
     assert(*num == 0);
 
-    memset(out,0,(bits+7)/8);
     for(n=0 ; n<bits ; ++n)
        {
        c[0]=(in[n/8]&(1 << (7-n%8))) ? 0x80 : 0;