diff options
author | jsing <> | 2014-04-17 13:58:24 +0000 |
---|---|---|
committer | jsing <> | 2014-04-17 13:58:24 +0000 |
commit | 4d658765f455801c1d1126cbc173d66774f3980a (patch) | |
tree | d76c6845248b3998e222842a23e7fde7b83baffd | |
parent | bf88a7952ef33375ff6392744b62a343a5c2aa35 (diff) | |
download | openbsd-4d658765f455801c1d1126cbc173d66774f3980a.tar.gz openbsd-4d658765f455801c1d1126cbc173d66774f3980a.tar.bz2 openbsd-4d658765f455801c1d1126cbc173d66774f3980a.zip |
Initial KNF.
-rw-r--r-- | src/lib/libcrypto/buffer/buf_err.c | 45 | ||||
-rw-r--r-- | src/lib/libcrypto/buffer/buffer.c | 195 | ||||
-rw-r--r-- | src/lib/libcrypto/buffer/buffer.h | 21 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/buffer/buf_err.c | 45 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/buffer/buffer.c | 195 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/buffer/buffer.h | 21 |
6 files changed, 244 insertions, 278 deletions
diff --git a/src/lib/libcrypto/buffer/buf_err.c b/src/lib/libcrypto/buffer/buf_err.c index 8f1de6192b..4e1949199a 100644 --- a/src/lib/libcrypto/buffer/buf_err.c +++ b/src/lib/libcrypto/buffer/buf_err.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * are met: | 7 | * are met: |
8 | * | 8 | * |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * | 11 | * |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in | 13 | * notice, this list of conditions and the following disclaimer in |
@@ -68,32 +68,29 @@ | |||
68 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_BUF,func,0) | 68 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_BUF,func,0) |
69 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_BUF,0,reason) | 69 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_BUF,0,reason) |
70 | 70 | ||
71 | static ERR_STRING_DATA BUF_str_functs[]= | 71 | static ERR_STRING_DATA BUF_str_functs[] = { |
72 | { | 72 | {ERR_FUNC(BUF_F_BUF_MEMDUP), "BUF_memdup"}, |
73 | {ERR_FUNC(BUF_F_BUF_MEMDUP), "BUF_memdup"}, | 73 | {ERR_FUNC(BUF_F_BUF_MEM_GROW), "BUF_MEM_grow"}, |
74 | {ERR_FUNC(BUF_F_BUF_MEM_GROW), "BUF_MEM_grow"}, | 74 | {ERR_FUNC(BUF_F_BUF_MEM_GROW_CLEAN), "BUF_MEM_grow_clean"}, |
75 | {ERR_FUNC(BUF_F_BUF_MEM_GROW_CLEAN), "BUF_MEM_grow_clean"}, | 75 | {ERR_FUNC(BUF_F_BUF_MEM_NEW), "BUF_MEM_new"}, |
76 | {ERR_FUNC(BUF_F_BUF_MEM_NEW), "BUF_MEM_new"}, | 76 | {ERR_FUNC(BUF_F_BUF_STRDUP), "BUF_strdup"}, |
77 | {ERR_FUNC(BUF_F_BUF_STRDUP), "BUF_strdup"}, | 77 | {ERR_FUNC(BUF_F_BUF_STRNDUP), "BUF_strndup"}, |
78 | {ERR_FUNC(BUF_F_BUF_STRNDUP), "BUF_strndup"}, | 78 | {0, NULL} |
79 | {0,NULL} | 79 | }; |
80 | }; | ||
81 | 80 | ||
82 | static ERR_STRING_DATA BUF_str_reasons[]= | 81 | static ERR_STRING_DATA BUF_str_reasons[] = { |
83 | { | 82 | {0, NULL} |
84 | {0,NULL} | 83 | }; |
85 | }; | ||
86 | 84 | ||
87 | #endif | 85 | #endif |
88 | 86 | ||
89 | void ERR_load_BUF_strings(void) | 87 | void |
90 | { | 88 | ERR_load_BUF_strings(void) |
89 | { | ||
91 | #ifndef OPENSSL_NO_ERR | 90 | #ifndef OPENSSL_NO_ERR |
92 | 91 | if (ERR_func_error_string(BUF_str_functs[0].error) == NULL) { | |
93 | if (ERR_func_error_string(BUF_str_functs[0].error) == NULL) | 92 | ERR_load_strings(0, BUF_str_functs); |
94 | { | 93 | ERR_load_strings(0, BUF_str_reasons); |
95 | ERR_load_strings(0,BUF_str_functs); | ||
96 | ERR_load_strings(0,BUF_str_reasons); | ||
97 | } | ||
98 | #endif | ||
99 | } | 94 | } |
95 | #endif | ||
96 | } | ||
diff --git a/src/lib/libcrypto/buffer/buffer.c b/src/lib/libcrypto/buffer/buffer.c index b52c59f8a3..4bd55c04ae 100644 --- a/src/lib/libcrypto/buffer/buffer.c +++ b/src/lib/libcrypto/buffer/buffer.c | |||
@@ -5,21 +5,21 @@ | |||
5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
8 | * | 8 | * |
9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
11 | * apply to all code found in this distribution, be it the RC4, RSA, | 11 | * apply to all code found in this distribution, be it the RC4, RSA, |
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation |
13 | * included with this distribution is covered by the same copyright terms | 13 | * included with this distribution is covered by the same copyright terms |
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
15 | * | 15 | * |
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
18 | * If this package is used in a product, Eric Young should be given attribution | 18 | * If this package is used in a product, Eric Young should be given attribution |
19 | * as the author of the parts of the library used. | 19 | * as the author of the parts of the library used. |
20 | * This can be in the form of a textual message at program startup or | 20 | * This can be in the form of a textual message at program startup or |
21 | * in documentation (online or textual) provided with the package. | 21 | * in documentation (online or textual) provided with the package. |
22 | * | 22 | * |
23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
25 | * are met: | 25 | * are met: |
@@ -34,10 +34,10 @@ | |||
34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 37 | * 4. If you include any Windows specific code (or a derivative thereof) from |
38 | * the apps directory (application code) you must include an acknowledgement: | 38 | * the apps directory (application code) you must include an acknowledgement: |
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
40 | * | 40 | * |
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
@@ -49,7 +49,7 @@ | |||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
52 | * | 52 | * |
53 | * The licence and distribution terms for any publically available version or | 53 | * The licence and distribution terms for any publically available version or |
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
@@ -65,139 +65,126 @@ | |||
65 | * that the result fits in an int. */ | 65 | * that the result fits in an int. */ |
66 | #define LIMIT_BEFORE_EXPANSION 0x5ffffffc | 66 | #define LIMIT_BEFORE_EXPANSION 0x5ffffffc |
67 | 67 | ||
68 | BUF_MEM *BUF_MEM_new(void) | 68 | BUF_MEM * |
69 | { | 69 | BUF_MEM_new(void) |
70 | { | ||
70 | BUF_MEM *ret; | 71 | BUF_MEM *ret; |
71 | 72 | ||
72 | ret=malloc(sizeof(BUF_MEM)); | 73 | ret = malloc(sizeof(BUF_MEM)); |
73 | if (ret == NULL) | 74 | if (ret == NULL) { |
74 | { | 75 | BUFerr(BUF_F_BUF_MEM_NEW, ERR_R_MALLOC_FAILURE); |
75 | BUFerr(BUF_F_BUF_MEM_NEW,ERR_R_MALLOC_FAILURE); | 76 | return (NULL); |
76 | return(NULL); | ||
77 | } | ||
78 | ret->length=0; | ||
79 | ret->max=0; | ||
80 | ret->data=NULL; | ||
81 | return(ret); | ||
82 | } | 77 | } |
78 | ret->length = 0; | ||
79 | ret->max = 0; | ||
80 | ret->data = NULL; | ||
81 | return (ret); | ||
82 | } | ||
83 | 83 | ||
84 | void BUF_MEM_free(BUF_MEM *a) | 84 | void |
85 | { | 85 | BUF_MEM_free(BUF_MEM *a) |
86 | if(a == NULL) | 86 | { |
87 | return; | 87 | if (a == NULL) |
88 | return; | ||
88 | 89 | ||
89 | if (a->data != NULL) | 90 | if (a->data != NULL) { |
90 | { | 91 | memset(a->data, 0,(unsigned int)a->max); |
91 | memset(a->data,0,(unsigned int)a->max); | ||
92 | free(a->data); | 92 | free(a->data); |
93 | } | ||
94 | free(a); | ||
95 | } | 93 | } |
94 | free(a); | ||
95 | } | ||
96 | 96 | ||
97 | int BUF_MEM_grow(BUF_MEM *str, size_t len) | 97 | int |
98 | { | 98 | BUF_MEM_grow(BUF_MEM *str, size_t len) |
99 | { | ||
99 | char *ret; | 100 | char *ret; |
100 | size_t n; | 101 | size_t n; |
101 | 102 | ||
102 | if (str->length >= len) | 103 | if (str->length >= len) { |
103 | { | 104 | str->length = len; |
104 | str->length=len; | 105 | return (len); |
105 | return(len); | 106 | } |
106 | } | 107 | if (str->max >= len) { |
107 | if (str->max >= len) | 108 | memset(&str->data[str->length], 0,len - str->length); |
108 | { | 109 | str->length = len; |
109 | memset(&str->data[str->length],0,len-str->length); | 110 | return (len); |
110 | str->length=len; | 111 | } |
111 | return(len); | ||
112 | } | ||
113 | /* This limit is sufficient to ensure (len+3)/3*4 < 2**31 */ | 112 | /* This limit is sufficient to ensure (len+3)/3*4 < 2**31 */ |
114 | if (len > LIMIT_BEFORE_EXPANSION) | 113 | if (len > LIMIT_BEFORE_EXPANSION) { |
115 | { | 114 | BUFerr(BUF_F_BUF_MEM_GROW, ERR_R_MALLOC_FAILURE); |
116 | BUFerr(BUF_F_BUF_MEM_GROW,ERR_R_MALLOC_FAILURE); | ||
117 | return 0; | 115 | return 0; |
118 | } | 116 | } |
119 | n=(len+3)/3*4; | 117 | n = (len + 3) / 3 * 4; |
120 | if (str->data == NULL) | 118 | if (str->data == NULL) |
121 | ret=malloc(n); | 119 | ret = malloc(n); |
122 | else | 120 | else |
123 | ret=realloc(str->data,n); | 121 | ret = realloc(str->data, n); |
124 | if (ret == NULL) | 122 | if (ret == NULL) { |
125 | { | 123 | BUFerr(BUF_F_BUF_MEM_GROW, ERR_R_MALLOC_FAILURE); |
126 | BUFerr(BUF_F_BUF_MEM_GROW,ERR_R_MALLOC_FAILURE); | 124 | len = 0; |
127 | len=0; | 125 | } else { |
128 | } | 126 | str->data = ret; |
129 | else | 127 | str->max = n; |
130 | { | 128 | memset(&str->data[str->length], 0,len - str->length); |
131 | str->data=ret; | 129 | str->length = len; |
132 | str->max=n; | ||
133 | memset(&str->data[str->length],0,len-str->length); | ||
134 | str->length=len; | ||
135 | } | ||
136 | return(len); | ||
137 | } | 130 | } |
131 | return (len); | ||
132 | } | ||
138 | 133 | ||
139 | int BUF_MEM_grow_clean(BUF_MEM *str, size_t len) | 134 | int |
140 | { | 135 | BUF_MEM_grow_clean(BUF_MEM *str, size_t len) |
136 | { | ||
141 | char *ret; | 137 | char *ret; |
142 | size_t n; | 138 | size_t n; |
143 | 139 | ||
144 | if (str->length >= len) | 140 | if (str->length >= len) { |
145 | { | 141 | memset(&str->data[len], 0,str->length - len); |
146 | memset(&str->data[len],0,str->length-len); | 142 | str->length = len; |
147 | str->length=len; | 143 | return (len); |
148 | return(len); | 144 | } |
149 | } | 145 | if (str->max >= len) { |
150 | if (str->max >= len) | 146 | memset(&str->data[str->length], 0,len - str->length); |
151 | { | 147 | str->length = len; |
152 | memset(&str->data[str->length],0,len-str->length); | 148 | return (len); |
153 | str->length=len; | 149 | } |
154 | return(len); | ||
155 | } | ||
156 | /* This limit is sufficient to ensure (len+3)/3*4 < 2**31 */ | 150 | /* This limit is sufficient to ensure (len+3)/3*4 < 2**31 */ |
157 | if (len > LIMIT_BEFORE_EXPANSION) | 151 | if (len > LIMIT_BEFORE_EXPANSION) { |
158 | { | 152 | BUFerr(BUF_F_BUF_MEM_GROW_CLEAN, ERR_R_MALLOC_FAILURE); |
159 | BUFerr(BUF_F_BUF_MEM_GROW_CLEAN,ERR_R_MALLOC_FAILURE); | ||
160 | return 0; | 153 | return 0; |
161 | } | 154 | } |
162 | n=(len+3)/3*4; | 155 | n = (len + 3) / 3 * 4; |
163 | if (str->data == NULL) | 156 | if (str->data == NULL) |
164 | ret=malloc(n); | 157 | ret = malloc(n); |
165 | else | ||
166 | ret=OPENSSL_realloc_clean(str->data,str->max,n); | ||
167 | if (ret == NULL) | ||
168 | { | ||
169 | BUFerr(BUF_F_BUF_MEM_GROW_CLEAN,ERR_R_MALLOC_FAILURE); | ||
170 | len=0; | ||
171 | } | ||
172 | else | 158 | else |
173 | { | 159 | ret = OPENSSL_realloc_clean(str->data, str->max, n); |
174 | str->data=ret; | 160 | if (ret == NULL) { |
175 | str->max=n; | 161 | BUFerr(BUF_F_BUF_MEM_GROW_CLEAN, ERR_R_MALLOC_FAILURE); |
176 | memset(&str->data[str->length],0,len-str->length); | 162 | len = 0; |
177 | str->length=len; | 163 | } else { |
178 | } | 164 | str->data = ret; |
179 | return(len); | 165 | str->max = n; |
166 | memset(&str->data[str->length], 0, len - str->length); | ||
167 | str->length = len; | ||
180 | } | 168 | } |
169 | return (len); | ||
170 | } | ||
181 | 171 | ||
182 | void BUF_reverse(unsigned char *out, const unsigned char *in, size_t size) | 172 | void |
183 | { | 173 | BUF_reverse(unsigned char *out, const unsigned char *in, size_t size) |
174 | { | ||
184 | size_t i; | 175 | size_t i; |
185 | if (in) | 176 | if (in) { |
186 | { | ||
187 | out += size - 1; | 177 | out += size - 1; |
188 | for (i = 0; i < size; i++) | 178 | for (i = 0; i < size; i++) |
189 | *out-- = *in++; | 179 | *out-- = *in++; |
190 | } | 180 | } else { |
191 | else | ||
192 | { | ||
193 | unsigned char *q; | 181 | unsigned char *q; |
194 | char c; | 182 | char c; |
195 | q = out + size - 1; | 183 | q = out + size - 1; |
196 | for (i = 0; i < size/2; i++) | 184 | for (i = 0; i < size / 2; i++) { |
197 | { | ||
198 | c = *q; | 185 | c = *q; |
199 | *q-- = *out; | 186 | *q-- = *out; |
200 | *out++ = c; | 187 | *out++ = c; |
201 | } | ||
202 | } | 188 | } |
203 | } | 189 | } |
190 | } | ||
diff --git a/src/lib/libcrypto/buffer/buffer.h b/src/lib/libcrypto/buffer/buffer.h index f8da32b485..ab1fab4410 100644 --- a/src/lib/libcrypto/buffer/buffer.h +++ b/src/lib/libcrypto/buffer/buffer.h | |||
@@ -5,21 +5,21 @@ | |||
5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
8 | * | 8 | * |
9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
11 | * apply to all code found in this distribution, be it the RC4, RSA, | 11 | * apply to all code found in this distribution, be it the RC4, RSA, |
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation |
13 | * included with this distribution is covered by the same copyright terms | 13 | * included with this distribution is covered by the same copyright terms |
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
15 | * | 15 | * |
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
18 | * If this package is used in a product, Eric Young should be given attribution | 18 | * If this package is used in a product, Eric Young should be given attribution |
19 | * as the author of the parts of the library used. | 19 | * as the author of the parts of the library used. |
20 | * This can be in the form of a textual message at program startup or | 20 | * This can be in the form of a textual message at program startup or |
21 | * in documentation (online or textual) provided with the package. | 21 | * in documentation (online or textual) provided with the package. |
22 | * | 22 | * |
23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
25 | * are met: | 25 | * are met: |
@@ -34,10 +34,10 @@ | |||
34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 37 | * 4. If you include any Windows specific code (or a derivative thereof) from |
38 | * the apps directory (application code) you must include an acknowledgement: | 38 | * the apps directory (application code) you must include an acknowledgement: |
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
40 | * | 40 | * |
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
@@ -49,7 +49,7 @@ | |||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
52 | * | 52 | * |
53 | * The licence and distribution terms for any publically available version or | 53 | * The licence and distribution terms for any publically available version or |
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
@@ -74,12 +74,11 @@ extern "C" { | |||
74 | /* Already declared in ossl_typ.h */ | 74 | /* Already declared in ossl_typ.h */ |
75 | /* typedef struct buf_mem_st BUF_MEM; */ | 75 | /* typedef struct buf_mem_st BUF_MEM; */ |
76 | 76 | ||
77 | struct buf_mem_st | 77 | struct buf_mem_st { |
78 | { | ||
79 | size_t length; /* current number of bytes */ | 78 | size_t length; /* current number of bytes */ |
80 | char *data; | 79 | char *data; |
81 | size_t max; /* size of buffer */ | 80 | size_t max; /* size of buffer */ |
82 | }; | 81 | }; |
83 | 82 | ||
84 | BUF_MEM *BUF_MEM_new(void); | 83 | BUF_MEM *BUF_MEM_new(void); |
85 | void BUF_MEM_free(BUF_MEM *a); | 84 | void BUF_MEM_free(BUF_MEM *a); |
@@ -91,8 +90,8 @@ void * BUF_memdup(const void *data, size_t siz); | |||
91 | void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); | 90 | void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); |
92 | 91 | ||
93 | /* safe string functions */ | 92 | /* safe string functions */ |
94 | size_t BUF_strlcpy(char *dst,const char *src,size_t siz); | 93 | size_t BUF_strlcpy(char *dst, const char *src, size_t siz); |
95 | size_t BUF_strlcat(char *dst,const char *src,size_t siz); | 94 | size_t BUF_strlcat(char *dst, const char *src, size_t siz); |
96 | 95 | ||
97 | 96 | ||
98 | /* BEGIN ERROR CODES */ | 97 | /* BEGIN ERROR CODES */ |
diff --git a/src/lib/libssl/src/crypto/buffer/buf_err.c b/src/lib/libssl/src/crypto/buffer/buf_err.c index 8f1de6192b..4e1949199a 100644 --- a/src/lib/libssl/src/crypto/buffer/buf_err.c +++ b/src/lib/libssl/src/crypto/buffer/buf_err.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * are met: | 7 | * are met: |
8 | * | 8 | * |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * | 11 | * |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in | 13 | * notice, this list of conditions and the following disclaimer in |
@@ -68,32 +68,29 @@ | |||
68 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_BUF,func,0) | 68 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_BUF,func,0) |
69 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_BUF,0,reason) | 69 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_BUF,0,reason) |
70 | 70 | ||
71 | static ERR_STRING_DATA BUF_str_functs[]= | 71 | static ERR_STRING_DATA BUF_str_functs[] = { |
72 | { | 72 | {ERR_FUNC(BUF_F_BUF_MEMDUP), "BUF_memdup"}, |
73 | {ERR_FUNC(BUF_F_BUF_MEMDUP), "BUF_memdup"}, | 73 | {ERR_FUNC(BUF_F_BUF_MEM_GROW), "BUF_MEM_grow"}, |
74 | {ERR_FUNC(BUF_F_BUF_MEM_GROW), "BUF_MEM_grow"}, | 74 | {ERR_FUNC(BUF_F_BUF_MEM_GROW_CLEAN), "BUF_MEM_grow_clean"}, |
75 | {ERR_FUNC(BUF_F_BUF_MEM_GROW_CLEAN), "BUF_MEM_grow_clean"}, | 75 | {ERR_FUNC(BUF_F_BUF_MEM_NEW), "BUF_MEM_new"}, |
76 | {ERR_FUNC(BUF_F_BUF_MEM_NEW), "BUF_MEM_new"}, | 76 | {ERR_FUNC(BUF_F_BUF_STRDUP), "BUF_strdup"}, |
77 | {ERR_FUNC(BUF_F_BUF_STRDUP), "BUF_strdup"}, | 77 | {ERR_FUNC(BUF_F_BUF_STRNDUP), "BUF_strndup"}, |
78 | {ERR_FUNC(BUF_F_BUF_STRNDUP), "BUF_strndup"}, | 78 | {0, NULL} |
79 | {0,NULL} | 79 | }; |
80 | }; | ||
81 | 80 | ||
82 | static ERR_STRING_DATA BUF_str_reasons[]= | 81 | static ERR_STRING_DATA BUF_str_reasons[] = { |
83 | { | 82 | {0, NULL} |
84 | {0,NULL} | 83 | }; |
85 | }; | ||
86 | 84 | ||
87 | #endif | 85 | #endif |
88 | 86 | ||
89 | void ERR_load_BUF_strings(void) | 87 | void |
90 | { | 88 | ERR_load_BUF_strings(void) |
89 | { | ||
91 | #ifndef OPENSSL_NO_ERR | 90 | #ifndef OPENSSL_NO_ERR |
92 | 91 | if (ERR_func_error_string(BUF_str_functs[0].error) == NULL) { | |
93 | if (ERR_func_error_string(BUF_str_functs[0].error) == NULL) | 92 | ERR_load_strings(0, BUF_str_functs); |
94 | { | 93 | ERR_load_strings(0, BUF_str_reasons); |
95 | ERR_load_strings(0,BUF_str_functs); | ||
96 | ERR_load_strings(0,BUF_str_reasons); | ||
97 | } | ||
98 | #endif | ||
99 | } | 94 | } |
95 | #endif | ||
96 | } | ||
diff --git a/src/lib/libssl/src/crypto/buffer/buffer.c b/src/lib/libssl/src/crypto/buffer/buffer.c index b52c59f8a3..4bd55c04ae 100644 --- a/src/lib/libssl/src/crypto/buffer/buffer.c +++ b/src/lib/libssl/src/crypto/buffer/buffer.c | |||
@@ -5,21 +5,21 @@ | |||
5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
8 | * | 8 | * |
9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
11 | * apply to all code found in this distribution, be it the RC4, RSA, | 11 | * apply to all code found in this distribution, be it the RC4, RSA, |
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation |
13 | * included with this distribution is covered by the same copyright terms | 13 | * included with this distribution is covered by the same copyright terms |
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
15 | * | 15 | * |
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
18 | * If this package is used in a product, Eric Young should be given attribution | 18 | * If this package is used in a product, Eric Young should be given attribution |
19 | * as the author of the parts of the library used. | 19 | * as the author of the parts of the library used. |
20 | * This can be in the form of a textual message at program startup or | 20 | * This can be in the form of a textual message at program startup or |
21 | * in documentation (online or textual) provided with the package. | 21 | * in documentation (online or textual) provided with the package. |
22 | * | 22 | * |
23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
25 | * are met: | 25 | * are met: |
@@ -34,10 +34,10 @@ | |||
34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 37 | * 4. If you include any Windows specific code (or a derivative thereof) from |
38 | * the apps directory (application code) you must include an acknowledgement: | 38 | * the apps directory (application code) you must include an acknowledgement: |
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
40 | * | 40 | * |
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
@@ -49,7 +49,7 @@ | |||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
52 | * | 52 | * |
53 | * The licence and distribution terms for any publically available version or | 53 | * The licence and distribution terms for any publically available version or |
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
@@ -65,139 +65,126 @@ | |||
65 | * that the result fits in an int. */ | 65 | * that the result fits in an int. */ |
66 | #define LIMIT_BEFORE_EXPANSION 0x5ffffffc | 66 | #define LIMIT_BEFORE_EXPANSION 0x5ffffffc |
67 | 67 | ||
68 | BUF_MEM *BUF_MEM_new(void) | 68 | BUF_MEM * |
69 | { | 69 | BUF_MEM_new(void) |
70 | { | ||
70 | BUF_MEM *ret; | 71 | BUF_MEM *ret; |
71 | 72 | ||
72 | ret=malloc(sizeof(BUF_MEM)); | 73 | ret = malloc(sizeof(BUF_MEM)); |
73 | if (ret == NULL) | 74 | if (ret == NULL) { |
74 | { | 75 | BUFerr(BUF_F_BUF_MEM_NEW, ERR_R_MALLOC_FAILURE); |
75 | BUFerr(BUF_F_BUF_MEM_NEW,ERR_R_MALLOC_FAILURE); | 76 | return (NULL); |
76 | return(NULL); | ||
77 | } | ||
78 | ret->length=0; | ||
79 | ret->max=0; | ||
80 | ret->data=NULL; | ||
81 | return(ret); | ||
82 | } | 77 | } |
78 | ret->length = 0; | ||
79 | ret->max = 0; | ||
80 | ret->data = NULL; | ||
81 | return (ret); | ||
82 | } | ||
83 | 83 | ||
84 | void BUF_MEM_free(BUF_MEM *a) | 84 | void |
85 | { | 85 | BUF_MEM_free(BUF_MEM *a) |
86 | if(a == NULL) | 86 | { |
87 | return; | 87 | if (a == NULL) |
88 | return; | ||
88 | 89 | ||
89 | if (a->data != NULL) | 90 | if (a->data != NULL) { |
90 | { | 91 | memset(a->data, 0,(unsigned int)a->max); |
91 | memset(a->data,0,(unsigned int)a->max); | ||
92 | free(a->data); | 92 | free(a->data); |
93 | } | ||
94 | free(a); | ||
95 | } | 93 | } |
94 | free(a); | ||
95 | } | ||
96 | 96 | ||
97 | int BUF_MEM_grow(BUF_MEM *str, size_t len) | 97 | int |
98 | { | 98 | BUF_MEM_grow(BUF_MEM *str, size_t len) |
99 | { | ||
99 | char *ret; | 100 | char *ret; |
100 | size_t n; | 101 | size_t n; |
101 | 102 | ||
102 | if (str->length >= len) | 103 | if (str->length >= len) { |
103 | { | 104 | str->length = len; |
104 | str->length=len; | 105 | return (len); |
105 | return(len); | 106 | } |
106 | } | 107 | if (str->max >= len) { |
107 | if (str->max >= len) | 108 | memset(&str->data[str->length], 0,len - str->length); |
108 | { | 109 | str->length = len; |
109 | memset(&str->data[str->length],0,len-str->length); | 110 | return (len); |
110 | str->length=len; | 111 | } |
111 | return(len); | ||
112 | } | ||
113 | /* This limit is sufficient to ensure (len+3)/3*4 < 2**31 */ | 112 | /* This limit is sufficient to ensure (len+3)/3*4 < 2**31 */ |
114 | if (len > LIMIT_BEFORE_EXPANSION) | 113 | if (len > LIMIT_BEFORE_EXPANSION) { |
115 | { | 114 | BUFerr(BUF_F_BUF_MEM_GROW, ERR_R_MALLOC_FAILURE); |
116 | BUFerr(BUF_F_BUF_MEM_GROW,ERR_R_MALLOC_FAILURE); | ||
117 | return 0; | 115 | return 0; |
118 | } | 116 | } |
119 | n=(len+3)/3*4; | 117 | n = (len + 3) / 3 * 4; |
120 | if (str->data == NULL) | 118 | if (str->data == NULL) |
121 | ret=malloc(n); | 119 | ret = malloc(n); |
122 | else | 120 | else |
123 | ret=realloc(str->data,n); | 121 | ret = realloc(str->data, n); |
124 | if (ret == NULL) | 122 | if (ret == NULL) { |
125 | { | 123 | BUFerr(BUF_F_BUF_MEM_GROW, ERR_R_MALLOC_FAILURE); |
126 | BUFerr(BUF_F_BUF_MEM_GROW,ERR_R_MALLOC_FAILURE); | 124 | len = 0; |
127 | len=0; | 125 | } else { |
128 | } | 126 | str->data = ret; |
129 | else | 127 | str->max = n; |
130 | { | 128 | memset(&str->data[str->length], 0,len - str->length); |
131 | str->data=ret; | 129 | str->length = len; |
132 | str->max=n; | ||
133 | memset(&str->data[str->length],0,len-str->length); | ||
134 | str->length=len; | ||
135 | } | ||
136 | return(len); | ||
137 | } | 130 | } |
131 | return (len); | ||
132 | } | ||
138 | 133 | ||
139 | int BUF_MEM_grow_clean(BUF_MEM *str, size_t len) | 134 | int |
140 | { | 135 | BUF_MEM_grow_clean(BUF_MEM *str, size_t len) |
136 | { | ||
141 | char *ret; | 137 | char *ret; |
142 | size_t n; | 138 | size_t n; |
143 | 139 | ||
144 | if (str->length >= len) | 140 | if (str->length >= len) { |
145 | { | 141 | memset(&str->data[len], 0,str->length - len); |
146 | memset(&str->data[len],0,str->length-len); | 142 | str->length = len; |
147 | str->length=len; | 143 | return (len); |
148 | return(len); | 144 | } |
149 | } | 145 | if (str->max >= len) { |
150 | if (str->max >= len) | 146 | memset(&str->data[str->length], 0,len - str->length); |
151 | { | 147 | str->length = len; |
152 | memset(&str->data[str->length],0,len-str->length); | 148 | return (len); |
153 | str->length=len; | 149 | } |
154 | return(len); | ||
155 | } | ||
156 | /* This limit is sufficient to ensure (len+3)/3*4 < 2**31 */ | 150 | /* This limit is sufficient to ensure (len+3)/3*4 < 2**31 */ |
157 | if (len > LIMIT_BEFORE_EXPANSION) | 151 | if (len > LIMIT_BEFORE_EXPANSION) { |
158 | { | 152 | BUFerr(BUF_F_BUF_MEM_GROW_CLEAN, ERR_R_MALLOC_FAILURE); |
159 | BUFerr(BUF_F_BUF_MEM_GROW_CLEAN,ERR_R_MALLOC_FAILURE); | ||
160 | return 0; | 153 | return 0; |
161 | } | 154 | } |
162 | n=(len+3)/3*4; | 155 | n = (len + 3) / 3 * 4; |
163 | if (str->data == NULL) | 156 | if (str->data == NULL) |
164 | ret=malloc(n); | 157 | ret = malloc(n); |
165 | else | ||
166 | ret=OPENSSL_realloc_clean(str->data,str->max,n); | ||
167 | if (ret == NULL) | ||
168 | { | ||
169 | BUFerr(BUF_F_BUF_MEM_GROW_CLEAN,ERR_R_MALLOC_FAILURE); | ||
170 | len=0; | ||
171 | } | ||
172 | else | 158 | else |
173 | { | 159 | ret = OPENSSL_realloc_clean(str->data, str->max, n); |
174 | str->data=ret; | 160 | if (ret == NULL) { |
175 | str->max=n; | 161 | BUFerr(BUF_F_BUF_MEM_GROW_CLEAN, ERR_R_MALLOC_FAILURE); |
176 | memset(&str->data[str->length],0,len-str->length); | 162 | len = 0; |
177 | str->length=len; | 163 | } else { |
178 | } | 164 | str->data = ret; |
179 | return(len); | 165 | str->max = n; |
166 | memset(&str->data[str->length], 0, len - str->length); | ||
167 | str->length = len; | ||
180 | } | 168 | } |
169 | return (len); | ||
170 | } | ||
181 | 171 | ||
182 | void BUF_reverse(unsigned char *out, const unsigned char *in, size_t size) | 172 | void |
183 | { | 173 | BUF_reverse(unsigned char *out, const unsigned char *in, size_t size) |
174 | { | ||
184 | size_t i; | 175 | size_t i; |
185 | if (in) | 176 | if (in) { |
186 | { | ||
187 | out += size - 1; | 177 | out += size - 1; |
188 | for (i = 0; i < size; i++) | 178 | for (i = 0; i < size; i++) |
189 | *out-- = *in++; | 179 | *out-- = *in++; |
190 | } | 180 | } else { |
191 | else | ||
192 | { | ||
193 | unsigned char *q; | 181 | unsigned char *q; |
194 | char c; | 182 | char c; |
195 | q = out + size - 1; | 183 | q = out + size - 1; |
196 | for (i = 0; i < size/2; i++) | 184 | for (i = 0; i < size / 2; i++) { |
197 | { | ||
198 | c = *q; | 185 | c = *q; |
199 | *q-- = *out; | 186 | *q-- = *out; |
200 | *out++ = c; | 187 | *out++ = c; |
201 | } | ||
202 | } | 188 | } |
203 | } | 189 | } |
190 | } | ||
diff --git a/src/lib/libssl/src/crypto/buffer/buffer.h b/src/lib/libssl/src/crypto/buffer/buffer.h index f8da32b485..ab1fab4410 100644 --- a/src/lib/libssl/src/crypto/buffer/buffer.h +++ b/src/lib/libssl/src/crypto/buffer/buffer.h | |||
@@ -5,21 +5,21 @@ | |||
5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
8 | * | 8 | * |
9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
11 | * apply to all code found in this distribution, be it the RC4, RSA, | 11 | * apply to all code found in this distribution, be it the RC4, RSA, |
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation |
13 | * included with this distribution is covered by the same copyright terms | 13 | * included with this distribution is covered by the same copyright terms |
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
15 | * | 15 | * |
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
18 | * If this package is used in a product, Eric Young should be given attribution | 18 | * If this package is used in a product, Eric Young should be given attribution |
19 | * as the author of the parts of the library used. | 19 | * as the author of the parts of the library used. |
20 | * This can be in the form of a textual message at program startup or | 20 | * This can be in the form of a textual message at program startup or |
21 | * in documentation (online or textual) provided with the package. | 21 | * in documentation (online or textual) provided with the package. |
22 | * | 22 | * |
23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
25 | * are met: | 25 | * are met: |
@@ -34,10 +34,10 @@ | |||
34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 37 | * 4. If you include any Windows specific code (or a derivative thereof) from |
38 | * the apps directory (application code) you must include an acknowledgement: | 38 | * the apps directory (application code) you must include an acknowledgement: |
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
40 | * | 40 | * |
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
@@ -49,7 +49,7 @@ | |||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
52 | * | 52 | * |
53 | * The licence and distribution terms for any publically available version or | 53 | * The licence and distribution terms for any publically available version or |
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
@@ -74,12 +74,11 @@ extern "C" { | |||
74 | /* Already declared in ossl_typ.h */ | 74 | /* Already declared in ossl_typ.h */ |
75 | /* typedef struct buf_mem_st BUF_MEM; */ | 75 | /* typedef struct buf_mem_st BUF_MEM; */ |
76 | 76 | ||
77 | struct buf_mem_st | 77 | struct buf_mem_st { |
78 | { | ||
79 | size_t length; /* current number of bytes */ | 78 | size_t length; /* current number of bytes */ |
80 | char *data; | 79 | char *data; |
81 | size_t max; /* size of buffer */ | 80 | size_t max; /* size of buffer */ |
82 | }; | 81 | }; |
83 | 82 | ||
84 | BUF_MEM *BUF_MEM_new(void); | 83 | BUF_MEM *BUF_MEM_new(void); |
85 | void BUF_MEM_free(BUF_MEM *a); | 84 | void BUF_MEM_free(BUF_MEM *a); |
@@ -91,8 +90,8 @@ void * BUF_memdup(const void *data, size_t siz); | |||
91 | void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); | 90 | void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz); |
92 | 91 | ||
93 | /* safe string functions */ | 92 | /* safe string functions */ |
94 | size_t BUF_strlcpy(char *dst,const char *src,size_t siz); | 93 | size_t BUF_strlcpy(char *dst, const char *src, size_t siz); |
95 | size_t BUF_strlcat(char *dst,const char *src,size_t siz); | 94 | size_t BUF_strlcat(char *dst, const char *src, size_t siz); |
96 | 95 | ||
97 | 96 | ||
98 | /* BEGIN ERROR CODES */ | 97 | /* BEGIN ERROR CODES */ |