summaryrefslogtreecommitdiff
path: root/lib/libcrypto/rc2
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>1999-09-29 04:37:45 +0000
committerBob Beck <beck@cvs.openbsd.org>1999-09-29 04:37:45 +0000
commitca679cff5e2a72ad205119c981e695c8cc640970 (patch)
tree691368331190f762b9f484d059ec119620396521 /lib/libcrypto/rc2
parent30902ef04e4a800063b5f4afdbf1732ad34aa6b3 (diff)
OpenSSL 0.9.4 merge
Diffstat (limited to 'lib/libcrypto/rc2')
-rw-r--r--lib/libcrypto/rc2/Makefile.ssl40
-rw-r--r--lib/libcrypto/rc2/Makefile.uni3
-rw-r--r--lib/libcrypto/rc2/rc2.org118
-rw-r--r--lib/libcrypto/rc2/rc2_cbc.c19
-rw-r--r--lib/libcrypto/rc2/rc2_ecb.c12
-rw-r--r--lib/libcrypto/rc2/rc2_skey.c8
-rw-r--r--lib/libcrypto/rc2/rc2cfb64.c12
-rw-r--r--lib/libcrypto/rc2/rc2ofb64.c11
-rw-r--r--lib/libcrypto/rc2/rc2speed.c59
-rw-r--r--lib/libcrypto/rc2/rc2test.c27
10 files changed, 78 insertions, 231 deletions
diff --git a/lib/libcrypto/rc2/Makefile.ssl b/lib/libcrypto/rc2/Makefile.ssl
index c5138f13e29..542397d69aa 100644
--- a/lib/libcrypto/rc2/Makefile.ssl
+++ b/lib/libcrypto/rc2/Makefile.ssl
@@ -7,9 +7,11 @@ TOP= ../..
CC= cc
INCLUDES=
CFLAG=-g
+INSTALL_PREFIX=
+OPENSSLDIR= /usr/local/ssl
INSTALLTOP=/usr/local/ssl
MAKE= make -f Makefile.ssl
-MAKEDEPEND= makedepend -f Makefile.ssl
+MAKEDEPEND= $(TOP)/util/domd $(TOP)
MAKEFILE= Makefile.ssl
AR= ar r
@@ -37,24 +39,23 @@ all: lib
lib: $(LIBOBJ)
$(AR) $(LIB) $(LIBOBJ)
- sh $(TOP)/util/ranlib.sh $(LIB)
+ $(RANLIB) $(LIB)
@touch lib
files:
- perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
+ $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
links:
- /bin/rm -f Makefile
- $(TOP)/util/point.sh Makefile.ssl Makefile ;
- $(TOP)/util/mklink.sh ../../include $(EXHEADER)
- $(TOP)/util/mklink.sh ../../test $(TEST)
- $(TOP)/util/mklink.sh ../../apps $(APPS)
+ @$(TOP)/util/point.sh Makefile.ssl Makefile
+ @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
+ @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
+ @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
install:
@for i in $(EXHEADER) ; \
do \
- (cp $$i $(INSTALLTOP)/include/$$i; \
- chmod 644 $(INSTALLTOP)/include/$$i ); \
+ (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
+ chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
done;
tags:
@@ -66,15 +67,24 @@ lint:
lint -DLINT $(INCLUDES) $(SRC)>fluff
depend:
- $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC)
+ $(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
dclean:
- perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
+ $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
mv -f Makefile.new $(MAKEFILE)
clean:
- /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-
-errors:
+ rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+rc2_cbc.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h
+rc2_cbc.o: rc2_locl.h
+rc2_ecb.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
+rc2_ecb.o: ../../include/openssl/rc2.h rc2_locl.h
+rc2_skey.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h
+rc2_skey.o: rc2_locl.h
+rc2cfb64.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h
+rc2cfb64.o: rc2_locl.h
+rc2ofb64.o: ../../include/openssl/opensslconf.h ../../include/openssl/rc2.h
+rc2ofb64.o: rc2_locl.h
diff --git a/lib/libcrypto/rc2/Makefile.uni b/lib/libcrypto/rc2/Makefile.uni
index e50b3f2d197..4dc20c6fcfd 100644
--- a/lib/libcrypto/rc2/Makefile.uni
+++ b/lib/libcrypto/rc2/Makefile.uni
@@ -15,6 +15,7 @@ MAKE= make
MAKEDEPEND= makedepend
MAKEFILE= Makefile.uni
AR= ar r
+RANLIB= ranlib
IDEA_ENC=rc2_cbc.o
@@ -39,7 +40,7 @@ all: $(LIB) $(TEST) $(APPS)
$(LIB): $(LIBOBJ)
$(AR) $(LIB) $(LIBOBJ)
- sh $(TOP)/ranlib.sh $(LIB)
+ $(RANLIB) $(LIB)
test: $(TEST)
./$(TEST)
diff --git a/lib/libcrypto/rc2/rc2.org b/lib/libcrypto/rc2/rc2.org
deleted file mode 100644
index 37354cfa620..00000000000
--- a/lib/libcrypto/rc2/rc2.org
+++ /dev/null
@@ -1,118 +0,0 @@
-/* crypto/rc2/rc2.org */
-/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay@cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- *
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attribution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay@cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the library
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from
- * the apps directory (application code) you must include an acknowledgement:
- * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- *
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * The licence and distribution terms for any publically available version or
- * derivative of this code cannot be changed. i.e. this code cannot simply be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
- *
- * Always modify rc2.org since rc2.h is automatically generated from
- * it during SSLeay configuration.
- *
- * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
- */
-
-#ifndef HEADER_RC2_H
-#define HEADER_RC2_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define RC2_ENCRYPT 1
-#define RC2_DECRYPT 0
-
-/* I need to put in a mod for the alpha - eay */
-#define RC2_INT unsigned short
-
-#define RC2_BLOCK 8
-#define RC2_KEY_LENGTH 16
-
-typedef struct rc2_key_st
- {
- RC2_INT data[64];
- } RC2_KEY;
-
-#ifndef NOPROTO
-
-void RC2_set_key(RC2_KEY *key, int len, unsigned char *data,int bits);
-void RC2_ecb_encrypt(unsigned char *in,unsigned char *out,RC2_KEY *key,
- int enc);
-void RC2_encrypt(unsigned long *data,RC2_KEY *key);
-void RC2_decrypt(unsigned long *data,RC2_KEY *key);
-void RC2_cbc_encrypt(unsigned char *in, unsigned char *out, long length,
- RC2_KEY *ks, unsigned char *iv, int enc);
-void RC2_cfb64_encrypt(unsigned char *in, unsigned char *out, long length,
- RC2_KEY *schedule, unsigned char *ivec, int *num, int enc);
-void RC2_ofb64_encrypt(unsigned char *in, unsigned char *out, long length,
- RC2_KEY *schedule, unsigned char *ivec, int *num);
-
-#else
-
-void RC2_set_key();
-void RC2_ecb_encrypt();
-void RC2_encrypt();
-void RC2_decrypt();
-void RC2_cbc_encrypt();
-void RC2_cfb64_encrypt();
-void RC2_ofb64_encrypt();
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/lib/libcrypto/rc2/rc2_cbc.c b/lib/libcrypto/rc2/rc2_cbc.c
index 22e89f04418..1202184e85e 100644
--- a/lib/libcrypto/rc2/rc2_cbc.c
+++ b/lib/libcrypto/rc2/rc2_cbc.c
@@ -56,16 +56,11 @@
* [including the GNU Public Licence.]
*/
-#include "rc2.h"
+#include <openssl/rc2.h>
#include "rc2_locl.h"
-void RC2_cbc_encrypt(in, out, length, ks, iv, encrypt)
-unsigned char *in;
-unsigned char *out;
-long length;
-RC2_KEY *ks;
-unsigned char *iv;
-int encrypt;
+void RC2_cbc_encrypt(unsigned char *in, unsigned char *out, long length,
+ RC2_KEY *ks, unsigned char *iv, int encrypt)
{
register unsigned long tin0,tin1;
register unsigned long tout0,tout1,xor0,xor1;
@@ -138,9 +133,7 @@ int encrypt;
tin[0]=tin[1]=0;
}
-void RC2_encrypt(d,key)
-unsigned long *d;
-RC2_KEY *key;
+void RC2_encrypt(unsigned long *d, RC2_KEY *key)
{
int i,n;
register RC2_INT *p0,*p1;
@@ -185,9 +178,7 @@ RC2_KEY *key;
d[1]=(unsigned long)(x2&0xffff)|((unsigned long)(x3&0xffff)<<16L);
}
-void RC2_decrypt(d,key)
-unsigned long *d;
-RC2_KEY *key;
+void RC2_decrypt(unsigned long *d, RC2_KEY *key)
{
int i,n;
register RC2_INT *p0,*p1;
diff --git a/lib/libcrypto/rc2/rc2_ecb.c b/lib/libcrypto/rc2/rc2_ecb.c
index 96239cd4e03..7d77b9186ca 100644
--- a/lib/libcrypto/rc2/rc2_ecb.c
+++ b/lib/libcrypto/rc2/rc2_ecb.c
@@ -56,10 +56,11 @@
* [including the GNU Public Licence.]
*/
-#include "rc2.h"
+#include <openssl/rc2.h>
#include "rc2_locl.h"
+#include <openssl/opensslv.h>
-char *RC2_version="RC2 part of SSLeay 0.9.0b 29-Jun-1998";
+const char *RC2_version="RC2" OPENSSL_VERSION_PTEXT;
/* RC2 as implemented frm a posting from
* Newsgroups: sci.crypt
@@ -69,11 +70,8 @@ char *RC2_version="RC2 part of SSLeay 0.9.0b 29-Jun-1998";
* Date: 11 Feb 1996 06:45:03 GMT
*/
-void RC2_ecb_encrypt(in, out, ks, encrypt)
-unsigned char *in;
-unsigned char *out;
-RC2_KEY *ks;
-int encrypt;
+void RC2_ecb_encrypt(unsigned char *in, unsigned char *out, RC2_KEY *ks,
+ int encrypt)
{
unsigned long l,d[2];
diff --git a/lib/libcrypto/rc2/rc2_skey.c b/lib/libcrypto/rc2/rc2_skey.c
index 0f1f2533959..7143c4e591a 100644
--- a/lib/libcrypto/rc2/rc2_skey.c
+++ b/lib/libcrypto/rc2/rc2_skey.c
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
-#include "rc2.h"
+#include <openssl/rc2.h>
#include "rc2_locl.h"
static unsigned char key_table[256]={
@@ -90,11 +90,7 @@ static unsigned char key_table[256]={
* BSAFE uses the 'retarded' version. What I previously shipped is
* the same as specifying 1024 for the 'bits' parameter. Bsafe uses
* a version where the bits parameter is the same as len*8 */
-void RC2_set_key(key,len,data,bits)
-RC2_KEY *key;
-int len;
-unsigned char *data;
-int bits;
+void RC2_set_key(RC2_KEY *key, int len, unsigned char *data, int bits)
{
int i,j;
unsigned char *k;
diff --git a/lib/libcrypto/rc2/rc2cfb64.c b/lib/libcrypto/rc2/rc2cfb64.c
index d409fb77e90..5e3fa07d907 100644
--- a/lib/libcrypto/rc2/rc2cfb64.c
+++ b/lib/libcrypto/rc2/rc2cfb64.c
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
-#include "rc2.h"
+#include <openssl/rc2.h>
#include "rc2_locl.h"
/* The input and output encrypted as though 64bit cfb mode is being
@@ -64,14 +64,8 @@
* 64bit block we have used is contained in *num;
*/
-void RC2_cfb64_encrypt(in, out, length, schedule, ivec, num, encrypt)
-unsigned char *in;
-unsigned char *out;
-long length;
-RC2_KEY *schedule;
-unsigned char *ivec;
-int *num;
-int encrypt;
+void RC2_cfb64_encrypt(unsigned char *in, unsigned char *out, long length,
+ RC2_KEY *schedule, unsigned char *ivec, int *num, int encrypt)
{
register unsigned long v0,v1,t;
register int n= *num;
diff --git a/lib/libcrypto/rc2/rc2ofb64.c b/lib/libcrypto/rc2/rc2ofb64.c
index 4f091674475..42cdd40cdd9 100644
--- a/lib/libcrypto/rc2/rc2ofb64.c
+++ b/lib/libcrypto/rc2/rc2ofb64.c
@@ -56,20 +56,15 @@
* [including the GNU Public Licence.]
*/
-#include "rc2.h"
+#include <openssl/rc2.h>
#include "rc2_locl.h"
/* The input and output encrypted as though 64bit ofb mode is being
* used. The extra state information to record how much of the
* 64bit block we have used is contained in *num;
*/
-void RC2_ofb64_encrypt(in, out, length, schedule, ivec, num)
-unsigned char *in;
-unsigned char *out;
-long length;
-RC2_KEY *schedule;
-unsigned char *ivec;
-int *num;
+void RC2_ofb64_encrypt(unsigned char *in, unsigned char *out, long length,
+ RC2_KEY *schedule, unsigned char *ivec, int *num)
{
register unsigned long v0,v1,t;
register int n= *num;
diff --git a/lib/libcrypto/rc2/rc2speed.c b/lib/libcrypto/rc2/rc2speed.c
index 6cd8ea8f27c..c3da63e77eb 100644
--- a/lib/libcrypto/rc2/rc2speed.c
+++ b/lib/libcrypto/rc2/rc2speed.c
@@ -59,19 +59,17 @@
/* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */
/* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */
-#ifndef MSDOS
+#if !defined(MSDOS) && (!defined(VMS) || defined(__DECC))
#define TIMES
#endif
#include <stdio.h>
-#ifndef MSDOS
-#include <unistd.h>
-#else
-#include <io.h>
-extern int exit();
-#endif
+
+#include <openssl/e_os2.h>
+#include OPENSSL_UNISTD_IO
+OPENSSL_DECLARE_EXIT
+
#include <signal.h>
-#ifndef VMS
#ifndef _IRIX
#include <time.h>
#endif
@@ -79,48 +77,40 @@ extern int exit();
#include <sys/types.h>
#include <sys/times.h>
#endif
-#else /* VMS */
-#include <types.h>
-struct tms {
- time_t tms_utime;
- time_t tms_stime;
- time_t tms_uchild; /* I dunno... */
- time_t tms_uchildsys; /* so these names are a guess :-) */
- }
+
+/* Depending on the VMS version, the tms structure is perhaps defined.
+ The __TMS macro will show if it was. If it wasn't defined, we should
+ undefine TIMES, since that tells the rest of the program how things
+ should be handled. -- Richard Levitte */
+#if defined(VMS) && defined(__DECC) && !defined(__TMS)
+#undef TIMES
#endif
+
#ifndef TIMES
#include <sys/timeb.h>
#endif
-#ifdef sun
+#if defined(sun) || defined(__ultrix)
+#define _POSIX_SOURCE
#include <limits.h>
#include <sys/param.h>
#endif
-#include "rc2.h"
+#include <openssl/rc2.h>
/* The following if from times(3) man page. It may need to be changed */
#ifndef HZ
#ifndef CLK_TCK
-#ifndef VMS
-#define HZ 100.0
-#else /* VMS */
#define HZ 100.0
#endif
#else /* CLK_TCK */
#define HZ ((double)CLK_TCK)
#endif
-#endif
#define BUFSIZE ((long)1024)
long run=0;
-#ifndef NOPROTO
double Time_F(int s);
-#else
-double Time_F();
-#endif
-
#ifdef SIGALRM
#if defined(__STDC__) || defined(sgi) || defined(_AIX)
#define SIGRETTYPE void
@@ -128,14 +118,8 @@ double Time_F();
#define SIGRETTYPE int
#endif
-#ifndef NOPROTO
SIGRETTYPE sig_done(int sig);
-#else
-SIGRETTYPE sig_done();
-#endif
-
-SIGRETTYPE sig_done(sig)
-int sig;
+SIGRETTYPE sig_done(int sig)
{
signal(SIGALRM,sig_done);
run=0;
@@ -148,8 +132,7 @@ int sig;
#define START 0
#define STOP 1
-double Time_F(s)
-int s;
+double Time_F(int s)
{
double ret;
#ifdef TIMES
@@ -185,9 +168,7 @@ int s;
#endif
}
-int main(argc,argv)
-int argc;
-char **argv;
+int main(int argc, char **argv)
{
long count;
static unsigned char buf[BUFSIZE];
diff --git a/lib/libcrypto/rc2/rc2test.c b/lib/libcrypto/rc2/rc2test.c
index 9d0f8016ec4..6a5defa6ea8 100644
--- a/lib/libcrypto/rc2/rc2test.c
+++ b/lib/libcrypto/rc2/rc2test.c
@@ -62,7 +62,15 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include "rc2.h"
+
+#ifdef NO_RC2
+int main(int argc, char *argv[])
+{
+ printf("No RC2 support\n");
+ return(0);
+}
+#else
+#include <openssl/rc2.h>
unsigned char RC2key[4][16]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@@ -125,19 +133,11 @@ static unsigned char cfb_cipher64[CFB_TEST_SIZE]={
};
-#ifndef NOPROTO
/*static int cfb64_test(unsigned char *cfb_cipher);*/
static char *pt(unsigned char *p);
-#else
-/*static int cfb64_test(); */
-static char *pt();
#endif
-#endif
-
-int main(argc,argv)
-int argc;
-char *argv[];
+int main(int argc, char *argv[])
{
int i,n,err=0;
RC2_KEY key;
@@ -208,8 +208,7 @@ char *argv[];
}
#ifdef undef
-static int cfb64_test(cfb_cipher)
-unsigned char *cfb_cipher;
+static int cfb64_test(unsigned char *cfb_cipher)
{
IDEA_KEY_SCHEDULE eks,dks;
int err=0,i,n;
@@ -247,8 +246,7 @@ unsigned char *cfb_cipher;
return(err);
}
-static char *pt(p)
-unsigned char *p;
+static char *pt(unsigned char *p)
{
static char bufs[10][20];
static int bnum=0;
@@ -268,3 +266,4 @@ unsigned char *p;
}
#endif
+#endif