diff options
| author | markus <> | 2002-09-05 12:51:50 +0000 |
|---|---|---|
| committer | markus <> | 2002-09-05 12:51:50 +0000 |
| commit | 15b5d84f9da2ce4bfae8580e56e34a859f74ad71 (patch) | |
| tree | bf939e82d7fd73cc8a01cf6959002209972091bc /src/lib/libcrypto/buffer/buffer.c | |
| parent | 027351f729b9e837200dae6e1520cda6577ab930 (diff) | |
| download | openbsd-15b5d84f9da2ce4bfae8580e56e34a859f74ad71.tar.gz openbsd-15b5d84f9da2ce4bfae8580e56e34a859f74ad71.tar.bz2 openbsd-15b5d84f9da2ce4bfae8580e56e34a859f74ad71.zip | |
import openssl-0.9.7-beta1
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/buffer/buffer.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/lib/libcrypto/buffer/buffer.c b/src/lib/libcrypto/buffer/buffer.c index 7e8af9e2fa..9299baba9e 100644 --- a/src/lib/libcrypto/buffer/buffer.c +++ b/src/lib/libcrypto/buffer/buffer.c | |||
| @@ -58,13 +58,13 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "cryptlib.h" | 60 | #include "cryptlib.h" |
| 61 | #include "buffer.h" | 61 | #include <openssl/buffer.h> |
| 62 | 62 | ||
| 63 | BUF_MEM *BUF_MEM_new() | 63 | BUF_MEM *BUF_MEM_new(void) |
| 64 | { | 64 | { |
| 65 | BUF_MEM *ret; | 65 | BUF_MEM *ret; |
| 66 | 66 | ||
| 67 | ret=(BUF_MEM *)Malloc(sizeof(BUF_MEM)); | 67 | ret=OPENSSL_malloc(sizeof(BUF_MEM)); |
| 68 | if (ret == NULL) | 68 | if (ret == NULL) |
| 69 | { | 69 | { |
| 70 | BUFerr(BUF_F_BUF_MEM_NEW,ERR_R_MALLOC_FAILURE); | 70 | BUFerr(BUF_F_BUF_MEM_NEW,ERR_R_MALLOC_FAILURE); |
| @@ -76,20 +76,20 @@ BUF_MEM *BUF_MEM_new() | |||
| 76 | return(ret); | 76 | return(ret); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | void BUF_MEM_free(a) | 79 | void BUF_MEM_free(BUF_MEM *a) |
| 80 | BUF_MEM *a; | ||
| 81 | { | 80 | { |
| 81 | if(a == NULL) | ||
| 82 | return; | ||
| 83 | |||
| 82 | if (a->data != NULL) | 84 | if (a->data != NULL) |
| 83 | { | 85 | { |
| 84 | memset(a->data,0,(unsigned int)a->max); | 86 | memset(a->data,0,(unsigned int)a->max); |
| 85 | Free(a->data); | 87 | OPENSSL_free(a->data); |
| 86 | } | 88 | } |
| 87 | Free(a); | 89 | OPENSSL_free(a); |
| 88 | } | 90 | } |
| 89 | 91 | ||
| 90 | int BUF_MEM_grow(str, len) | 92 | int BUF_MEM_grow(BUF_MEM *str, int len) |
| 91 | BUF_MEM *str; | ||
| 92 | int len; | ||
| 93 | { | 93 | { |
| 94 | char *ret; | 94 | char *ret; |
| 95 | unsigned int n; | 95 | unsigned int n; |
| @@ -101,15 +101,15 @@ int len; | |||
| 101 | } | 101 | } |
| 102 | if (str->max >= len) | 102 | if (str->max >= len) |
| 103 | { | 103 | { |
| 104 | memset(&(str->data[str->length]),0,len-str->length); | 104 | memset(&str->data[str->length],0,len-str->length); |
| 105 | str->length=len; | 105 | str->length=len; |
| 106 | return(len); | 106 | return(len); |
| 107 | } | 107 | } |
| 108 | n=(len+3)/3*4; | 108 | n=(len+3)/3*4; |
| 109 | if (str->data == NULL) | 109 | if (str->data == NULL) |
| 110 | ret=(char *)Malloc(n); | 110 | ret=OPENSSL_malloc(n); |
| 111 | else | 111 | else |
| 112 | ret=(char *)Realloc(str->data,n); | 112 | ret=OPENSSL_realloc(str->data,n); |
| 113 | if (ret == NULL) | 113 | if (ret == NULL) |
| 114 | { | 114 | { |
| 115 | BUFerr(BUF_F_BUF_MEM_GROW,ERR_R_MALLOC_FAILURE); | 115 | BUFerr(BUF_F_BUF_MEM_GROW,ERR_R_MALLOC_FAILURE); |
| @@ -118,14 +118,14 @@ int len; | |||
| 118 | else | 118 | else |
| 119 | { | 119 | { |
| 120 | str->data=ret; | 120 | str->data=ret; |
| 121 | str->length=len; | ||
| 122 | str->max=n; | 121 | str->max=n; |
| 122 | memset(&str->data[str->length],0,len-str->length); | ||
| 123 | str->length=len; | ||
| 123 | } | 124 | } |
| 124 | return(len); | 125 | return(len); |
| 125 | } | 126 | } |
| 126 | 127 | ||
| 127 | char *BUF_strdup(str) | 128 | char *BUF_strdup(const char *str) |
| 128 | char *str; | ||
| 129 | { | 129 | { |
| 130 | char *ret; | 130 | char *ret; |
| 131 | int n; | 131 | int n; |
| @@ -133,7 +133,7 @@ char *str; | |||
| 133 | if (str == NULL) return(NULL); | 133 | if (str == NULL) return(NULL); |
| 134 | 134 | ||
| 135 | n=strlen(str); | 135 | n=strlen(str); |
| 136 | ret=Malloc(n+1); | 136 | ret=OPENSSL_malloc(n+1); |
| 137 | if (ret == NULL) | 137 | if (ret == NULL) |
| 138 | { | 138 | { |
| 139 | BUFerr(BUF_F_BUF_STRDUP,ERR_R_MALLOC_FAILURE); | 139 | BUFerr(BUF_F_BUF_STRDUP,ERR_R_MALLOC_FAILURE); |
