diff options
author | markus <> | 2004-04-07 20:42:07 +0000 |
---|---|---|
committer | markus <> | 2004-04-07 20:42:07 +0000 |
commit | 58c08aa241f168c84ce7cc3052454ea59a44eada (patch) | |
tree | 1806747a3fda66041a998ca63c763fdcf722450e /src/lib/libcrypto/des | |
parent | 9c1aa44a1eacea897c0432e796b205b8484ff4d2 (diff) | |
download | openbsd-58c08aa241f168c84ce7cc3052454ea59a44eada.tar.gz openbsd-58c08aa241f168c84ce7cc3052454ea59a44eada.tar.bz2 openbsd-58c08aa241f168c84ce7cc3052454ea59a44eada.zip |
import openssl-0.9.7d
Diffstat (limited to 'src/lib/libcrypto/des')
-rw-r--r-- | src/lib/libcrypto/des/cfb_enc.c | 21 | ||||
-rw-r--r-- | src/lib/libcrypto/des/ecb_enc.c | 4 |
2 files changed, 13 insertions, 12 deletions
diff --git a/src/lib/libcrypto/des/cfb_enc.c b/src/lib/libcrypto/des/cfb_enc.c index 2600bdfc93..03cabb223c 100644 --- a/src/lib/libcrypto/des/cfb_enc.c +++ b/src/lib/libcrypto/des/cfb_enc.c | |||
@@ -56,6 +56,7 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #include "e_os.h" | ||
59 | #include "des_locl.h" | 60 | #include "des_locl.h" |
60 | 61 | ||
61 | /* The input and output are loaded in multiples of 8 bits. | 62 | /* The input and output are loaded in multiples of 8 bits. |
@@ -64,17 +65,15 @@ | |||
64 | * the second. The second 12 bits will come from the 3rd and half the 4th | 65 | * the second. The second 12 bits will come from the 3rd and half the 4th |
65 | * byte. | 66 | * byte. |
66 | */ | 67 | */ |
67 | /* WARNING WARNING: this uses in and out in 8-byte chunks regardless of | ||
68 | * length */ | ||
69 | /* Until Aug 1 2003 this function did not correctly implement CFB-r, so it | 68 | /* Until Aug 1 2003 this function did not correctly implement CFB-r, so it |
70 | * will not be compatible with any encryption prior to that date. Ben. */ | 69 | * will not be compatible with any encryption prior to that date. Ben. */ |
71 | void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, | 70 | void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, |
72 | long length, DES_key_schedule *schedule, DES_cblock *ivec, | 71 | long length, DES_key_schedule *schedule, DES_cblock *ivec, |
73 | int enc) | 72 | int enc) |
74 | { | 73 | { |
75 | register DES_LONG d0,d1,v0,v1,n=(numbits+7)/8; | 74 | register DES_LONG d0,d1,v0,v1; |
76 | register unsigned long l=length; | 75 | register unsigned long l=length,n=(numbits+7)/8; |
77 | register int num=numbits; | 76 | register int num=numbits,i; |
78 | DES_LONG ti[2]; | 77 | DES_LONG ti[2]; |
79 | unsigned char *iv; | 78 | unsigned char *iv; |
80 | unsigned char ovec[16]; | 79 | unsigned char ovec[16]; |
@@ -114,10 +113,10 @@ void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, | |||
114 | memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0)); | 113 | memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0)); |
115 | /* now the remaining bits */ | 114 | /* now the remaining bits */ |
116 | if(num%8 != 0) | 115 | if(num%8 != 0) |
117 | for(n=0 ; n < 8 ; ++n) | 116 | for(i=0 ; i < 8 ; ++i) |
118 | { | 117 | { |
119 | ovec[n]<<=num%8; | 118 | ovec[i]<<=num%8; |
120 | ovec[n]|=ovec[n+1]>>(8-num%8); | 119 | ovec[i]|=ovec[i+1]>>(8-num%8); |
121 | } | 120 | } |
122 | iv=&ovec[0]; | 121 | iv=&ovec[0]; |
123 | c2l(iv,v0); | 122 | c2l(iv,v0); |
@@ -152,10 +151,10 @@ void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, | |||
152 | memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0)); | 151 | memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0)); |
153 | /* now the remaining bits */ | 152 | /* now the remaining bits */ |
154 | if(num%8 != 0) | 153 | if(num%8 != 0) |
155 | for(n=0 ; n < 8 ; ++n) | 154 | for(i=0 ; i < 8 ; ++i) |
156 | { | 155 | { |
157 | ovec[n]<<=num%8; | 156 | ovec[i]<<=num%8; |
158 | ovec[n]|=ovec[n+1]>>(8-num%8); | 157 | ovec[i]|=ovec[i+1]>>(8-num%8); |
159 | } | 158 | } |
160 | iv=&ovec[0]; | 159 | iv=&ovec[0]; |
161 | c2l(iv,v0); | 160 | c2l(iv,v0); |
diff --git a/src/lib/libcrypto/des/ecb_enc.c b/src/lib/libcrypto/des/ecb_enc.c index 1b70f68806..784aa5ba23 100644 --- a/src/lib/libcrypto/des/ecb_enc.c +++ b/src/lib/libcrypto/des/ecb_enc.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include "des_ver.h" | 60 | #include "des_ver.h" |
61 | #include "spr.h" | 61 | #include "spr.h" |
62 | #include <openssl/opensslv.h> | 62 | #include <openssl/opensslv.h> |
63 | #include <openssl/bio.h> | ||
63 | 64 | ||
64 | OPENSSL_GLOBAL const char *libdes_version="libdes" OPENSSL_VERSION_PTEXT; | 65 | OPENSSL_GLOBAL const char *libdes_version="libdes" OPENSSL_VERSION_PTEXT; |
65 | OPENSSL_GLOBAL const char *DES_version="DES" OPENSSL_VERSION_PTEXT; | 66 | OPENSSL_GLOBAL const char *DES_version="DES" OPENSSL_VERSION_PTEXT; |
@@ -97,7 +98,8 @@ const char *DES_options(void) | |||
97 | size="int"; | 98 | size="int"; |
98 | else | 99 | else |
99 | size="long"; | 100 | size="long"; |
100 | sprintf(buf,"des(%s,%s,%s,%s)",ptr,risc,unroll,size); | 101 | BIO_snprintf(buf,sizeof buf,"des(%s,%s,%s,%s)",ptr,risc,unroll, |
102 | size); | ||
101 | init=0; | 103 | init=0; |
102 | } | 104 | } |
103 | return(buf); | 105 | return(buf); |