summaryrefslogtreecommitdiff
path: root/lib/libcrypto/des
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2008-09-06 12:17:55 +0000
committerDamien Miller <djm@cvs.openbsd.org>2008-09-06 12:17:55 +0000
commit96de7a4399a8c71cbb70d6252fa77acfd76b3f09 (patch)
treee6f6e4aad1952944ccd27e9eb47ea48b9a78dde7 /lib/libcrypto/des
parentec7710fe8f10fb624fbc33c0bbad2474e0c26979 (diff)
resolve conflicts
Diffstat (limited to 'lib/libcrypto/des')
-rw-r--r--lib/libcrypto/des/cfb64ede.c4
-rw-r--r--lib/libcrypto/des/cfb_enc.c71
-rw-r--r--lib/libcrypto/des/des.h11
-rw-r--r--lib/libcrypto/des/des_enc.c9
-rw-r--r--lib/libcrypto/des/des_locl.h2
-rw-r--r--lib/libcrypto/des/des_old.c4
-rw-r--r--lib/libcrypto/des/des_old.h13
-rw-r--r--lib/libcrypto/des/des_opts.c4
-rw-r--r--lib/libcrypto/des/des_ver.h4
-rw-r--r--lib/libcrypto/des/destest.c18
-rw-r--r--lib/libcrypto/des/ecb3_enc.c4
-rw-r--r--lib/libcrypto/des/ecb_enc.c4
-rw-r--r--lib/libcrypto/des/ede_cbcm_enc.c2
-rw-r--r--lib/libcrypto/des/fcrypt.c3
-rw-r--r--lib/libcrypto/des/read2pwd.c1
-rw-r--r--lib/libcrypto/des/set_key.c10
-rw-r--r--lib/libcrypto/des/speed.c4
-rw-r--r--lib/libcrypto/des/str2key.c1
-rw-r--r--lib/libcrypto/des/xcbc_enc.c4
19 files changed, 103 insertions, 70 deletions
diff --git a/lib/libcrypto/des/cfb64ede.c b/lib/libcrypto/des/cfb64ede.c
index f3c60185288..de34ecceb96 100644
--- a/lib/libcrypto/des/cfb64ede.c
+++ b/lib/libcrypto/des/cfb64ede.c
@@ -152,8 +152,8 @@ void DES_ede3_cfb_encrypt(const unsigned char *in,unsigned char *out,
DES_cblock *ivec,int enc)
{
register DES_LONG d0,d1,v0,v1;
- register long l=length;
- register int num=numbits,n=(numbits+7)/8,i;
+ register unsigned long l=length,n=((unsigned int)numbits+7)/8;
+ register int num=numbits,i;
DES_LONG ti[2];
unsigned char *iv;
unsigned char ovec[16];
diff --git a/lib/libcrypto/des/cfb_enc.c b/lib/libcrypto/des/cfb_enc.c
index 03cabb223cd..720f29a28e6 100644
--- a/lib/libcrypto/des/cfb_enc.c
+++ b/lib/libcrypto/des/cfb_enc.c
@@ -58,6 +58,7 @@
#include "e_os.h"
#include "des_locl.h"
+#include <assert.h>
/* The input and output are loaded in multiples of 8 bits.
* What this means is that if you hame numbits=12 and length=2
@@ -72,19 +73,29 @@ void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits,
int enc)
{
register DES_LONG d0,d1,v0,v1;
- register unsigned long l=length,n=(numbits+7)/8;
- register int num=numbits,i;
+ register unsigned long l=length;
+ register int num=numbits/8,n=(numbits+7)/8,i,rem=numbits%8;
DES_LONG ti[2];
unsigned char *iv;
+#ifndef L_ENDIAN
unsigned char ovec[16];
+#else
+ unsigned int sh[4];
+ unsigned char *ovec=(unsigned char *)sh;
- if (num > 64) return;
+ /* I kind of count that compiler optimizes away this assertioni,*/
+ assert (sizeof(sh[0])==4); /* as this holds true for all, */
+ /* but 16-bit platforms... */
+
+#endif
+
+ if (numbits<=0 || numbits > 64) return;
iv = &(*ivec)[0];
c2l(iv,v0);
c2l(iv,v1);
if (enc)
{
- while (l >= n)
+ while (l >= (unsigned long)n)
{
l-=n;
ti[0]=v0;
@@ -98,35 +109,40 @@ void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits,
out+=n;
/* 30-08-94 - eay - changed because l>>32 and
* l<<32 are bad under gcc :-( */
- if (num == 32)
+ if (numbits == 32)
{ v0=v1; v1=d0; }
- else if (num == 64)
+ else if (numbits == 64)
{ v0=d0; v1=d1; }
else
{
+#ifndef L_ENDIAN
iv=&ovec[0];
l2c(v0,iv);
l2c(v1,iv);
l2c(d0,iv);
l2c(d1,iv);
- /* shift ovec left most of the bits... */
- memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0));
- /* now the remaining bits */
- if(num%8 != 0)
+#else
+ sh[0]=v0, sh[1]=v1, sh[2]=d0, sh[3]=d1;
+#endif
+ if (rem==0)
+ memmove(ovec,ovec+num,8);
+ else
for(i=0 ; i < 8 ; ++i)
- {
- ovec[i]<<=num%8;
- ovec[i]|=ovec[i+1]>>(8-num%8);
- }
+ ovec[i]=ovec[i+num]<<rem |
+ ovec[i+num+1]>>(8-rem);
+#ifdef L_ENDIAN
+ v0=sh[0], v1=sh[1];
+#else
iv=&ovec[0];
c2l(iv,v0);
c2l(iv,v1);
+#endif
}
}
}
else
{
- while (l >= n)
+ while (l >= (unsigned long)n)
{
l-=n;
ti[0]=v0;
@@ -136,29 +152,34 @@ void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits,
in+=n;
/* 30-08-94 - eay - changed because l>>32 and
* l<<32 are bad under gcc :-( */
- if (num == 32)
+ if (numbits == 32)
{ v0=v1; v1=d0; }
- else if (num == 64)
+ else if (numbits == 64)
{ v0=d0; v1=d1; }
else
{
+#ifndef L_ENDIAN
iv=&ovec[0];
l2c(v0,iv);
l2c(v1,iv);
l2c(d0,iv);
l2c(d1,iv);
- /* shift ovec left most of the bits... */
- memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0));
- /* now the remaining bits */
- if(num%8 != 0)
+#else
+ sh[0]=v0, sh[1]=v1, sh[2]=d0, sh[3]=d1;
+#endif
+ if (rem==0)
+ memmove(ovec,ovec+num,8);
+ else
for(i=0 ; i < 8 ; ++i)
- {
- ovec[i]<<=num%8;
- ovec[i]|=ovec[i+1]>>(8-num%8);
- }
+ ovec[i]=ovec[i+num]<<rem |
+ ovec[i+num+1]>>(8-rem);
+#ifdef L_ENDIAN
+ v0=sh[0], v1=sh[1];
+#else
iv=&ovec[0];
c2l(iv,v0);
c2l(iv,v1);
+#endif
}
d0^=ti[0];
d1^=ti[1];
diff --git a/lib/libcrypto/des/des.h b/lib/libcrypto/des/des.h
index 81bd874edd7..73185936995 100644
--- a/lib/libcrypto/des/des.h
+++ b/lib/libcrypto/des/des.h
@@ -59,13 +59,13 @@
#ifndef HEADER_DES_H
#define HEADER_DES_H
+#include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES,
+ DES_LONG (via openssl/opensslconf.h */
+
#ifdef OPENSSL_NO_DES
#error DES is disabled.
#endif
-#include <openssl/opensslconf.h> /* DES_LONG */
-#include <openssl/e_os2.h> /* OPENSSL_EXTERN */
-
#ifdef OPENSSL_BUILD_SHLIBCRYPTO
# undef OPENSSL_EXTERN
# define OPENSSL_EXTERN OPENSSL_EXPORT
@@ -130,7 +130,7 @@ OPENSSL_DECLARE_GLOBAL(int,DES_rw_mode); /* defaults to DES_PCBC_MODE */
#define DES_rw_mode OPENSSL_GLOBAL_REF(DES_rw_mode)
const char *DES_options(void);
-void DES_ecb3_encrypt(const unsigned char *input, unsigned char *output,
+void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output,
DES_key_schedule *ks1,DES_key_schedule *ks2,
DES_key_schedule *ks3, int enc);
DES_LONG DES_cbc_cksum(const unsigned char *input,DES_cblock *output,
@@ -197,9 +197,10 @@ void DES_ede3_ofb64_encrypt(const unsigned char *in,unsigned char *out,
long length,DES_key_schedule *ks1,
DES_key_schedule *ks2,DES_key_schedule *ks3,
DES_cblock *ivec,int *num);
-
+#if 0
void DES_xwhite_in2out(const_DES_cblock *DES_key,const_DES_cblock *in_white,
DES_cblock *out_white);
+#endif
int DES_enc_read(int fd,void *buf,int len,DES_key_schedule *sched,
DES_cblock *iv);
diff --git a/lib/libcrypto/des/des_enc.c b/lib/libcrypto/des/des_enc.c
index 6a49ec4a550..53705b9f5be 100644
--- a/lib/libcrypto/des/des_enc.c
+++ b/lib/libcrypto/des/des_enc.c
@@ -58,9 +58,6 @@
#include "des_locl.h"
-#ifndef OPENSSL_FIPS
-#ifndef OPENBSD_DES_ASM
-
void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc)
{
register DES_LONG l,r,t,u;
@@ -291,12 +288,8 @@ void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1,
data[1]=r;
}
-#endif /* ndef OPENSSL_FIPS */
-
#ifndef DES_DEFAULT_OPTIONS
-#if !defined(OPENSSL_FIPS_DES_ASM)
-
#undef CBC_ENC_C__DONT_UPDATE_IV
#include "ncbc_enc.c" /* DES_ncbc_encrypt */
@@ -412,6 +405,4 @@ void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output,
tin[0]=tin[1]=0;
}
-#endif /* !defined(OPENSSL_FIPS_DES_ASM) */
-
#endif /* DES_DEFAULT_OPTIONS */
diff --git a/lib/libcrypto/des/des_locl.h b/lib/libcrypto/des/des_locl.h
index 8f04b18c50f..4b9ecff2339 100644
--- a/lib/libcrypto/des/des_locl.h
+++ b/lib/libcrypto/des/des_locl.h
@@ -160,7 +160,7 @@
} \
}
-#if defined(OPENSSL_SYS_WIN32) && defined(_MSC_VER)
+#if (defined(OPENSSL_SYS_WIN32) && defined(_MSC_VER)) || defined(__ICC)
#define ROTATE(a,n) (_lrotr(a,n))
#elif defined(__GNUC__) && __GNUC__>=2 && !defined(__STRICT_ANSI__) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) && !defined(PEDANTIC)
# if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__)
diff --git a/lib/libcrypto/des/des_old.c b/lib/libcrypto/des/des_old.c
index 88e9802aad0..7c33ed7a933 100644
--- a/lib/libcrypto/des/des_old.c
+++ b/lib/libcrypto/des/des_old.c
@@ -84,7 +84,7 @@ void _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock
des_key_schedule ks1,des_key_schedule ks2,
des_key_schedule ks3, int enc)
{
- DES_ecb3_encrypt((const unsigned char *)input, (unsigned char *)output,
+ DES_ecb3_encrypt((const_DES_cblock *)input, output,
(DES_key_schedule *)ks1, (DES_key_schedule *)ks2,
(DES_key_schedule *)ks3, enc);
}
@@ -169,11 +169,13 @@ void _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out,
(DES_key_schedule *)ks3, ivec, num);
}
+#if 0 /* broken code, preserved just in case anyone specifically looks for this */
void _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), _ossl_old_des_cblock (*in_white),
_ossl_old_des_cblock (*out_white))
{
DES_xwhite_in2out(des_key, in_white, out_white);
}
+#endif
int _ossl_old_des_enc_read(int fd,char *buf,int len,des_key_schedule sched,
_ossl_old_des_cblock *iv)
diff --git a/lib/libcrypto/des/des_old.h b/lib/libcrypto/des/des_old.h
index 1d8bf651017..8665ba4e7e1 100644
--- a/lib/libcrypto/des/des_old.h
+++ b/lib/libcrypto/des/des_old.h
@@ -91,6 +91,8 @@
#ifndef HEADER_DES_OLD_H
#define HEADER_DES_OLD_H
+#include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */
+
#ifdef OPENSSL_NO_DES
#error DES is disabled.
#endif
@@ -103,8 +105,6 @@
#error <openssl/des_old.h> replaces <kerberos/des.h>.
#endif
-#include <openssl/opensslconf.h> /* DES_LONG */
-#include <openssl/e_os2.h> /* OPENSSL_EXTERN */
#include <openssl/symhacks.h>
#ifdef OPENSSL_BUILD_SHLIBCRYPTO
@@ -116,6 +116,10 @@
extern "C" {
#endif
+#ifdef _
+#undef _
+#endif
+
typedef unsigned char _ossl_old_des_cblock[8];
typedef struct _ossl_old_des_ks_struct
{
@@ -171,9 +175,9 @@ typedef struct _ossl_old_des_ks_struct
DES_enc_write((f),(b),(l),&(k),(iv))
#define des_fcrypt(b,s,r)\
DES_fcrypt((b),(s),(r))
+#if 0
#define des_crypt(b,s)\
DES_crypt((b),(s))
-#if 0
#if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__)
#define crypt(b,s)\
DES_crypt((b),(s))
@@ -360,9 +364,10 @@ void _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out,
void _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out,
long length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2,
_ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num);
-
+#if 0
void _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), _ossl_old_des_cblock (*in_white),
_ossl_old_des_cblock (*out_white));
+#endif
int _ossl_old_des_enc_read(int fd,char *buf,int len,_ossl_old_des_key_schedule sched,
_ossl_old_des_cblock *iv);
diff --git a/lib/libcrypto/des/des_opts.c b/lib/libcrypto/des/des_opts.c
index 79278b920eb..2df82962c5a 100644
--- a/lib/libcrypto/des/des_opts.c
+++ b/lib/libcrypto/des/des_opts.c
@@ -71,7 +71,11 @@
#include <io.h>
extern void exit();
#endif
+
+#ifndef OPENSSL_SYS_NETWARE
#include <signal.h>
+#endif
+
#ifndef _IRIX
#include <time.h>
#endif
diff --git a/lib/libcrypto/des/des_ver.h b/lib/libcrypto/des/des_ver.h
index 379bbadda2a..d1ada258a65 100644
--- a/lib/libcrypto/des/des_ver.h
+++ b/lib/libcrypto/des/des_ver.h
@@ -67,5 +67,5 @@
#define DES_version OSSL_DES_version
#define libdes_version OSSL_libdes_version
-OPENSSL_EXTERN const char *OSSL_DES_version; /* SSLeay version string */
-OPENSSL_EXTERN const char *OSSL_libdes_version; /* old libdes version string */
+OPENSSL_EXTERN const char OSSL_DES_version[]; /* SSLeay version string */
+OPENSSL_EXTERN const char OSSL_libdes_version[]; /* old libdes version string */
diff --git a/lib/libcrypto/des/destest.c b/lib/libcrypto/des/destest.c
index e3e9d77f144..64b92a34fe9 100644
--- a/lib/libcrypto/des/destest.c
+++ b/lib/libcrypto/des/destest.c
@@ -84,7 +84,7 @@ int main(int argc, char *argv[])
#else
#include <openssl/des.h>
-#define crypt(c,s) (des_crypt((c),(s)))
+#define crypt(c,s) (DES_crypt((c),(s)))
/* tisk tisk - the test keys don't all have odd parity :-( */
/* test data */
@@ -333,7 +333,8 @@ static int cfb64_test(unsigned char *cfb_cipher);
static int ede_cfb64_test(unsigned char *cfb_cipher);
int main(int argc, char *argv[])
{
- int i,j,err=0;
+ int j,err=0;
+ unsigned int i;
des_cblock in,out,outin,iv3,iv2;
des_key_schedule ks,ks2,ks3;
unsigned char cbc_in[40];
@@ -391,7 +392,7 @@ int main(int argc, char *argv[])
DES_ede3_cbcm_encrypt(cbc_out,cbc_in,i,&ks,&ks2,&ks3,&iv3,&iv2,DES_DECRYPT);
if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
{
- int n;
+ unsigned int n;
printf("des_ede3_cbcm_encrypt decrypt error\n");
for(n=0 ; n < i ; ++n)
@@ -439,8 +440,8 @@ int main(int argc, char *argv[])
memcpy(in,plain_data[i],8);
memset(out,0,8);
memset(outin,0,8);
- des_ecb2_encrypt(in,out,ks,ks2,DES_ENCRYPT);
- des_ecb2_encrypt(out,outin,ks,ks2,DES_DECRYPT);
+ des_ecb2_encrypt(&in,&out,ks,ks2,DES_ENCRYPT);
+ des_ecb2_encrypt(&out,&outin,ks,ks2,DES_DECRYPT);
if (memcmp(out,cipher_ecb2[i],8) != 0)
{
@@ -540,7 +541,7 @@ int main(int argc, char *argv[])
if (memcmp(cbc_out,cbc3_ok,
(unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0)
{
- int n;
+ unsigned int n;
printf("des_ede3_cbc_encrypt encrypt error\n");
for(n=0 ; n < i ; ++n)
@@ -556,7 +557,7 @@ int main(int argc, char *argv[])
des_ede3_cbc_encrypt(cbc_out,cbc_in,i,ks,ks2,ks3,&iv3,DES_DECRYPT);
if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
{
- int n;
+ unsigned int n;
printf("des_ede3_cbc_encrypt decrypt error\n");
for(n=0 ; n < i ; ++n)
@@ -820,6 +821,9 @@ plain[8+4], plain[8+5], plain[8+6], plain[8+7]);
printf("fast crypt error, %s should be yA1Rp/1hZXIJk\n",str);
err=1;
}
+#ifdef OPENSSL_SYS_NETWARE
+ if (err) printf("ERROR: %d\n", err);
+#endif
printf("\n");
return(err);
}
diff --git a/lib/libcrypto/des/ecb3_enc.c b/lib/libcrypto/des/ecb3_enc.c
index fa0c9c4d4fc..c3437bc6062 100644
--- a/lib/libcrypto/des/ecb3_enc.c
+++ b/lib/libcrypto/des/ecb3_enc.c
@@ -58,13 +58,15 @@
#include "des_locl.h"
-void DES_ecb3_encrypt(const unsigned char *in, unsigned char *out,
+void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output,
DES_key_schedule *ks1, DES_key_schedule *ks2,
DES_key_schedule *ks3,
int enc)
{
register DES_LONG l0,l1;
DES_LONG ll[2];
+ const unsigned char *in = &(*input)[0];
+ unsigned char *out = &(*output)[0];
c2l(in,l0);
c2l(in,l1);
diff --git a/lib/libcrypto/des/ecb_enc.c b/lib/libcrypto/des/ecb_enc.c
index 784aa5ba23d..00d5b91e8ca 100644
--- a/lib/libcrypto/des/ecb_enc.c
+++ b/lib/libcrypto/des/ecb_enc.c
@@ -62,8 +62,8 @@
#include <openssl/opensslv.h>
#include <openssl/bio.h>
-OPENSSL_GLOBAL const char *libdes_version="libdes" OPENSSL_VERSION_PTEXT;
-OPENSSL_GLOBAL const char *DES_version="DES" OPENSSL_VERSION_PTEXT;
+OPENSSL_GLOBAL const char libdes_version[]="libdes" OPENSSL_VERSION_PTEXT;
+OPENSSL_GLOBAL const char DES_version[]="DES" OPENSSL_VERSION_PTEXT;
const char *DES_options(void)
{
diff --git a/lib/libcrypto/des/ede_cbcm_enc.c b/lib/libcrypto/des/ede_cbcm_enc.c
index fa45aa272ba..adfcb75cf38 100644
--- a/lib/libcrypto/des/ede_cbcm_enc.c
+++ b/lib/libcrypto/des/ede_cbcm_enc.c
@@ -68,6 +68,8 @@ http://www.cs.technion.ac.il/users/wwwb/cgi-bin/tr-get.cgi/1998/CS/CS0928.ps.gz
*/
+#include <openssl/opensslconf.h> /* To see if OPENSSL_NO_DESCBCM is defined */
+
#ifndef OPENSSL_NO_DESCBCM
#include "des_locl.h"
diff --git a/lib/libcrypto/des/fcrypt.c b/lib/libcrypto/des/fcrypt.c
index 2758c32656a..ccbdff250f7 100644
--- a/lib/libcrypto/des/fcrypt.c
+++ b/lib/libcrypto/des/fcrypt.c
@@ -58,9 +58,6 @@ static unsigned const char cov_2char[64]={
0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A
};
-void fcrypt_body(DES_LONG *out,DES_key_schedule *ks,
- DES_LONG Eswap0, DES_LONG Eswap1);
-
char *DES_crypt(const char *buf, const char *salt)
{
static char buff[14];
diff --git a/lib/libcrypto/des/read2pwd.c b/lib/libcrypto/des/read2pwd.c
index 3a63c4016cc..ee6969f76eb 100644
--- a/lib/libcrypto/des/read2pwd.c
+++ b/lib/libcrypto/des/read2pwd.c
@@ -112,6 +112,7 @@
#include <string.h>
#include <openssl/des.h>
#include <openssl/ui.h>
+#include <openssl/crypto.h>
int DES_read_password(DES_cblock *key, const char *prompt, int verify)
{
diff --git a/lib/libcrypto/des/set_key.c b/lib/libcrypto/des/set_key.c
index 8881d46a7ad..a43ef3c8818 100644
--- a/lib/libcrypto/des/set_key.c
+++ b/lib/libcrypto/des/set_key.c
@@ -65,8 +65,6 @@
*/
#include "des_locl.h"
-#ifndef OPENSSL_FIPS
-
OPENSSL_IMPLEMENT_GLOBAL(int,DES_check_key); /* defaults to false */
static const unsigned char odd_parity[256]={
@@ -89,7 +87,7 @@ static const unsigned char odd_parity[256]={
void DES_set_odd_parity(DES_cblock *key)
{
- int i;
+ unsigned int i;
for (i=0; i<DES_KEY_SZ; i++)
(*key)[i]=odd_parity[(*key)[i]];
@@ -97,7 +95,7 @@ void DES_set_odd_parity(DES_cblock *key)
int DES_check_key_parity(const_DES_cblock *key)
{
- int i;
+ unsigned int i;
for (i=0; i<DES_KEY_SZ; i++)
{
@@ -117,7 +115,7 @@ int DES_check_key_parity(const_DES_cblock *key)
* (and actual cblock values).
*/
#define NUM_WEAK_KEY 16
-static DES_cblock weak_keys[NUM_WEAK_KEY]={
+static const DES_cblock weak_keys[NUM_WEAK_KEY]={
/* weak keys */
{0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01},
{0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE},
@@ -407,5 +405,3 @@ void des_fixup_key_parity(des_cblock *key)
des_set_odd_parity(key);
}
*/
-
-#endif /* ndef OPENSSL_FIPS */
diff --git a/lib/libcrypto/des/speed.c b/lib/libcrypto/des/speed.c
index 48fc1d49fc2..1616f4b7c95 100644
--- a/lib/libcrypto/des/speed.c
+++ b/lib/libcrypto/des/speed.c
@@ -69,7 +69,11 @@
#include OPENSSL_UNISTD_IO
OPENSSL_DECLARE_EXIT
+#ifndef OPENSSL_SYS_NETWARE
#include <signal.h>
+#define crypt(c,s) (des_crypt((c),(s)))
+#endif
+
#ifndef _IRIX
#include <time.h>
#endif
diff --git a/lib/libcrypto/des/str2key.c b/lib/libcrypto/des/str2key.c
index 0373db469c9..9c2054bda6b 100644
--- a/lib/libcrypto/des/str2key.c
+++ b/lib/libcrypto/des/str2key.c
@@ -57,6 +57,7 @@
*/
#include "des_locl.h"
+#include <openssl/crypto.h>
void DES_string_to_key(const char *str, DES_cblock *key)
{
diff --git a/lib/libcrypto/des/xcbc_enc.c b/lib/libcrypto/des/xcbc_enc.c
index 47246eb4664..dc0c761b71f 100644
--- a/lib/libcrypto/des/xcbc_enc.c
+++ b/lib/libcrypto/des/xcbc_enc.c
@@ -60,6 +60,7 @@
/* RSA's DESX */
+#if 0 /* broken code, preserved just in case anyone specifically looks for this */
static unsigned char desx_white_in2out[256]={
0xBD,0x56,0xEA,0xF2,0xA2,0xF1,0xAC,0x2A,0xB0,0x93,0xD1,0x9C,0x1B,0x33,0xFD,0xD0,
0x30,0x04,0xB6,0xDC,0x7D,0xDF,0x32,0x4B,0xF7,0xCB,0x45,0x9B,0x31,0xBB,0x21,0x5A,
@@ -98,7 +99,7 @@ void DES_xwhite_in2out(const_DES_cblock *des_key, const_DES_cblock *in_white,
}
out0=out[0];
- out1=out[i];
+ out1=out[i]; /* BUG: out-of-bounds read */
for (i=0; i<8; i++)
{
out[i]=in[i]^desx_white_in2out[out0^out1];
@@ -106,6 +107,7 @@ void DES_xwhite_in2out(const_DES_cblock *des_key, const_DES_cblock *in_white,
out1=(int)out[i&0x07];
}
}
+#endif
void DES_xcbc_encrypt(const unsigned char *in, unsigned char *out,
long length, DES_key_schedule *schedule,