From 259e36b1c57849c281afb8526bab11e7ba2592e2 Mon Sep 17 00:00:00 2001 From: cvs2svn Date: Sat, 12 Mar 2005 00:02:08 +0000 Subject: This commit was manufactured by cvs2git to create tag 'OPENBSD_3_7_BASE'. --- src/lib/libcrypto/comp/c_rle.c | 62 --------- src/lib/libcrypto/comp/c_zlib.c | 260 -------------------------------------- src/lib/libcrypto/comp/comp.h | 59 --------- src/lib/libcrypto/comp/comp_err.c | 92 -------------- src/lib/libcrypto/comp/comp_lib.c | 78 ------------ 5 files changed, 551 deletions(-) delete mode 100644 src/lib/libcrypto/comp/c_rle.c delete mode 100644 src/lib/libcrypto/comp/c_zlib.c delete mode 100644 src/lib/libcrypto/comp/comp.h delete mode 100644 src/lib/libcrypto/comp/comp_err.c delete mode 100644 src/lib/libcrypto/comp/comp_lib.c (limited to 'src/lib/libcrypto/comp') diff --git a/src/lib/libcrypto/comp/c_rle.c b/src/lib/libcrypto/comp/c_rle.c deleted file mode 100644 index efd366fa22..0000000000 --- a/src/lib/libcrypto/comp/c_rle.c +++ /dev/null @@ -1,62 +0,0 @@ -#include -#include -#include -#include -#include - -static int rle_compress_block(COMP_CTX *ctx, unsigned char *out, - unsigned int olen, unsigned char *in, unsigned int ilen); -static int rle_expand_block(COMP_CTX *ctx, unsigned char *out, - unsigned int olen, unsigned char *in, unsigned int ilen); - -static COMP_METHOD rle_method={ - NID_rle_compression, - LN_rle_compression, - NULL, - NULL, - rle_compress_block, - rle_expand_block, - NULL, - NULL, - }; - -COMP_METHOD *COMP_rle(void) - { - return(&rle_method); - } - -static int rle_compress_block(COMP_CTX *ctx, unsigned char *out, - unsigned int olen, unsigned char *in, unsigned int ilen) - { - /* int i; */ - - if (olen < (ilen+1)) - { - /* ZZZZZZZZZZZZZZZZZZZZZZ */ - return(-1); - } - - *(out++)=0; - memcpy(out,in,ilen); - return(ilen+1); - } - -static int rle_expand_block(COMP_CTX *ctx, unsigned char *out, - unsigned int olen, unsigned char *in, unsigned int ilen) - { - int i; - - if (olen < (ilen-1)) - { - /* ZZZZZZZZZZZZZZZZZZZZZZ */ - return(-1); - } - - i= *(in++); - if (i == 0) - { - memcpy(out,in,ilen-1); - } - return(ilen-1); - } - diff --git a/src/lib/libcrypto/comp/c_zlib.c b/src/lib/libcrypto/comp/c_zlib.c deleted file mode 100644 index 8c0876151a..0000000000 --- a/src/lib/libcrypto/comp/c_zlib.c +++ /dev/null @@ -1,260 +0,0 @@ -#include -#include -#include -#include -#include - -COMP_METHOD *COMP_zlib(void ); - -static COMP_METHOD zlib_method_nozlib={ - NID_undef, - "(undef)", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }; - -#ifndef ZLIB -#undef ZLIB_SHARED -#else - -#include - -static int zlib_compress_block(COMP_CTX *ctx, unsigned char *out, - unsigned int olen, unsigned char *in, unsigned int ilen); -static int zlib_expand_block(COMP_CTX *ctx, unsigned char *out, - unsigned int olen, unsigned char *in, unsigned int ilen); - -static int zz_uncompress(Bytef *dest, uLongf *destLen, const Bytef *source, - uLong sourceLen); - -static COMP_METHOD zlib_method={ - NID_zlib_compression, - LN_zlib_compression, - NULL, - NULL, - zlib_compress_block, - zlib_expand_block, - NULL, - NULL, - }; - -/* - * When OpenSSL is built on Windows, we do not want to require that - * the ZLIB.DLL be available in order for the OpenSSL DLLs to - * work. Therefore, all ZLIB routines are loaded at run time - * and we do not link to a .LIB file. - */ -#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) -# include - -# define Z_CALLCONV _stdcall -# define ZLIB_SHARED -#else -# define Z_CALLCONV -#endif /* !(OPENSSL_SYS_WINDOWS || OPENSSL_SYS_WIN32) */ - -#ifdef ZLIB_SHARED -#include - -/* Prototypes for built in stubs */ -static int stub_compress(Bytef *dest,uLongf *destLen, - const Bytef *source, uLong sourceLen); -static int stub_inflateEnd(z_streamp strm); -static int stub_inflate(z_streamp strm, int flush); -static int stub_inflateInit_(z_streamp strm, const char * version, - int stream_size); - -/* Function pointers */ -typedef int (Z_CALLCONV *compress_ft)(Bytef *dest,uLongf *destLen, - const Bytef *source, uLong sourceLen); -typedef int (Z_CALLCONV *inflateEnd_ft)(z_streamp strm); -typedef int (Z_CALLCONV *inflate_ft)(z_streamp strm, int flush); -typedef int (Z_CALLCONV *inflateInit__ft)(z_streamp strm, - const char * version, int stream_size); -static compress_ft p_compress=NULL; -static inflateEnd_ft p_inflateEnd=NULL; -static inflate_ft p_inflate=NULL; -static inflateInit__ft p_inflateInit_=NULL; - -static int zlib_loaded = 0; /* only attempt to init func pts once */ -static DSO *zlib_dso = NULL; - -#define compress stub_compress -#define inflateEnd stub_inflateEnd -#define inflate stub_inflate -#define inflateInit_ stub_inflateInit_ -#endif /* ZLIB_SHARED */ - -static int zlib_compress_block(COMP_CTX *ctx, unsigned char *out, - unsigned int olen, unsigned char *in, unsigned int ilen) - { - unsigned long l; - int i; - int clear=1; - - if (ilen > 128) - { - out[0]=1; - l=olen-1; - i=compress(&(out[1]),&l,in,(unsigned long)ilen); - if (i != Z_OK) - return(-1); - if (ilen > l) - { - clear=0; - l++; - } - } - if (clear) - { - out[0]=0; - memcpy(&(out[1]),in,ilen); - l=ilen+1; - } -#ifdef DEBUG_ZLIB - fprintf(stderr,"compress(%4d)->%4d %s\n", - ilen,(int)l,(clear)?"clear":"zlib"); -#endif - return((int)l); - } - -static int zlib_expand_block(COMP_CTX *ctx, unsigned char *out, - unsigned int olen, unsigned char *in, unsigned int ilen) - { - unsigned long l; - int i; - - if (in[0]) - { - l=olen; - i=zz_uncompress(out,&l,&(in[1]),(unsigned long)ilen-1); - if (i != Z_OK) - return(-1); - } - else - { - memcpy(out,&(in[1]),ilen-1); - l=ilen-1; - } -#ifdef DEBUG_ZLIB - fprintf(stderr,"expand (%4d)->%4d %s\n", - ilen,(int)l,in[0]?"zlib":"clear"); -#endif - return((int)l); - } - -static int zz_uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, - uLong sourceLen) -{ - z_stream stream; - int err; - - stream.next_in = (Bytef*)source; - stream.avail_in = (uInt)sourceLen; - /* Check for source > 64K on 16-bit machine: */ - if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; - - stream.next_out = dest; - stream.avail_out = (uInt)*destLen; - if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; - - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; - - err = inflateInit(&stream); - if (err != Z_OK) return err; - - err = inflate(&stream, Z_FINISH); - if (err != Z_STREAM_END) { - inflateEnd(&stream); - return err; - } - *destLen = stream.total_out; - - err = inflateEnd(&stream); - return err; -} - -#endif - -COMP_METHOD *COMP_zlib(void) - { - COMP_METHOD *meth = &zlib_method_nozlib; - -#ifdef ZLIB_SHARED - if (!zlib_loaded) - { -#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) - zlib_dso = DSO_load(NULL, "ZLIB", NULL, 0); -#else - zlib_dso = DSO_load(NULL, "z", NULL, 0); -#endif - if (zlib_dso != NULL) - { - p_compress - = (compress_ft) DSO_bind_func(zlib_dso, - "compress"); - p_inflateEnd - = (inflateEnd_ft) DSO_bind_func(zlib_dso, - "inflateEnd"); - p_inflate - = (inflate_ft) DSO_bind_func(zlib_dso, - "inflate"); - p_inflateInit_ - = (inflateInit__ft) DSO_bind_func(zlib_dso, - "inflateInit_"); - zlib_loaded++; - } - } - -#endif -#if defined(ZLIB) || defined(ZLIB_SHARED) - meth = &zlib_method; -#endif - - return(meth); - } - -#ifdef ZLIB_SHARED -/* Stubs for each function to be dynamicly loaded */ -static int -stub_compress(Bytef *dest,uLongf *destLen,const Bytef *source, uLong sourceLen) - { - if (p_compress) - return(p_compress(dest,destLen,source,sourceLen)); - else - return(Z_MEM_ERROR); - } - -static int -stub_inflateEnd(z_streamp strm) - { - if ( p_inflateEnd ) - return(p_inflateEnd(strm)); - else - return(Z_MEM_ERROR); - } - -static int -stub_inflate(z_streamp strm, int flush) - { - if ( p_inflate ) - return(p_inflate(strm,flush)); - else - return(Z_MEM_ERROR); - } - -static int -stub_inflateInit_(z_streamp strm, const char * version, int stream_size) - { - if ( p_inflateInit_ ) - return(p_inflateInit_(strm,version,stream_size)); - else - return(Z_MEM_ERROR); - } - -#endif /* ZLIB_SHARED */ diff --git a/src/lib/libcrypto/comp/comp.h b/src/lib/libcrypto/comp/comp.h deleted file mode 100644 index ab48b78ae9..0000000000 --- a/src/lib/libcrypto/comp/comp.h +++ /dev/null @@ -1,59 +0,0 @@ - -#ifndef HEADER_COMP_H -#define HEADER_COMP_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct comp_method_st - { - int type; /* NID for compression library */ - const char *name; /* A text string to identify the library */ - int (*init)(); - void (*finish)(); - int (*compress)(); - int (*expand)(); - long (*ctrl)(); - long (*callback_ctrl)(); - } COMP_METHOD; - -typedef struct comp_ctx_st - { - COMP_METHOD *meth; - unsigned long compress_in; - unsigned long compress_out; - unsigned long expand_in; - unsigned long expand_out; - - CRYPTO_EX_DATA ex_data; - } COMP_CTX; - - -COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); -void COMP_CTX_free(COMP_CTX *ctx); -int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, - unsigned char *in, int ilen); -int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, - unsigned char *in, int ilen); -COMP_METHOD *COMP_rle(void ); -COMP_METHOD *COMP_zlib(void ); - -/* 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. - */ -void ERR_load_COMP_strings(void); - -/* Error codes for the COMP functions. */ - -/* Function codes. */ - -/* Reason codes. */ - -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/lib/libcrypto/comp/comp_err.c b/src/lib/libcrypto/comp/comp_err.c deleted file mode 100644 index 1652b8c2c4..0000000000 --- a/src/lib/libcrypto/comp/comp_err.c +++ /dev/null @@ -1,92 +0,0 @@ -/* crypto/comp/comp_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 -#include -#include - -/* BEGIN ERROR CODES */ -#ifndef OPENSSL_NO_ERR -static ERR_STRING_DATA COMP_str_functs[]= - { -{0,NULL} - }; - -static ERR_STRING_DATA COMP_str_reasons[]= - { -{0,NULL} - }; - -#endif - -void ERR_load_COMP_strings(void) - { - static int init=1; - - if (init) - { - init=0; -#ifndef OPENSSL_NO_ERR - ERR_load_strings(ERR_LIB_COMP,COMP_str_functs); - ERR_load_strings(ERR_LIB_COMP,COMP_str_reasons); -#endif - - } - } diff --git a/src/lib/libcrypto/comp/comp_lib.c b/src/lib/libcrypto/comp/comp_lib.c deleted file mode 100644 index beb98ce8cc..0000000000 --- a/src/lib/libcrypto/comp/comp_lib.c +++ /dev/null @@ -1,78 +0,0 @@ -#include -#include -#include -#include -#include - -COMP_CTX *COMP_CTX_new(COMP_METHOD *meth) - { - COMP_CTX *ret; - - if ((ret=(COMP_CTX *)OPENSSL_malloc(sizeof(COMP_CTX))) == NULL) - { - /* ZZZZZZZZZZZZZZZZ */ - return(NULL); - } - memset(ret,0,sizeof(COMP_CTX)); - ret->meth=meth; - if ((ret->meth->init != NULL) && !ret->meth->init(ret)) - { - OPENSSL_free(ret); - ret=NULL; - } -#if 0 - else - CRYPTO_new_ex_data(rsa_meth,(char *)ret,&ret->ex_data); -#endif - return(ret); - } - -void COMP_CTX_free(COMP_CTX *ctx) - { - /* CRYPTO_free_ex_data(rsa_meth,(char *)ctx,&ctx->ex_data); */ - - if(ctx == NULL) - return; - - if (ctx->meth->finish != NULL) - ctx->meth->finish(ctx); - - OPENSSL_free(ctx); - } - -int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, - unsigned char *in, int ilen) - { - int ret; - if (ctx->meth->compress == NULL) - { - /* ZZZZZZZZZZZZZZZZZ */ - return(-1); - } - ret=ctx->meth->compress(ctx,out,olen,in,ilen); - if (ret > 0) - { - ctx->compress_in+=ilen; - ctx->compress_out+=ret; - } - return(ret); - } - -int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, - unsigned char *in, int ilen) - { - int ret; - - if (ctx->meth->expand == NULL) - { - /* ZZZZZZZZZZZZZZZZZ */ - return(-1); - } - ret=ctx->meth->expand(ctx,out,olen,in,ilen); - if (ret > 0) - { - ctx->expand_in+=ilen; - ctx->expand_out+=ret; - } - return(ret); - } -- cgit v1.2.3-55-g6feb