diff options
Diffstat (limited to 'crypto/openssl')
39 files changed, 533 insertions, 843 deletions
diff --git a/crypto/openssl/FREEBSD-Xlist b/crypto/openssl/FREEBSD-Xlist index 2721c7a..251b224 100644 --- a/crypto/openssl/FREEBSD-Xlist +++ b/crypto/openssl/FREEBSD-Xlist @@ -1,25 +1,39 @@ $FreeBSD$ -*INSTALL.VMS -*INSTALL.W32 -*VMS/ +INSTALL.MacOS +INSTALL.VMS +INSTALL.W32 +MacOS/ +VMS/ *.bat *.com */*.bat */*.com -*apps/openssl-vms.cnf -*crypto/bf/asm/b-win32.asm -*crypto/bn/asm/bn-win32.asm -*crypto/bn/asm/vms.mar -*crypto/bn/asm/x86w16.asm -*crypto/bn/asm/x86w32.asm -*crypto/bn/vms-helper.c -*crypto/cast/asm/c-win32.asm -*crypto/des/asm/d-win32.asm -*crypto/des/asm/y-win32.asm -*crypto/des/des-lib.com -*crypto/md5/asm/m5-win32.asm -*crypto/rc4/asm/r4-win32.asm -*crypto/rc5/asm/r5-win32.asm -*crypto/ripemd/asm/rm-win32.asm -*crypto/sha/asm/s1-win32.asm -*ms/ +*/*/*.bat +*/*/*.com +apps/openssl-vms.cnf +crypto/bf/asm/b-win32.asm +crypto/bn/asm/bn-win32.asm +crypto/bn/asm/vms.mar +crypto/bn/asm/x86w16.asm +crypto/bn/asm/x86w32.asm +crypto/bn/vms-helper.c +crypto/cast/asm/c-win32.asm +crypto/des/asm/d-win32.asm +crypto/des/asm/y-win32.asm +crypto/des/des-lib.com +crypto/dso/dso_vms.c +crypto/dso/dso_win32.c +crypto/md5/asm/m5-win32.asm +crypto/rc4/asm/r4-win32.asm +crypto/rc5/asm/r5-win32.asm +crypto/ripemd/asm/rm-win32.asm +crypto/sha/asm/s1-win32.asm +crypto/threads/solaris.sh +ms/ +shlib/Makefile.hpux10-cc +shlib/hpux10-cc.sh +shlib/irix.sh +shlib/solaris-sc4.sh +shlib/solaris.sh +shlib/sun.sh +vms/ diff --git a/crypto/openssl/apps/openssl.cnf b/crypto/openssl/apps/openssl.cnf index dbe8cbe..2ba3b2a 100644 --- a/crypto/openssl/apps/openssl.cnf +++ b/crypto/openssl/apps/openssl.cnf @@ -2,6 +2,7 @@ # OpenSSL example configuration file. # This is mostly being used for generation of certificate requests. # +# $FreeBSD$ # This definition stops the following lines choking if HOME isn't # defined. diff --git a/crypto/openssl/apps/speed.c b/crypto/openssl/apps/speed.c index 2900470..4a42aeb 100644 --- a/crypto/openssl/apps/speed.c +++ b/crypto/openssl/apps/speed.c @@ -54,6 +54,8 @@ * 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.] + * + * $FreeBSD$ */ /* most of this code has been pilfered from my libdes speed.c program */ @@ -82,12 +84,12 @@ #include <openssl/rand.h> #include <openssl/err.h> -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +#if defined(__FreeBSD__) # define USE_TOD #elif !defined(MSDOS) && (!defined(VMS) || defined(__DECC)) # define TIMES #endif -#if !defined(_UNICOS) && !defined(__OpenBSD__) && !defined(sgi) && !defined(__FreeBSD__) && !(defined(__bsdi) || defined(__bsdi__)) && !defined(_AIX) && !defined(MPE) && !defined(__NetBSD__) +#if !defined(_UNICOS) && !defined(__OpenBSD__) && !defined(sgi) && !defined(__FreeBSD__) && !(defined(__bsdi) || defined(__bsdi__)) && !defined(_AIX) && !defined(MPE) # define TIMEB #endif diff --git a/crypto/openssl/crypto/des/des.h b/crypto/openssl/crypto/des/des.h index 6b8a7ee..6207e08 100644 --- a/crypto/openssl/crypto/des/des.h +++ b/crypto/openssl/crypto/des/des.h @@ -54,6 +54,7 @@ * 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.] + * $FreeBSD$ */ #ifndef HEADER_DES_H @@ -200,6 +201,9 @@ void des_pcbc_encrypt(const unsigned char *input,unsigned char *output, DES_LONG des_quad_cksum(const unsigned char *input,des_cblock output[], long length,int out_count,des_cblock *seed); void des_random_seed(des_cblock *key); +int des_new_random_key(des_cblock *key); +void des_init_random_number_generator(des_cblock *seed); +void des_rand_data(unsigned char *data, int size); int des_random_key(des_cblock *ret); int des_read_password(des_cblock *key,const char *prompt,int verify); int des_read_2passwords(des_cblock *key1,des_cblock *key2, diff --git a/crypto/openssl/crypto/des/des_crypt.man b/crypto/openssl/crypto/des/des_crypt.man index 0ecc416..ed12ff9 100644 --- a/crypto/openssl/crypto/des/des_crypt.man +++ b/crypto/openssl/crypto/des/des_crypt.man @@ -1,3 +1,4 @@ +.\" $FreeBSD$ .TH DES_CRYPT 3 .SH NAME des_read_password, des_read_2password, @@ -13,7 +14,7 @@ des_is_weak_key, crypt \- (non USA) DES encryption .nf .nj .ft B -#include <des.h> +#include <openssl/des.h> .PP .B int des_read_password(key,prompt,verify) des_cblock *key; @@ -461,9 +462,9 @@ is a replacement for the normal system crypt. It is much faster than the system crypt. .PP .SH FILES -/usr/include/des.h +/usr/include/openssl/des.h .br -/usr/lib/libdes.a +/usr/lib/libcrypto.a .PP The encryption routines have been tested on 16bit, 32bit and 64bit machines of various endian and even works under VMS. diff --git a/crypto/openssl/crypto/des/rnd_keys.c b/crypto/openssl/crypto/des/rnd_keys.c new file mode 100644 index 0000000..c2626c4 --- /dev/null +++ b/crypto/openssl/crypto/des/rnd_keys.c @@ -0,0 +1,444 @@ +/* + * Copyright (c) 1995, 1996, 1997, 1999 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * 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 above 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 software developed by the Kungliga Tekniska + * Högskolan and its contributors. + * + * 4. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE 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. + * + * $Id$ + * $FreeBSD$ + */ + +#include <openssl/des.h> +#include <sys/types.h> +#include <sys/wait.h> +#include <sys/time.h> +#include <sys/resource.h> +#include <fcntl.h> +#include <signal.h> +#include <string.h> +#include <time.h> +#include <unistd.h> + +#ifndef RETSIGTYPE +#define RETSIGTYPE void +#define SIGRETURN(x) return +#else +#define SIGRETURN(x) return (RETSIGTYPE)(x) +#endif + +/* + * Generate "random" data by checksumming a file. + * + * Returns -1 if there were any problems with permissions or I/O + * errors. + */ +static +int +sumFile (const char *name, int len, void *res) +{ + u_int32_t sum[2]; + u_int32_t buf[1024*2]; + int fd, i; + + fd = open (name, 0); + if (fd < 0) + return -1; + + while (len > 0) + { + int n = read(fd, buf, sizeof(buf)); + if (n < 0) + { + close(fd); + return n; + } + for (i = 0; i < (n/sizeof(buf[0])); i++) + { + sum[0] += buf[i]; + i++; + sum[1] += buf[i]; + } + len -= n; + } + close (fd); + memcpy (res, &sum, sizeof(sum)); + return 0; +} + +/* + * Create a sequence of random 64 bit blocks. + * The sequence is indexed with a long long and + * based on an initial des key used as a seed. + */ +static des_key_schedule sequence_seed; +static u_int32_t sequence_index[2]; + +/* + * Random number generator based on ideas from truerand in cryptolib + * as described on page 424 in Applied Cryptography 2 ed. by Bruce + * Schneier. + */ + +static volatile int counter; +static volatile unsigned char *gdata; /* Global data */ +static volatile int igdata; /* Index into global data */ +static int gsize; + +#if !defined(WIN32) && !defined(__EMX__) && !defined(__OS2__) && !defined(__CYGWIN32__) +/* Visual C++ 4.0 (Windows95/NT) */ + +static +RETSIGTYPE +sigALRM(int sig) +{ + if (igdata < gsize) + gdata[igdata++] ^= counter & 0xff; + +#ifndef HAVE_SIGACTION + signal(SIGALRM, sigALRM); /* Reinstall SysV signal handler */ +#endif + SIGRETURN(0); +} + +#endif + +#if !defined(HAVE_RANDOM) && defined(HAVE_RAND) +#ifndef srandom +#define srandom srand +#endif +#ifndef random +#define random rand +#endif +#endif + +static void +des_not_rand_data(unsigned char *data, int size) +{ + int i; + + srandom (time (NULL)); + + for(i = 0; i < size; ++i) + data[i] ^= random() % 0x100; +} + +#if !defined(WIN32) && !defined(__EMX__) && !defined(__OS2__) && !defined(__CYGWIN32__) + +#ifndef HAVE_SETITIMER +static void +pacemaker(struct timeval *tv) +{ + fd_set fds; + pid_t pid; + pid = getppid(); + while(1){ + FD_ZERO(&fds); + FD_SET(0, &fds); + select(1, &fds, NULL, NULL, tv); + kill(pid, SIGALRM); + } +} +#endif + +#ifdef HAVE_SIGACTION +/* XXX ugly hack, should perhaps use function from roken */ +static RETSIGTYPE +(*fake_signal(int sig, RETSIGTYPE (*f)(int)))(int) +{ + struct sigaction sa, osa; + sa.sa_handler = f; + sa.sa_flags = 0; + sigemptyset(&sa.sa_mask); + sigaction(sig, &sa, &osa); + return osa.sa_handler; +} +#define signal(S, F) fake_signal((S), (F)) +#endif + +/* + * Generate size bytes of "random" data using timed interrupts. + * It takes about 40ms/byte random data. + * It's not neccessary to be root to run it. + */ +void +des_rand_data(unsigned char *data, int size) +{ + struct itimerval tv; +#ifdef HAVE_SETITIMER + struct itimerval otv; +#endif + RETSIGTYPE (*osa)(int); + int i, j; +#ifndef HAVE_SETITIMER + RETSIGTYPE (*ochld)(int); + pid_t pid; +#endif + char *rnd_devices[] = {"/dev/random", + "/dev/srandom", + "/dev/urandom", + NULL}; + char **p; + + for(p = rnd_devices; *p; p++) { + int fd = open(*p, O_RDONLY | O_NDELAY); + + if(fd >= 0 && read(fd, data, size) == size) { + close(fd); + return; + } + close(fd); + } + + /* Paranoia? Initialize data from /dev/mem if we can read it. */ + if (size >= 8) + sumFile("/dev/mem", (1024*1024*2), data); + + gdata = data; + gsize = size; + igdata = 0; + + osa = signal(SIGALRM, sigALRM); + + /* Start timer */ + tv.it_value.tv_sec = 0; + tv.it_value.tv_usec = 10 * 1000; /* 10 ms */ + tv.it_interval = tv.it_value; +#ifdef HAVE_SETITIMER + setitimer(ITIMER_REAL, &tv, &otv); +#else + ochld = signal(SIGCHLD, SIG_IGN); + pid = fork(); + if(pid == -1){ + signal(SIGCHLD, ochld != SIG_ERR ? ochld : SIG_DFL); + des_not_rand_data(data, size); + return; + } + if(pid == 0) + pacemaker(&tv.it_interval); +#endif + + for(i = 0; i < 4; i++) { + for (igdata = 0; igdata < size;) /* igdata++ in sigALRM */ + counter++; + for (j = 0; j < size; j++) /* Only use 2 bits each lap */ + gdata[j] = (gdata[j]>>2) | (gdata[j]<<6); + } +#ifdef HAVE_SETITIMER + setitimer(ITIMER_REAL, &otv, 0); +#else + kill(pid, SIGKILL); + while(waitpid(pid, NULL, 0) != pid); + signal(SIGCHLD, ochld != SIG_ERR ? ochld : SIG_DFL); +#endif + signal(SIGALRM, osa != SIG_ERR ? osa : SIG_DFL); +} +#else +void +des_rand_data(unsigned char *p, int s) +{ + des_not_rand_data (p, s); +} +#endif + +void +des_generate_random_block(des_cblock *block) +{ + des_rand_data((unsigned char *)block, sizeof(*block)); +} + +/* + * Generate a "random" DES key. + */ +void +des_rand_data_key(des_cblock *key) +{ + unsigned char data[8]; + des_key_schedule sched; + do { + des_rand_data(data, sizeof(data)); + des_rand_data((unsigned char*)key, sizeof(des_cblock)); + des_set_odd_parity(key); + des_key_sched(key, sched); + des_ecb_encrypt(&data, key, sched, DES_ENCRYPT); + memset(&data, 0, sizeof(data)); + memset(&sched, 0, sizeof(sched)); + des_set_odd_parity(key); + } while(des_is_weak_key(key)); +} + +/* + * Generate "random" data by checksumming /dev/mem + * + * It's neccessary to be root to run it. Returns -1 if there were any + * problems with permissions. + */ +int +des_mem_rand8(unsigned char *data) +{ + return 1; +} + +/* + * In case the generator does not get initialized use this as fallback. + */ +static int initialized; + +static void +do_initialize(void) +{ + des_cblock default_seed; + do { + des_generate_random_block(&default_seed); + des_set_odd_parity(&default_seed); + } while (des_is_weak_key(&default_seed)); + des_init_random_number_generator(&default_seed); +} + +#define zero_long_long(ll) do { ll[0] = ll[1] = 0; } while (0) + +#define incr_long_long(ll) do { if (++ll[0] == 0) ++ll[1]; } while (0) + +#define set_sequence_number(ll) \ +memcpy((char *)sequence_index, (ll), sizeof(sequence_index)); + +/* + * Set the sequnce number to this value (a long long). + */ +void +des_set_sequence_number(unsigned char *ll) +{ + set_sequence_number(ll); +} + +/* + * Set the generator seed and reset the sequence number to 0. + */ +void +des_set_random_generator_seed(des_cblock *seed) +{ + des_key_sched(seed, sequence_seed); + zero_long_long(sequence_index); + initialized = 1; +} + +/* + * Generate a sequence of random des keys + * using the random block sequence, fixup + * parity and skip weak keys. + */ +int +des_new_random_key(des_cblock *key) +{ + if (!initialized) + do_initialize(); + + do { + des_ecb_encrypt((des_cblock *) sequence_index, + key, + sequence_seed, + DES_ENCRYPT); + incr_long_long(sequence_index); + /* random key must have odd parity and not be weak */ + des_set_odd_parity(key); + } while (des_is_weak_key(key)); + return(0); +} + +/* + * des_init_random_number_generator: + * + * Initialize the sequence of random 64 bit blocks. The input seed + * can be a secret key since it should be well hidden and is also not + * kept. + * + */ +void +des_init_random_number_generator(des_cblock *seed) +{ + struct timeval now; + des_cblock uniq; + des_cblock new_key; + + gettimeofday(&now, (struct timezone *)0); + des_generate_random_block(&uniq); + + /* Pick a unique random key from the shared sequence. */ + des_set_random_generator_seed(seed); + set_sequence_number((unsigned char *)&uniq); + des_new_random_key(&new_key); + + /* Select a new nonshared sequence, */ + des_set_random_generator_seed(&new_key); + + /* and use the current time to pick a key for the new sequence. */ + set_sequence_number((unsigned char *)&now); + des_new_random_key(&new_key); + des_set_random_generator_seed(&new_key); +} + +#ifdef TESTRUN +int +main() +{ + unsigned char data[8]; + int i; + + while (1) + { + if (sumFile("/dev/mem", (1024*1024*8), data) != 0) + { perror("sumFile"); exit(1); } + for (i = 0; i < 8; i++) + printf("%02x", data[i]); + printf("\n"); + } +} +#endif + +#ifdef TESTRUN2 +int +main() +{ + des_cblock data; + int i; + + while (1) + { + do_initialize(); + des_random_key(data); + for (i = 0; i < 8; i++) + printf("%02x", data[i]); + printf("\n"); + } +} +#endif diff --git a/crypto/openssl/crypto/err/err_all.c b/crypto/openssl/crypto/err/err_all.c index 638ed3f..5449a31 100644 --- a/crypto/openssl/crypto/err/err_all.c +++ b/crypto/openssl/crypto/err/err_all.c @@ -1,4 +1,5 @@ /* crypto/err/err_all.c */ +/* $FreeBSD$ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/crypto/openssl/crypto/evp/evp.h b/crypto/openssl/crypto/evp/evp.h index 0f27df4..b7820be 100644 --- a/crypto/openssl/crypto/evp/evp.h +++ b/crypto/openssl/crypto/evp/evp.h @@ -54,6 +54,8 @@ * 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.] + * + * $FreeBSD$ */ #ifndef HEADER_ENVELOPE_H @@ -554,9 +556,9 @@ int EVP_read_pw_string(char *buf,int length,const char *prompt,int verify); void EVP_set_pw_prompt(char *prompt); char * EVP_get_pw_prompt(void); -int EVP_BytesToKey(const EVP_CIPHER *type, EVP_MD *md, - const unsigned char *salt, const unsigned char *data, int datal, - int count, unsigned char *key, unsigned char *iv); +int EVP_BytesToKey(const EVP_CIPHER *type,EVP_MD *md,unsigned char *salt, + unsigned char *data, int datal, int count, + unsigned char *key,unsigned char *iv); int EVP_EncryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type, unsigned char *key, unsigned char *iv); diff --git a/crypto/openssl/crypto/idea/Makefile.save b/crypto/openssl/crypto/idea/Makefile.save index d29bcd6..ac32f13 100644 --- a/crypto/openssl/crypto/idea/Makefile.save +++ b/crypto/openssl/crypto/idea/Makefile.save @@ -1,5 +1,6 @@ # # SSLeay/crypto/idea/Makefile +# $FreeBSD$ # DIR= idea @@ -39,8 +40,7 @@ all: lib lib: $(LIBOBJ) $(AR) $(LIB) $(LIBOBJ) - @echo You may get an error following this line. Please ignore. - - $(RANLIB) $(LIB) + $(RANLIB) $(LIB) @touch lib files: diff --git a/crypto/openssl/crypto/idea/Makefile.ssl b/crypto/openssl/crypto/idea/Makefile.ssl index d29bcd6..8923d7d 100644 --- a/crypto/openssl/crypto/idea/Makefile.ssl +++ b/crypto/openssl/crypto/idea/Makefile.ssl @@ -1,5 +1,6 @@ # # SSLeay/crypto/idea/Makefile +# $FreeBSD$ # DIR= idea diff --git a/crypto/openssl/crypto/idea/Makefile.uni b/crypto/openssl/crypto/idea/Makefile.uni index c83339a..d7c9844 100644 --- a/crypto/openssl/crypto/idea/Makefile.uni +++ b/crypto/openssl/crypto/idea/Makefile.uni @@ -2,6 +2,7 @@ # make - twidle the options yourself :-) # make cc - standard cc options # make gcc - standard gcc options +# $FreeBSD$ DIR= cast TOP= . diff --git a/crypto/openssl/crypto/idea/i_cbc.c b/crypto/openssl/crypto/idea/i_cbc.c index ecb9cb8..d141cc2 100644 --- a/crypto/openssl/crypto/idea/i_cbc.c +++ b/crypto/openssl/crypto/idea/i_cbc.c @@ -54,6 +54,7 @@ * 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.] + * $FreeBSD$ */ #include <openssl/idea.h> diff --git a/crypto/openssl/crypto/idea/i_cfb64.c b/crypto/openssl/crypto/idea/i_cfb64.c index 66d49d5..6f7e364 100644 --- a/crypto/openssl/crypto/idea/i_cfb64.c +++ b/crypto/openssl/crypto/idea/i_cfb64.c @@ -54,6 +54,7 @@ * 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.] + * $FreeBSD$ */ #include <openssl/idea.h> diff --git a/crypto/openssl/crypto/idea/i_ecb.c b/crypto/openssl/crypto/idea/i_ecb.c index fb613db..3789cb5 100644 --- a/crypto/openssl/crypto/idea/i_ecb.c +++ b/crypto/openssl/crypto/idea/i_ecb.c @@ -54,6 +54,7 @@ * 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.] + * $FreeBSD$ */ #include <openssl/idea.h> diff --git a/crypto/openssl/crypto/idea/i_ofb64.c b/crypto/openssl/crypto/idea/i_ofb64.c index e749e88..b3397f9 100644 --- a/crypto/openssl/crypto/idea/i_ofb64.c +++ b/crypto/openssl/crypto/idea/i_ofb64.c @@ -54,6 +54,7 @@ * 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.] + * $FreeBSD$ */ #include <openssl/idea.h> diff --git a/crypto/openssl/crypto/idea/i_skey.c b/crypto/openssl/crypto/idea/i_skey.c index 1c95bc9..5fea5cc 100644 --- a/crypto/openssl/crypto/idea/i_skey.c +++ b/crypto/openssl/crypto/idea/i_skey.c @@ -54,6 +54,7 @@ * 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.] + * $FreeBSD$ */ #include <openssl/idea.h> diff --git a/crypto/openssl/crypto/idea/idea.h b/crypto/openssl/crypto/idea/idea.h index f14adf8..31d3c89 100644 --- a/crypto/openssl/crypto/idea/idea.h +++ b/crypto/openssl/crypto/idea/idea.h @@ -54,6 +54,7 @@ * 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.] + * $FreeBSD$ */ #ifndef HEADER_IDEA_H diff --git a/crypto/openssl/crypto/idea/idea_lcl.h b/crypto/openssl/crypto/idea/idea_lcl.h index 463aa36..0190599 100644 --- a/crypto/openssl/crypto/idea/idea_lcl.h +++ b/crypto/openssl/crypto/idea/idea_lcl.h @@ -54,6 +54,7 @@ * 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.] + * $FreeBSD$ */ /* The new form of this macro (check if the a*b == 0) was suggested by diff --git a/crypto/openssl/crypto/idea/idea_spd.c b/crypto/openssl/crypto/idea/idea_spd.c index 301946b..aefe178 100644 --- a/crypto/openssl/crypto/idea/idea_spd.c +++ b/crypto/openssl/crypto/idea/idea_spd.c @@ -54,6 +54,7 @@ * 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.] + * $FreeBSD$ */ /* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */ diff --git a/crypto/openssl/crypto/idea/ideatest.c b/crypto/openssl/crypto/idea/ideatest.c index 64b9353..810f351 100644 --- a/crypto/openssl/crypto/idea/ideatest.c +++ b/crypto/openssl/crypto/idea/ideatest.c @@ -54,6 +54,7 @@ * 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.] + * $FreeBSD$ */ #include <stdio.h> diff --git a/crypto/openssl/crypto/idea/version b/crypto/openssl/crypto/idea/version index 3f22293..c269d85 100644 --- a/crypto/openssl/crypto/idea/version +++ b/crypto/openssl/crypto/idea/version @@ -1,3 +1,4 @@ +# $FreeBSD$ 1.1 07/12/95 - eay Many thanks to Rhys Weatherley <rweather@us.oracle.com> for pointing out that I was assuming little endian byte diff --git a/crypto/openssl/crypto/rsa/rsa.h b/crypto/openssl/crypto/rsa/rsa.h index fef4ef5..880ebfe 100644 --- a/crypto/openssl/crypto/rsa/rsa.h +++ b/crypto/openssl/crypto/rsa/rsa.h @@ -1,4 +1,5 @@ /* crypto/rsa/rsa.h */ +/* $FreeBSD$ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/crypto/openssl/crypto/rsa/rsa_eay.c b/crypto/openssl/crypto/rsa/rsa_eay.c index 3e38320..90771dc 100644 --- a/crypto/openssl/crypto/rsa/rsa_eay.c +++ b/crypto/openssl/crypto/rsa/rsa_eay.c @@ -1,4 +1,5 @@ /* crypto/rsa/rsa_eay.c */ +/* $FreeBSD$ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/crypto/openssl/crypto/rsa/rsa_lib.c b/crypto/openssl/crypto/rsa/rsa_lib.c index 422643e..5220f5f 100644 --- a/crypto/openssl/crypto/rsa/rsa_lib.c +++ b/crypto/openssl/crypto/rsa/rsa_lib.c @@ -1,4 +1,5 @@ /* crypto/rsa/rsa_lib.c */ +/* $FreeBSD$ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * diff --git a/crypto/openssl/rsaref/Makefile.save b/crypto/openssl/rsaref/Makefile.save deleted file mode 100644 index 8f27c48..0000000 --- a/crypto/openssl/rsaref/Makefile.save +++ /dev/null @@ -1,102 +0,0 @@ -# -# SSLeay/rsaref/Makefile -# - -DIR= rsaref -TOP= .. -CC= cc -INCLUDES= -I../crypto -I../include -CFLAG=-g -INSTALL_PREFIX= -OPENSSLDIR= /usr/local/ssl -INSTALLTOP=/usr/local/ssl -MAKE= make -f Makefile.ssl -MAKEDEPEND= $(TOP)/util/domd $(TOP) -MAKEFILE= Makefile.ssl -AR= ar r - -CFLAGS= $(INCLUDES) $(CFLAG) - -GENERAL=Makefile rsaref-lib.com install.com -TEST= -APPS= - -LIB=$(TOP)/libRSAglue.a -LIBSRC= rsaref.c rsar_err.c -LIBOBJ= rsaref.o rsar_err.o - -SRC= $(LIBSRC) - -EXHEADER= rsaref.h -HEADER= $(EXHEADER) - -ALL= $(GENERAL) $(SRC) $(HEADER) - -top: - (cd ..; $(MAKE) DIRS=rsaref all) - -all: lib - -lib: $(LIBOBJ) - $(AR) $(LIB) $(LIBOBJ) - @echo You may get an error following this line. Please ignore. - - $(RANLIB) $(LIB) - @touch lib - -files: - $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO - -links: - @$(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: - -@if [ "x`echo x $(EX_LIBS) | grep RSAglue`" != x ]; then \ - echo "installing libRSAglue.a"; \ - cp $(LIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/libRSAglue.a; \ - $(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/libRSAglue.a; \ - chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/libRSAglue.a; \ - fi - -# @for i in $(EXHEADER) ; \ -# do \ -# (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ -# chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ -# done; - -tags: - ctags $(SRC) - -tests: - -lint: - lint -DLINT $(INCLUDES) $(SRC)>fluff - -depend: - $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) - -dclean: - $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new - mv -f Makefile.new $(MAKEFILE) - -clean: - rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -rsar_err.o: ../include/openssl/bio.h ../include/openssl/bn.h -rsar_err.o: ../include/openssl/crypto.h ../include/openssl/err.h -rsar_err.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h -rsar_err.o: ../include/openssl/opensslv.h ../include/openssl/rsa.h -rsar_err.o: ../include/openssl/rsaref.h ../include/openssl/safestack.h -rsar_err.o: ../include/openssl/stack.h ../include/openssl/symhacks.h -rsaref.o: ../crypto/cryptlib.h ../include/openssl/bio.h ../include/openssl/bn.h -rsaref.o: ../include/openssl/buffer.h ../include/openssl/crypto.h -rsaref.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h -rsaref.o: ../include/openssl/err.h ../include/openssl/lhash.h -rsaref.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h -rsaref.o: ../include/openssl/rand.h ../include/openssl/rsa.h -rsaref.o: ../include/openssl/rsaref.h ../include/openssl/safestack.h -rsaref.o: ../include/openssl/stack.h ../include/openssl/symhacks.h diff --git a/crypto/openssl/rsaref/Makefile.ssl b/crypto/openssl/rsaref/Makefile.ssl deleted file mode 100644 index 8f27c48..0000000 --- a/crypto/openssl/rsaref/Makefile.ssl +++ /dev/null @@ -1,102 +0,0 @@ -# -# SSLeay/rsaref/Makefile -# - -DIR= rsaref -TOP= .. -CC= cc -INCLUDES= -I../crypto -I../include -CFLAG=-g -INSTALL_PREFIX= -OPENSSLDIR= /usr/local/ssl -INSTALLTOP=/usr/local/ssl -MAKE= make -f Makefile.ssl -MAKEDEPEND= $(TOP)/util/domd $(TOP) -MAKEFILE= Makefile.ssl -AR= ar r - -CFLAGS= $(INCLUDES) $(CFLAG) - -GENERAL=Makefile rsaref-lib.com install.com -TEST= -APPS= - -LIB=$(TOP)/libRSAglue.a -LIBSRC= rsaref.c rsar_err.c -LIBOBJ= rsaref.o rsar_err.o - -SRC= $(LIBSRC) - -EXHEADER= rsaref.h -HEADER= $(EXHEADER) - -ALL= $(GENERAL) $(SRC) $(HEADER) - -top: - (cd ..; $(MAKE) DIRS=rsaref all) - -all: lib - -lib: $(LIBOBJ) - $(AR) $(LIB) $(LIBOBJ) - @echo You may get an error following this line. Please ignore. - - $(RANLIB) $(LIB) - @touch lib - -files: - $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO - -links: - @$(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: - -@if [ "x`echo x $(EX_LIBS) | grep RSAglue`" != x ]; then \ - echo "installing libRSAglue.a"; \ - cp $(LIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/libRSAglue.a; \ - $(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/libRSAglue.a; \ - chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/libRSAglue.a; \ - fi - -# @for i in $(EXHEADER) ; \ -# do \ -# (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ -# chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ -# done; - -tags: - ctags $(SRC) - -tests: - -lint: - lint -DLINT $(INCLUDES) $(SRC)>fluff - -depend: - $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) - -dclean: - $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new - mv -f Makefile.new $(MAKEFILE) - -clean: - rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -rsar_err.o: ../include/openssl/bio.h ../include/openssl/bn.h -rsar_err.o: ../include/openssl/crypto.h ../include/openssl/err.h -rsar_err.o: ../include/openssl/lhash.h ../include/openssl/opensslconf.h -rsar_err.o: ../include/openssl/opensslv.h ../include/openssl/rsa.h -rsar_err.o: ../include/openssl/rsaref.h ../include/openssl/safestack.h -rsar_err.o: ../include/openssl/stack.h ../include/openssl/symhacks.h -rsaref.o: ../crypto/cryptlib.h ../include/openssl/bio.h ../include/openssl/bn.h -rsaref.o: ../include/openssl/buffer.h ../include/openssl/crypto.h -rsaref.o: ../include/openssl/e_os.h ../include/openssl/e_os2.h -rsaref.o: ../include/openssl/err.h ../include/openssl/lhash.h -rsaref.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h -rsaref.o: ../include/openssl/rand.h ../include/openssl/rsa.h -rsaref.o: ../include/openssl/rsaref.h ../include/openssl/safestack.h -rsaref.o: ../include/openssl/stack.h ../include/openssl/symhacks.h diff --git a/crypto/openssl/rsaref/rsar_err.c b/crypto/openssl/rsaref/rsar_err.c deleted file mode 100644 index 5e7871f..0000000 --- a/crypto/openssl/rsaref/rsar_err.c +++ /dev/null @@ -1,119 +0,0 @@ -/* rsaref/rsar_err.c */ -/* ==================================================================== - * Copyright (c) 1999 The OpenSSL Project. All rights reserved. - * - * 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 above 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 acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * openssl-core@OpenSSL.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED 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 OpenSSL PROJECT OR - * ITS 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. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - -/* NOTE: this file was auto generated by the mkerr.pl script: any changes - * made to it will be overwritten when the script next updates this file, - * only reason strings will be preserved. - */ - -#include <stdio.h> -#include <openssl/err.h> -#include <openssl/rsaref.h> - -/* BEGIN ERROR CODES */ -#ifndef NO_ERR -static ERR_STRING_DATA RSAREF_str_functs[]= - { -{ERR_PACK(0,RSAREF_F_BN_REF_MOD_EXP,0), "BN_REF_MOD_EXP"}, -{ERR_PACK(0,RSAREF_F_RSAREF_BN2BIN,0), "RSAREF_BN2BIN"}, -{ERR_PACK(0,RSAREF_F_RSA_BN2BIN,0), "RSA_BN2BIN"}, -{ERR_PACK(0,RSAREF_F_RSA_PRIVATE_DECRYPT,0), "RSA_private_decrypt"}, -{ERR_PACK(0,RSAREF_F_RSA_PRIVATE_ENCRYPT,0), "RSA_private_encrypt"}, -{ERR_PACK(0,RSAREF_F_RSA_PUBLIC_DECRYPT,0), "RSA_public_decrypt"}, -{ERR_PACK(0,RSAREF_F_RSA_PUBLIC_ENCRYPT,0), "RSA_public_encrypt"}, -{ERR_PACK(0,RSAREF_F_RSA_REF_BN2BIN,0), "RSA_REF_BN2BIN"}, -{ERR_PACK(0,RSAREF_F_RSA_REF_MOD_EXP,0), "RSA_REF_MOD_EXP"}, -{ERR_PACK(0,RSAREF_F_RSA_REF_PRIVATE_DECRYPT,0), "RSA_REF_PRIVATE_DECRYPT"}, -{ERR_PACK(0,RSAREF_F_RSA_REF_PRIVATE_ENCRYPT,0), "RSA_REF_PRIVATE_ENCRYPT"}, -{ERR_PACK(0,RSAREF_F_RSA_REF_PUBLIC_DECRYPT,0), "RSA_REF_PUBLIC_DECRYPT"}, -{ERR_PACK(0,RSAREF_F_RSA_REF_PUBLIC_ENCRYPT,0), "RSA_REF_PUBLIC_ENCRYPT"}, -{0,NULL} - }; - -static ERR_STRING_DATA RSAREF_str_reasons[]= - { -{RSAREF_R_CONTENT_ENCODING ,"content encoding"}, -{RSAREF_R_DATA ,"data"}, -{RSAREF_R_DIGEST_ALGORITHM ,"digest algorithm"}, -{RSAREF_R_ENCODING ,"encoding"}, -{RSAREF_R_ENCRYPTION_ALGORITHM ,"encryption algorithm"}, -{RSAREF_R_KEY ,"key"}, -{RSAREF_R_KEY_ENCODING ,"key encoding"}, -{RSAREF_R_LEN ,"len"}, -{RSAREF_R_MODULUS_LEN ,"modulus len"}, -{RSAREF_R_NEED_RANDOM ,"need random"}, -{RSAREF_R_PRIVATE_KEY ,"private key"}, -{RSAREF_R_PUBLIC_KEY ,"public key"}, -{RSAREF_R_SIGNATURE ,"signature"}, -{RSAREF_R_SIGNATURE_ENCODING ,"signature encoding"}, -{0,NULL} - }; - -#endif - -void ERR_load_RSAREF_strings(void) - { - static int init=1; - - if (init) - { - init=0; -#ifndef NO_ERR - ERR_load_strings(ERR_LIB_RSAREF,RSAREF_str_functs); - ERR_load_strings(ERR_LIB_RSAREF,RSAREF_str_reasons); -#endif - - } - } diff --git a/crypto/openssl/rsaref/rsaref.c b/crypto/openssl/rsaref/rsaref.c deleted file mode 100644 index ae70feb..0000000 --- a/crypto/openssl/rsaref/rsaref.c +++ /dev/null @@ -1,308 +0,0 @@ -/* rsaref/rsaref.c */ -/* Copyright (C) 1995-1998 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.] - */ - -#ifndef NO_RSA -#include <stdio.h> -#include "cryptlib.h" -#include <openssl/bn.h> -#include <openssl/rsa.h> -#include <openssl/rsaref.h> -#include <openssl/rand.h> - -static int RSAref_bn2bin(BIGNUM * from, unsigned char* to, int max); -#ifdef undef -static BIGNUM* RSAref_bin2bn(unsigned char* from, BIGNUM * to, int max); -#endif -static int RSAref_Public_eay2ref(RSA * from, RSArefPublicKey * to); -static int RSAref_Private_eay2ref(RSA * from, RSArefPrivateKey * to); -int RSA_ref_private_decrypt(int len, unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_ref_private_encrypt(int len, unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_ref_public_encrypt(int len, unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -int RSA_ref_public_decrypt(int len, unsigned char *from, - unsigned char *to, RSA *rsa, int padding); -static int BN_ref_mod_exp(BIGNUM *r,BIGNUM *a,const BIGNUM *p,const BIGNUM *m, - BN_CTX *ctx, BN_MONT_CTX *m_ctx); -static int RSA_ref_mod_exp(BIGNUM *r0, BIGNUM *I, RSA *rsa); -static RSA_METHOD rsa_pkcs1_ref_meth={ - "RSAref PKCS#1 RSA", - RSA_ref_public_encrypt, - RSA_ref_public_decrypt, - RSA_ref_private_encrypt, - RSA_ref_private_decrypt, - RSA_ref_mod_exp, - BN_ref_mod_exp, - NULL, - NULL, - 0, - NULL, - }; - -RSA_METHOD *RSA_PKCS1_RSAref(void) - { - return(&rsa_pkcs1_ref_meth); - } - -static int RSA_ref_mod_exp(BIGNUM *r0, BIGNUM *I, RSA *rsa) - { - RSAREFerr(RSAREF_F_RSA_REF_MOD_EXP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); - return(0); - } - -static int BN_ref_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p, - const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) - { - RSAREFerr(RSAREF_F_BN_REF_MOD_EXP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); - return(0); - } - -/* unsigned char *to: [max] */ -static int RSAref_bn2bin(BIGNUM *from, unsigned char *to, int max) - { - int i; - - i=BN_num_bytes(from); - if (i > max) - { - RSAREFerr(RSAREF_F_RSAREF_BN2BIN,RSAREF_R_LEN); - return(0); - } - - memset(to,0,(unsigned int)max); - if (!BN_bn2bin(from,&(to[max-i]))) - return(0); - return(1); - } - -#ifdef undef -/* unsigned char *from: [max] */ -static BIGNUM *RSAref_bin2bn(unsigned char *from, BIGNUM *to, int max) - { - int i; - BIGNUM *ret; - - for (i=0; i<max; i++) - if (from[i]) break; - - ret=BN_bin2bn(&(from[i]),max-i,to); - return(ret); - } - -static int RSAref_Public_ref2eay(RSArefPublicKey *from, RSA *to) - { - to->n=RSAref_bin2bn(from->m,NULL,RSAref_MAX_LEN); - to->e=RSAref_bin2bn(from->e,NULL,RSAref_MAX_LEN); - if ((to->n == NULL) || (to->e == NULL)) return(0); - return(1); - } -#endif - -static int RSAref_Public_eay2ref(RSA *from, RSArefPublicKey *to) - { - to->bits=BN_num_bits(from->n); - if (!RSAref_bn2bin(from->n,to->m,RSAref_MAX_LEN)) return(0); - if (!RSAref_bn2bin(from->e,to->e,RSAref_MAX_LEN)) return(0); - return(1); - } - -#ifdef undef -static int RSAref_Private_ref2eay(RSArefPrivateKey *from, RSA *to) - { - if ((to->n=RSAref_bin2bn(from->m,NULL,RSAref_MAX_LEN)) == NULL) - return(0); - if ((to->e=RSAref_bin2bn(from->e,NULL,RSAref_MAX_LEN)) == NULL) - return(0); - if ((to->d=RSAref_bin2bn(from->d,NULL,RSAref_MAX_LEN)) == NULL) - return(0); - if ((to->p=RSAref_bin2bn(from->prime[0],NULL,RSAref_MAX_PLEN)) == NULL) - return(0); - if ((to->q=RSAref_bin2bn(from->prime[1],NULL,RSAref_MAX_PLEN)) == NULL) - return(0); - if ((to->dmp1=RSAref_bin2bn(from->pexp[0],NULL,RSAref_MAX_PLEN)) - == NULL) - return(0); - if ((to->dmq1=RSAref_bin2bn(from->pexp[1],NULL,RSAref_MAX_PLEN)) - == NULL) - return(0); - if ((to->iqmp=RSAref_bin2bn(from->coef,NULL,RSAref_MAX_PLEN)) == NULL) - return(0); - return(1); - } -#endif - -static int RSAref_Private_eay2ref(RSA *from, RSArefPrivateKey *to) - { - to->bits=BN_num_bits(from->n); - if (!RSAref_bn2bin(from->n,to->m,RSAref_MAX_LEN)) return(0); - if (!RSAref_bn2bin(from->e,to->e,RSAref_MAX_LEN)) return(0); - if (!RSAref_bn2bin(from->d,to->d,RSAref_MAX_LEN)) return(0); - if (!RSAref_bn2bin(from->p,to->prime[0],RSAref_MAX_PLEN)) return(0); - if (!RSAref_bn2bin(from->q,to->prime[1],RSAref_MAX_PLEN)) return(0); - if (!RSAref_bn2bin(from->dmp1,to->pexp[0],RSAref_MAX_PLEN)) return(0); - if (!RSAref_bn2bin(from->dmq1,to->pexp[1],RSAref_MAX_PLEN)) return(0); - if (!RSAref_bn2bin(from->iqmp,to->coef,RSAref_MAX_PLEN)) return(0); - return(1); - } - -int RSA_ref_private_decrypt(int len, unsigned char *from, unsigned char *to, - RSA *rsa, int padding) - { - int i,outlen= -1; - RSArefPrivateKey RSAkey; - - if (!RSAref_Private_eay2ref(rsa,&RSAkey)) - goto err; - if ((i=RSAPrivateDecrypt(to,&outlen,from,len,&RSAkey)) != 0) - { - RSAREFerr(RSAREF_F_RSA_REF_PRIVATE_DECRYPT,i); - outlen= -1; - } -err: - memset(&RSAkey,0,sizeof(RSAkey)); - return(outlen); - } - -int RSA_ref_private_encrypt(int len, unsigned char *from, unsigned char *to, - RSA *rsa, int padding) - { - int i,outlen= -1; - RSArefPrivateKey RSAkey; - - if (padding != RSA_PKCS1_PADDING) - { - RSAREFerr(RSAREF_F_RSA_REF_PRIVATE_ENCRYPT, RSA_R_UNKNOWN_PADDING_TYPE); - goto err; - } - if (!RSAref_Private_eay2ref(rsa,&RSAkey)) - goto err; - if ((i=RSAPrivateEncrypt(to,&outlen,from,len,&RSAkey)) != 0) - { - RSAREFerr(RSAREF_F_RSA_REF_PRIVATE_ENCRYPT,i); - outlen= -1; - } -err: - memset(&RSAkey,0,sizeof(RSAkey)); - return(outlen); - } - -int RSA_ref_public_decrypt(int len, unsigned char *from, unsigned char *to, - RSA *rsa, int padding) - { - int i,outlen= -1; - RSArefPublicKey RSAkey; - - if (!RSAref_Public_eay2ref(rsa,&RSAkey)) - goto err; - if ((i=RSAPublicDecrypt(to,&outlen,from,len,&RSAkey)) != 0) - { - RSAREFerr(RSAREF_F_RSA_REF_PUBLIC_DECRYPT,i); - outlen= -1; - } -err: - memset(&RSAkey,0,sizeof(RSAkey)); - return(outlen); - } - -int RSA_ref_public_encrypt(int len, unsigned char *from, unsigned char *to, - RSA *rsa, int padding) - { - int outlen= -1; - int i; - RSArefPublicKey RSAkey; - RSARandomState rnd; - unsigned char buf[16]; - - if (padding != RSA_PKCS1_PADDING && padding != RSA_SSLV23_PADDING) - { - RSAREFerr(RSAREF_F_RSA_REF_PUBLIC_ENCRYPT, RSA_R_UNKNOWN_PADDING_TYPE); - goto err; - } - - R_RandomInit(&rnd); - R_GetRandomBytesNeeded((unsigned int *)&i,&rnd); - while (i > 0) - { - if (RAND_bytes(buf,16) <= 0) - goto err; - R_RandomUpdate(&rnd,buf,(unsigned int)((i>16)?16:i)); - i-=16; - } - - if (!RSAref_Public_eay2ref(rsa,&RSAkey)) - goto err; - if ((i=RSAPublicEncrypt(to,&outlen,from,len,&RSAkey,&rnd)) != 0) - { - RSAREFerr(RSAREF_F_RSA_REF_PUBLIC_ENCRYPT,i); - outlen= -1; - goto err; - } -err: - memset(&RSAkey,0,sizeof(RSAkey)); - R_RandomFinal(&rnd); - memset(&rnd,0,sizeof(rnd)); - return(outlen); - } -#else /* !NO_RSA */ - -# if PEDANTIC -static void *dummy=&dummy; -# endif - -#endif diff --git a/crypto/openssl/rsaref/rsaref.h b/crypto/openssl/rsaref/rsaref.h deleted file mode 100644 index 498449f..0000000 --- a/crypto/openssl/rsaref/rsaref.h +++ /dev/null @@ -1,180 +0,0 @@ -/* rsaref/rsaref.h */ -/* Copyright (C) 1995-1998 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.] - */ - -#ifndef HEADER_RSAREF_H -#define HEADER_RSAREF_H - -#ifndef NO_RSA -#include <openssl/rsa.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* RSAeuro */ -/*#define RSAref_MAX_BITS 2048*/ - -/* RSAref */ -#define RSAref_MAX_BITS 1024 - -#define RSAref_MIN_BITS 508 -#define RSAref_MAX_LEN ((RSAref_MAX_BITS+7)/8) -#define RSAref_MAX_PBITS (RSAref_MAX_BITS+1)/2 -#define RSAref_MAX_PLEN ((RSAref_MAX_PBITS+7)/8) - -typedef struct RSArefPublicKey_st - { - unsigned int bits; - unsigned char m[RSAref_MAX_LEN]; - unsigned char e[RSAref_MAX_LEN]; - } RSArefPublicKey; - -typedef struct RSArefPrivateKey_st - { - unsigned int bits; - unsigned char m[RSAref_MAX_LEN]; - unsigned char e[RSAref_MAX_LEN]; - unsigned char d[RSAref_MAX_LEN]; - unsigned char prime[2][RSAref_MAX_PLEN];/* p & q */ - unsigned char pexp[2][RSAref_MAX_PLEN]; /* dmp1 & dmq1 */ - unsigned char coef[RSAref_MAX_PLEN]; /* iqmp */ - } RSArefPrivateKey; - -typedef struct RSARandomState_st - { - unsigned int needed; - unsigned char state[16]; - unsigned int outputnum; - unsigned char output[16]; - } RSARandomState; - -#define RE_CONTENT_ENCODING 0x0400 -#define RE_DATA 0x0401 -#define RE_DIGEST_ALGORITHM 0x0402 -#define RE_ENCODING 0x0403 -#define RE_KEY 0x0404 -#define RE_KEY_ENCODING 0x0405 -#define RE_LEN 0x0406 -#define RE_MODULUS_LEN 0x0407 -#define RE_NEED_RANDOM 0x0408 -#define RE_PRIVATE_KEY 0x0409 -#define RE_PUBLIC_KEY 0x040a -#define RE_SIGNATURE 0x040b -#define RE_SIGNATURE_ENCODING 0x040c -#define RE_ENCRYPTION_ALGORITHM 0x040d - -int RSAPrivateDecrypt(unsigned char *to, int *outlen, unsigned char *from, - int len, RSArefPrivateKey *RSAkey); -int RSAPrivateEncrypt(unsigned char *to, int *outlen, unsigned char *from, - int len, RSArefPrivateKey *RSAkey); -int RSAPublicDecrypt(unsigned char *to, int *outlen, unsigned char *from, - int len, RSArefPublicKey *RSAkey); -int RSAPublicEncrypt(unsigned char *to, int *outlen, unsigned char *from, - int len, RSArefPublicKey *RSAkey,RSARandomState *rnd); -int R_RandomInit(RSARandomState *rnd); -int R_GetRandomBytesNeeded(unsigned int *,RSARandomState *rnd); -int R_RandomUpdate(RSARandomState *rnd, unsigned char *data, unsigned int n); -int R_RandomFinal(RSARandomState *rnd); - -void ERR_load_RSAREF_strings(void ); -RSA_METHOD *RSA_PKCS1_RSAref(void ); - -#ifdef __cplusplus -} -#endif -#endif - -/* BEGIN ERROR CODES */ -/* The following lines are auto generated by the script mkerr.pl. Any changes - * made after this point may be overwritten when the script is next run. - */ - -/* Error codes for the RSAREF functions. */ - -/* Function codes. */ -#define RSAREF_F_BN_REF_MOD_EXP 100 -#define RSAREF_F_RSAREF_BN2BIN 101 -#define RSAREF_F_RSA_BN2BIN 102 -#define RSAREF_F_RSA_PRIVATE_DECRYPT 103 -#define RSAREF_F_RSA_PRIVATE_ENCRYPT 104 -#define RSAREF_F_RSA_PUBLIC_DECRYPT 105 -#define RSAREF_F_RSA_PUBLIC_ENCRYPT 106 -#define RSAREF_F_RSA_REF_BN2BIN 107 -#define RSAREF_F_RSA_REF_MOD_EXP 108 -#define RSAREF_F_RSA_REF_PRIVATE_DECRYPT 109 -#define RSAREF_F_RSA_REF_PRIVATE_ENCRYPT 110 -#define RSAREF_F_RSA_REF_PUBLIC_DECRYPT 111 -#define RSAREF_F_RSA_REF_PUBLIC_ENCRYPT 112 - -/* Reason codes. */ -#define RSAREF_R_CONTENT_ENCODING 0x0400 -#define RSAREF_R_DATA 0x0401 -#define RSAREF_R_DIGEST_ALGORITHM 0x0402 -#define RSAREF_R_ENCODING 0x0403 -#define RSAREF_R_ENCRYPTION_ALGORITHM 0x040d -#define RSAREF_R_KEY 0x0404 -#define RSAREF_R_KEY_ENCODING 0x0405 -#define RSAREF_R_LEN 0x0406 -#define RSAREF_R_MODULUS_LEN 0x0407 -#define RSAREF_R_NEED_RANDOM 0x0408 -#define RSAREF_R_PRIVATE_KEY 0x0409 -#define RSAREF_R_PUBLIC_KEY 0x040a -#define RSAREF_R_SIGNATURE 0x040b -#define RSAREF_R_SIGNATURE_ENCODING 0x040c - -#endif diff --git a/crypto/openssl/ssl/s23_clnt.c b/crypto/openssl/ssl/s23_clnt.c index 5050a13..8a3daaf 100644 --- a/crypto/openssl/ssl/s23_clnt.c +++ b/crypto/openssl/ssl/s23_clnt.c @@ -54,6 +54,8 @@ * 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.] + * + * $FreeBSD$ */ #include <stdio.h> diff --git a/crypto/openssl/ssl/s23_lib.c b/crypto/openssl/ssl/s23_lib.c index ad2d8da..fe7e2d1 100644 --- a/crypto/openssl/ssl/s23_lib.c +++ b/crypto/openssl/ssl/s23_lib.c @@ -54,6 +54,8 @@ * 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.] + * + * $FreeBSD$ */ #include <stdio.h> diff --git a/crypto/openssl/ssl/s23_srvr.c b/crypto/openssl/ssl/s23_srvr.c index 0506182..2dbf614 100644 --- a/crypto/openssl/ssl/s23_srvr.c +++ b/crypto/openssl/ssl/s23_srvr.c @@ -54,6 +54,8 @@ * 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.] + * + * $FreeBSD$ */ #include <stdio.h> diff --git a/crypto/openssl/ssl/s2_clnt.c b/crypto/openssl/ssl/s2_clnt.c index 28d6d65..3ddc231 100644 --- a/crypto/openssl/ssl/s2_clnt.c +++ b/crypto/openssl/ssl/s2_clnt.c @@ -54,6 +54,8 @@ * 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.] + * + * $FreeBSD$ */ #include "ssl_locl.h" diff --git a/crypto/openssl/ssl/s2_enc.c b/crypto/openssl/ssl/s2_enc.c index 35acdf8..7643f96 100644 --- a/crypto/openssl/ssl/s2_enc.c +++ b/crypto/openssl/ssl/s2_enc.c @@ -54,6 +54,8 @@ * 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.] + * + * $FreeBSD$ */ #include "ssl_locl.h" diff --git a/crypto/openssl/ssl/s2_lib.c b/crypto/openssl/ssl/s2_lib.c index a590dbf..a524dab 100644 --- a/crypto/openssl/ssl/s2_lib.c +++ b/crypto/openssl/ssl/s2_lib.c @@ -54,6 +54,8 @@ * 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.] + * + * $FreeBSD$ */ #include "ssl_locl.h" diff --git a/crypto/openssl/ssl/s2_meth.c b/crypto/openssl/ssl/s2_meth.c index deb9e1d..01cc05f 100644 --- a/crypto/openssl/ssl/s2_meth.c +++ b/crypto/openssl/ssl/s2_meth.c @@ -54,6 +54,8 @@ * 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.] + * + * $FreeBSD$ */ #include "ssl_locl.h" diff --git a/crypto/openssl/ssl/s2_pkt.c b/crypto/openssl/ssl/s2_pkt.c index f2f46ff..6e37903 100644 --- a/crypto/openssl/ssl/s2_pkt.c +++ b/crypto/openssl/ssl/s2_pkt.c @@ -107,6 +107,7 @@ * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * + * $FreeBSD$ */ #include "ssl_locl.h" diff --git a/crypto/openssl/ssl/s2_srvr.c b/crypto/openssl/ssl/s2_srvr.c index 2fa2f31..2f3ec61 100644 --- a/crypto/openssl/ssl/s2_srvr.c +++ b/crypto/openssl/ssl/s2_srvr.c @@ -54,6 +54,8 @@ * 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.] + * + * $FreeBSD$ */ #include "ssl_locl.h" @@ -405,13 +407,12 @@ static int get_client_master_key(SSL *s) /* bad decrypt */ #if 1 /* If a bad decrypt, continue with protocol but with a - * random master secret (Bleichenbacher attack) */ + * dud master secret */ if ((i < 0) || ((!is_export && (i != EVP_CIPHER_key_length(c))) || (is_export && ((i != ek) || (s->s2->tmp.clear+i != EVP_CIPHER_key_length(c)))))) { - ERR_clear_error(); if (is_export) i=ek; else diff --git a/crypto/openssl/util/pl/Mingw32.pl b/crypto/openssl/util/pl/Mingw32.pl index 37f3612..02a5086 100644 --- a/crypto/openssl/util/pl/Mingw32.pl +++ b/crypto/openssl/util/pl/Mingw32.pl @@ -1,6 +1,7 @@ #!/usr/local/bin/perl # # Mingw32.pl -- Mingw32 with GNU cp (Mingw32f.pl uses DOS tools) +# $FreeBSD$ # $o='/'; |