summaryrefslogtreecommitdiffstats
path: root/lib/libcrypto/buffer/buffer.c
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/libcrypto/buffer/buffer.c
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/libcrypto/buffer/buffer.c')
-rw-r--r--lib/libcrypto/buffer/buffer.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/libcrypto/buffer/buffer.c b/lib/libcrypto/buffer/buffer.c
index 7e8af9e2fa3..c3a108ea521 100644
--- a/lib/libcrypto/buffer/buffer.c
+++ b/lib/libcrypto/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;