diff options
author | nectar <nectar@FreeBSD.org> | 2004-03-17 15:49:33 +0000 |
---|---|---|
committer | nectar <nectar@FreeBSD.org> | 2004-03-17 15:49:33 +0000 |
commit | 0f095e8a2af65fdcbf4af38dc6a00383e2fd6b3f (patch) | |
tree | c6fe9e2dc64448f48fdaf5e0b2778005ccc1baac /crypto/openssl/crypto/des/cfb_enc.c | |
parent | e8232d78abaf5a170e34e0742d0042a65bcaafe4 (diff) | |
download | FreeBSD-src-0f095e8a2af65fdcbf4af38dc6a00383e2fd6b3f.zip FreeBSD-src-0f095e8a2af65fdcbf4af38dc6a00383e2fd6b3f.tar.gz |
Vendor import of OpenSSL 0.9.7d.
Diffstat (limited to 'crypto/openssl/crypto/des/cfb_enc.c')
-rw-r--r-- | crypto/openssl/crypto/des/cfb_enc.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/crypto/openssl/crypto/des/cfb_enc.c b/crypto/openssl/crypto/des/cfb_enc.c index 2600bdf..03cabb2 100644 --- a/crypto/openssl/crypto/des/cfb_enc.c +++ b/crypto/openssl/crypto/des/cfb_enc.c @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#include "e_os.h" #include "des_locl.h" /* The input and output are loaded in multiples of 8 bits. @@ -64,17 +65,15 @@ * the second. The second 12 bits will come from the 3rd and half the 4th * byte. */ -/* WARNING WARNING: this uses in and out in 8-byte chunks regardless of - * length */ /* Until Aug 1 2003 this function did not correctly implement CFB-r, so it * will not be compatible with any encryption prior to that date. Ben. */ void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, long length, DES_key_schedule *schedule, DES_cblock *ivec, int enc) { - register DES_LONG d0,d1,v0,v1,n=(numbits+7)/8; - register unsigned long l=length; - register int num=numbits; + register DES_LONG d0,d1,v0,v1; + register unsigned long l=length,n=(numbits+7)/8; + register int num=numbits,i; DES_LONG ti[2]; unsigned char *iv; unsigned char ovec[16]; @@ -114,10 +113,10 @@ void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0)); /* now the remaining bits */ if(num%8 != 0) - for(n=0 ; n < 8 ; ++n) + for(i=0 ; i < 8 ; ++i) { - ovec[n]<<=num%8; - ovec[n]|=ovec[n+1]>>(8-num%8); + ovec[i]<<=num%8; + ovec[i]|=ovec[i+1]>>(8-num%8); } iv=&ovec[0]; c2l(iv,v0); @@ -152,10 +151,10 @@ void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0)); /* now the remaining bits */ if(num%8 != 0) - for(n=0 ; n < 8 ; ++n) + for(i=0 ; i < 8 ; ++i) { - ovec[n]<<=num%8; - ovec[n]|=ovec[n+1]>>(8-num%8); + ovec[i]<<=num%8; + ovec[i]|=ovec[i+1]>>(8-num%8); } iv=&ovec[0]; c2l(iv,v0); |