summaryrefslogtreecommitdiffstats
path: root/lib/libssl/src/crypto/buffer
diff options
context:
space:
mode:
authorbeck <beck@openbsd.org>1999-09-29 04:35:07 +0000
committerbeck <beck@openbsd.org>1999-09-29 04:35:07 +0000
commit913ec974266f8a62ab2e5ca34a31d6e6f75b3cf0 (patch)
tree62c001f84cb6413a049c5c811a08bfbe7c747b77 /lib/libssl/src/crypto/buffer
parentfix byte counters; imain@netidea.com (diff)
downloadwireguard-openbsd-913ec974266f8a62ab2e5ca34a31d6e6f75b3cf0.tar.xz
wireguard-openbsd-913ec974266f8a62ab2e5ca34a31d6e6f75b3cf0.zip
OpenSSL 0.9.4 merge
Diffstat (limited to 'lib/libssl/src/crypto/buffer')
-rw-r--r--lib/libssl/src/crypto/buffer/Makefile.ssl44
-rw-r--r--lib/libssl/src/crypto/buffer/buf_err.c123
-rw-r--r--lib/libssl/src/crypto/buffer/buffer.c25
-rw-r--r--lib/libssl/src/crypto/buffer/buffer.err9
-rw-r--r--lib/libssl/src/crypto/buffer/buffer.h21
5 files changed, 106 insertions, 116 deletions
diff --git a/lib/libssl/src/crypto/buffer/Makefile.ssl b/lib/libssl/src/crypto/buffer/Makefile.ssl
index a5f150e5231..b615c4c12db 100644
--- a/lib/libssl/src/crypto/buffer/Makefile.ssl
+++ b/lib/libssl/src/crypto/buffer/Makefile.ssl
@@ -7,23 +7,23 @@ TOP= ../..
CC= cc
INCLUDES= -I.. -I../../include
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
CFLAGS= $(INCLUDES) $(CFLAG)
-ERR=buffer
-ERRC=buf_err
GENERAL=Makefile
TEST=
APPS=
LIB=$(TOP)/libcrypto.a
-LIBSRC= buffer.c $(ERRC).c
-LIBOBJ= buffer.o $(ERRC).o
+LIBSRC= buffer.c buf_err.c
+LIBOBJ= buffer.o buf_err.o
SRC= $(LIBSRC)
@@ -39,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:
@@ -68,17 +67,20 @@ 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:
- perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
- perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c
+ rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+buf_err.o: ../../include/openssl/buffer.h ../../include/openssl/err.h
+buffer.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
+buffer.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
+buffer.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
+buffer.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
+buffer.o: ../../include/openssl/stack.h ../cryptlib.h
diff --git a/lib/libssl/src/crypto/buffer/buf_err.c b/lib/libssl/src/crypto/buffer/buf_err.c
index ff988852cc7..7f9fd1f6c36 100644
--- a/lib/libssl/src/crypto/buffer/buf_err.c
+++ b/lib/libssl/src/crypto/buffer/buf_err.c
@@ -1,63 +1,65 @@
-/* lib/buf/buf_err.c */
-/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
- * All rights reserved.
+/* crypto/buffer/buf_err.c */
+/* ====================================================================
+ * Copyright (c) 1999 The OpenSSL Project. 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.
+ *
+ * 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 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.]
+ * 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.
*/
+
#include <stdio.h>
-#include "err.h"
-#include "buffer.h"
+#include <openssl/err.h>
+#include <openssl/buffer.h>
/* BEGIN ERROR CODES */
#ifndef NO_ERR
@@ -66,21 +68,26 @@ static ERR_STRING_DATA BUF_str_functs[]=
{ERR_PACK(0,BUF_F_BUF_MEM_GROW,0), "BUF_MEM_grow"},
{ERR_PACK(0,BUF_F_BUF_MEM_NEW,0), "BUF_MEM_new"},
{ERR_PACK(0,BUF_F_BUF_STRDUP,0), "BUF_strdup"},
-{ERR_PACK(0,BUF_F_PXYCLNT_READ,0), "PXYCLNT_READ"},
-{0,NULL},
+{0,NULL}
+ };
+
+static ERR_STRING_DATA BUF_str_reasons[]=
+ {
+{0,NULL}
};
#endif
-void ERR_load_BUF_strings()
+void ERR_load_BUF_strings(void)
{
static int init=1;
- if (init);
- {;
+ if (init)
+ {
init=0;
#ifndef NO_ERR
ERR_load_strings(ERR_LIB_BUF,BUF_str_functs);
+ ERR_load_strings(ERR_LIB_BUF,BUF_str_reasons);
#endif
}
diff --git a/lib/libssl/src/crypto/buffer/buffer.c b/lib/libssl/src/crypto/buffer/buffer.c
index 7e8af9e2fa3..c3a108ea521 100644
--- a/lib/libssl/src/crypto/buffer/buffer.c
+++ b/lib/libssl/src/crypto/buffer/buffer.c
@@ -58,13 +58,13 @@
#include <stdio.h>
#include "cryptlib.h"
-#include "buffer.h"
+#include <openssl/buffer.h>
-BUF_MEM *BUF_MEM_new()
+BUF_MEM *BUF_MEM_new(void)
{
BUF_MEM *ret;
- ret=(BUF_MEM *)Malloc(sizeof(BUF_MEM));
+ ret=Malloc(sizeof(BUF_MEM));
if (ret == NULL)
{
BUFerr(BUF_F_BUF_MEM_NEW,ERR_R_MALLOC_FAILURE);
@@ -76,9 +76,11 @@ BUF_MEM *BUF_MEM_new()
return(ret);
}
-void BUF_MEM_free(a)
-BUF_MEM *a;
+void BUF_MEM_free(BUF_MEM *a)
{
+ if(a == NULL)
+ return;
+
if (a->data != NULL)
{
memset(a->data,0,(unsigned int)a->max);
@@ -87,9 +89,7 @@ BUF_MEM *a;
Free(a);
}
-int BUF_MEM_grow(str, len)
-BUF_MEM *str;
-int len;
+int BUF_MEM_grow(BUF_MEM *str, int len)
{
char *ret;
unsigned int n;
@@ -101,15 +101,15 @@ int len;
}
if (str->max >= len)
{
- memset(&(str->data[str->length]),0,len-str->length);
+ memset(&str->data[str->length],0,len-str->length);
str->length=len;
return(len);
}
n=(len+3)/3*4;
if (str->data == NULL)
- ret=(char *)Malloc(n);
+ ret=Malloc(n);
else
- ret=(char *)Realloc(str->data,n);
+ ret=Realloc(str->data,n);
if (ret == NULL)
{
BUFerr(BUF_F_BUF_MEM_GROW,ERR_R_MALLOC_FAILURE);
@@ -124,8 +124,7 @@ int len;
return(len);
}
-char *BUF_strdup(str)
-char *str;
+char *BUF_strdup(const char *str)
{
char *ret;
int n;
diff --git a/lib/libssl/src/crypto/buffer/buffer.err b/lib/libssl/src/crypto/buffer/buffer.err
deleted file mode 100644
index 62b775e637f..00000000000
--- a/lib/libssl/src/crypto/buffer/buffer.err
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Error codes for the BUF functions. */
-
-/* Function codes. */
-#define BUF_F_BUF_MEM_GROW 100
-#define BUF_F_BUF_MEM_NEW 101
-#define BUF_F_BUF_STRDUP 102
-#define BUF_F_PXYCLNT_READ 103
-
-/* Reason codes. */
diff --git a/lib/libssl/src/crypto/buffer/buffer.h b/lib/libssl/src/crypto/buffer/buffer.h
index 417548c04a4..bff26bf3919 100644
--- a/lib/libssl/src/crypto/buffer/buffer.h
+++ b/lib/libssl/src/crypto/buffer/buffer.h
@@ -70,36 +70,27 @@ typedef struct buf_mem_st
int max; /* size of buffer */
} BUF_MEM;
-#ifndef NOPROTO
BUF_MEM *BUF_MEM_new(void);
void BUF_MEM_free(BUF_MEM *a);
int BUF_MEM_grow(BUF_MEM *str, int len);
-char * BUF_strdup(char *str);
+char * BUF_strdup(const char *str);
void ERR_load_BUF_strings(void );
-#else
-
-BUF_MEM *BUF_MEM_new();
-void BUF_MEM_free();
-int BUF_MEM_grow();
-char * BUF_strdup();
-
-void ERR_load_BUF_strings();
-
-#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 BUF functions. */
/* Function codes. */
#define BUF_F_BUF_MEM_GROW 100
#define BUF_F_BUF_MEM_NEW 101
#define BUF_F_BUF_STRDUP 102
-#define BUF_F_PXYCLNT_READ 103
/* Reason codes. */
-
+
#ifdef __cplusplus
}
#endif