summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/des
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/des')
-rw-r--r--src/lib/libcrypto/des/Makefile.ssl28
-rw-r--r--src/lib/libcrypto/des/cfb_enc.c21
-rw-r--r--src/lib/libcrypto/des/ecb_enc.c5
3 files changed, 28 insertions, 26 deletions
diff --git a/src/lib/libcrypto/des/Makefile.ssl b/src/lib/libcrypto/des/Makefile.ssl
index 45eba0b3c9..0d9ba2b42f 100644
--- a/src/lib/libcrypto/des/Makefile.ssl
+++ b/src/lib/libcrypto/des/Makefile.ssl
@@ -22,6 +22,7 @@ DES_ENC= des_enc.o fcrypt_b.o
22#DES_ENC= dx86-elf.o yx86-elf.o 22#DES_ENC= dx86-elf.o yx86-elf.o
23 23
24CFLAGS= $(INCLUDES) $(CFLAG) 24CFLAGS= $(INCLUDES) $(CFLAG)
25ASFLAGS= $(INCLUDES) $(ASFLAG)
25 26
26GENERAL=Makefile 27GENERAL=Makefile
27TEST=destest.c 28TEST=destest.c
@@ -157,12 +158,13 @@ cfb64enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
157cfb64enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 158cfb64enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
158cfb64enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h 159cfb64enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
159cfb64enc.o: cfb64enc.c des_locl.h 160cfb64enc.o: cfb64enc.c des_locl.h
160cfb_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 161cfb_enc.o: ../../e_os.h ../../include/openssl/crypto.h
161cfb_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h 162cfb_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
162cfb_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 163cfb_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
163cfb_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h 164cfb_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
164cfb_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h 165cfb_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
165cfb_enc.o: ../../include/openssl/ui_compat.h cfb_enc.c des_locl.h 166cfb_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
167cfb_enc.o: cfb_enc.c des_locl.h
166des_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 168des_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
167des_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h 169des_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
168des_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 170des_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
@@ -191,13 +193,13 @@ ecb3_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
191ecb3_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h 193ecb3_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
192ecb3_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h 194ecb3_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
193ecb3_enc.o: des_locl.h ecb3_enc.c 195ecb3_enc.o: des_locl.h ecb3_enc.c
194ecb_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 196ecb_enc.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
195ecb_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h 197ecb_enc.o: ../../include/openssl/des.h ../../include/openssl/des_old.h
196ecb_enc.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h 198ecb_enc.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h
197ecb_enc.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h 199ecb_enc.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
198ecb_enc.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h 200ecb_enc.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
199ecb_enc.o: ../../include/openssl/ui_compat.h des_locl.h des_ver.h ecb_enc.c 201ecb_enc.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
200ecb_enc.o: spr.h 202ecb_enc.o: des_locl.h des_ver.h ecb_enc.c spr.h
201ede_cbcm_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h 203ede_cbcm_enc.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
202ede_cbcm_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h 204ede_cbcm_enc.o: ../../include/openssl/des_old.h ../../include/openssl/e_os2.h
203ede_cbcm_enc.o: ../../include/openssl/opensslconf.h 205ede_cbcm_enc.o: ../../include/openssl/opensslconf.h
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. */
71void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits, 70void 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 c828bdd45d..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
64OPENSSL_GLOBAL const char *libdes_version="libdes" OPENSSL_VERSION_PTEXT; 65OPENSSL_GLOBAL const char *libdes_version="libdes" OPENSSL_VERSION_PTEXT;
65OPENSSL_GLOBAL const char *DES_version="DES" OPENSSL_VERSION_PTEXT; 66OPENSSL_GLOBAL const char *DES_version="DES" OPENSSL_VERSION_PTEXT;
@@ -97,8 +98,8 @@ const char *DES_options(void)
97 size="int"; 98 size="int";
98 else 99 else
99 size="long"; 100 size="long";
100 snprintf(buf,sizeof buf,"des(%s,%s,%s,%s)",ptr,risc,unroll, 101 BIO_snprintf(buf,sizeof buf,"des(%s,%s,%s,%s)",ptr,risc,unroll,
101 size); 102 size);
102 init=0; 103 init=0;
103 } 104 }
104 return(buf); 105 return(buf);