summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dso
diff options
context:
space:
mode:
authorbeck <>2014-04-17 13:37:50 +0000
committerbeck <>2014-04-17 13:37:50 +0000
commitbddb7c686e3d1aeb156722adc64b6c35ae720f87 (patch)
tree7595a93a27385c367802aa17ecf20f96551cf14d /src/lib/libcrypto/dso
parentecec66222d758996a4ff2671ca5026d9ede5ef76 (diff)
downloadopenbsd-bddb7c686e3d1aeb156722adc64b6c35ae720f87.tar.gz
openbsd-bddb7c686e3d1aeb156722adc64b6c35ae720f87.tar.bz2
openbsd-bddb7c686e3d1aeb156722adc64b6c35ae720f87.zip
Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes: OPENSSL_malloc->malloc OPENSSL_free->free OPENSSL_relloc->realloc OPENSSL_freeFunc->free
Diffstat (limited to 'src/lib/libcrypto/dso')
-rw-r--r--src/lib/libcrypto/dso/dso.h10
-rw-r--r--src/lib/libcrypto/dso/dso_dlfcn.c10
-rw-r--r--src/lib/libcrypto/dso/dso_lib.c18
3 files changed, 19 insertions, 19 deletions
diff --git a/src/lib/libcrypto/dso/dso.h b/src/lib/libcrypto/dso/dso.h
index f36f209afd..9010251bbc 100644
--- a/src/lib/libcrypto/dso/dso.h
+++ b/src/lib/libcrypto/dso/dso.h
@@ -112,7 +112,7 @@ typedef struct dso_st DSO;
112 * (or NULL if they are to be used independantly of a DSO object) and a 112 * (or NULL if they are to be used independantly of a DSO object) and a
113 * filename to transform. They should either return NULL (if there is an error 113 * filename to transform. They should either return NULL (if there is an error
114 * condition) or a newly allocated string containing the transformed form that 114 * condition) or a newly allocated string containing the transformed form that
115 * the caller will need to free with OPENSSL_free() when done. */ 115 * the caller will need to free with free() when done. */
116typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *); 116typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *);
117/* The function prototype used for method functions (or caller-provided 117/* The function prototype used for method functions (or caller-provided
118 * callbacks) that merge two file specifications. They are passed a 118 * callbacks) that merge two file specifications. They are passed a
@@ -120,7 +120,7 @@ typedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *);
120 * a DSO object) and two file specifications to merge. They should 120 * a DSO object) and two file specifications to merge. They should
121 * either return NULL (if there is an error condition) or a newly allocated 121 * either return NULL (if there is an error condition) or a newly allocated
122 * string containing the result of merging that the caller will need 122 * string containing the result of merging that the caller will need
123 * to free with OPENSSL_free() when done. 123 * to free with free() when done.
124 * Here, merging means that bits and pieces are taken from each of the 124 * Here, merging means that bits and pieces are taken from each of the
125 * file specifications and added together in whatever fashion that is 125 * file specifications and added together in whatever fashion that is
126 * sensible for the DSO method in question. The only rule that really 126 * sensible for the DSO method in question. The only rule that really
@@ -136,7 +136,7 @@ typedef struct dso_meth_st
136 const char *name; 136 const char *name;
137 /* Loads a shared library, NB: new DSO_METHODs must ensure that a 137 /* Loads a shared library, NB: new DSO_METHODs must ensure that a
138 * successful load populates the loaded_filename field, and likewise a 138 * successful load populates the loaded_filename field, and likewise a
139 * successful unload OPENSSL_frees and NULLs it out. */ 139 * successful unload frees and NULLs it out. */
140 int (*dso_load)(DSO *dso); 140 int (*dso_load)(DSO *dso);
141 /* Unloads a shared library */ 141 /* Unloads a shared library */
142 int (*dso_unload)(DSO *dso); 142 int (*dso_unload)(DSO *dso);
@@ -242,12 +242,12 @@ int DSO_set_filename(DSO *dso, const char *filename);
242 * simply duplicated. NB: This function is usually called from within a 242 * simply duplicated. NB: This function is usually called from within a
243 * DSO_METHOD during the processing of a DSO_load() call, and is exposed so that 243 * DSO_METHOD during the processing of a DSO_load() call, and is exposed so that
244 * caller-created DSO_METHODs can do the same thing. A non-NULL return value 244 * caller-created DSO_METHODs can do the same thing. A non-NULL return value
245 * will need to be OPENSSL_free()'d. */ 245 * will need to be free()'d. */
246char *DSO_convert_filename(DSO *dso, const char *filename); 246char *DSO_convert_filename(DSO *dso, const char *filename);
247/* This function will invoke the DSO's merger callback to merge two file 247/* This function will invoke the DSO's merger callback to merge two file
248 * specifications, or if the callback isn't set it will instead use the 248 * specifications, or if the callback isn't set it will instead use the
249 * DSO_METHOD's merger. A non-NULL return value will need to be 249 * DSO_METHOD's merger. A non-NULL return value will need to be
250 * OPENSSL_free()'d. */ 250 * free()'d. */
251char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2); 251char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2);
252/* If the DSO is currently loaded, this returns the filename that it was loaded 252/* If the DSO is currently loaded, this returns the filename that it was loaded
253 * under, otherwise it returns NULL. So it is also useful as a test as to 253 * under, otherwise it returns NULL. So it is also useful as a test as to
diff --git a/src/lib/libcrypto/dso/dso_dlfcn.c b/src/lib/libcrypto/dso/dso_dlfcn.c
index fe5f0ffdb0..648ddb5ac0 100644
--- a/src/lib/libcrypto/dso/dso_dlfcn.c
+++ b/src/lib/libcrypto/dso/dso_dlfcn.c
@@ -153,7 +153,7 @@ static int dlfcn_load(DSO *dso)
153err: 153err:
154 /* Cleanup! */ 154 /* Cleanup! */
155 if(filename != NULL) 155 if(filename != NULL)
156 OPENSSL_free(filename); 156 free(filename);
157 if(ptr != NULL) 157 if(ptr != NULL)
158 dlclose(ptr); 158 dlclose(ptr);
159 return(0); 159 return(0);
@@ -264,7 +264,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1,
264 if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/')) 264 if (!filespec2 || (filespec1 != NULL && filespec1[0] == '/'))
265 { 265 {
266 len = strlen(filespec1) + 1; 266 len = strlen(filespec1) + 1;
267 merged = OPENSSL_malloc(len); 267 merged = malloc(len);
268 if(!merged) 268 if(!merged)
269 { 269 {
270 DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE); 270 DSOerr(DSO_F_DLFCN_MERGER, ERR_R_MALLOC_FAILURE);
@@ -276,7 +276,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1,
276 else if (!filespec1) 276 else if (!filespec1)
277 { 277 {
278 len = strlen(filespec2) + 1; 278 len = strlen(filespec2) + 1;
279 merged = OPENSSL_malloc(strlen(filespec2) + 1); 279 merged = malloc(strlen(filespec2) + 1);
280 if(!merged) 280 if(!merged)
281 { 281 {
282 DSOerr(DSO_F_DLFCN_MERGER, 282 DSOerr(DSO_F_DLFCN_MERGER,
@@ -302,7 +302,7 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1,
302 spec2len--; 302 spec2len--;
303 len--; 303 len--;
304 } 304 }
305 merged = OPENSSL_malloc(len + 2); 305 merged = malloc(len + 2);
306 if(!merged) 306 if(!merged)
307 { 307 {
308 DSOerr(DSO_F_DLFCN_MERGER, 308 DSOerr(DSO_F_DLFCN_MERGER,
@@ -334,7 +334,7 @@ static char *dlfcn_name_converter(DSO *dso, const char *filename)
334 if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0) 334 if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
335 rsize += 3; /* The length of "lib" */ 335 rsize += 3; /* The length of "lib" */
336 } 336 }
337 translated = OPENSSL_malloc(rsize); 337 translated = malloc(rsize);
338 if(translated == NULL) 338 if(translated == NULL)
339 { 339 {
340 DSOerr(DSO_F_DLFCN_NAME_CONVERTER, 340 DSOerr(DSO_F_DLFCN_NAME_CONVERTER,
diff --git a/src/lib/libcrypto/dso/dso_lib.c b/src/lib/libcrypto/dso/dso_lib.c
index 8a15b794ab..68f5430ea8 100644
--- a/src/lib/libcrypto/dso/dso_lib.c
+++ b/src/lib/libcrypto/dso/dso_lib.c
@@ -100,7 +100,7 @@ DSO *DSO_new_method(DSO_METHOD *meth)
100 * to stealing the "best available" method. Will fallback 100 * to stealing the "best available" method. Will fallback
101 * to DSO_METH_null() in the worst case. */ 101 * to DSO_METH_null() in the worst case. */
102 default_DSO_meth = DSO_METHOD_openssl(); 102 default_DSO_meth = DSO_METHOD_openssl();
103 ret = (DSO *)OPENSSL_malloc(sizeof(DSO)); 103 ret = (DSO *)malloc(sizeof(DSO));
104 if(ret == NULL) 104 if(ret == NULL)
105 { 105 {
106 DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE); 106 DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE);
@@ -112,7 +112,7 @@ DSO *DSO_new_method(DSO_METHOD *meth)
112 { 112 {
113 /* sk_new doesn't generate any errors so we do */ 113 /* sk_new doesn't generate any errors so we do */
114 DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE); 114 DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE);
115 OPENSSL_free(ret); 115 free(ret);
116 return(NULL); 116 return(NULL);
117 } 117 }
118 if(meth == NULL) 118 if(meth == NULL)
@@ -122,7 +122,7 @@ DSO *DSO_new_method(DSO_METHOD *meth)
122 ret->references = 1; 122 ret->references = 1;
123 if((ret->meth->init != NULL) && !ret->meth->init(ret)) 123 if((ret->meth->init != NULL) && !ret->meth->init(ret))
124 { 124 {
125 OPENSSL_free(ret); 125 free(ret);
126 ret=NULL; 126 ret=NULL;
127 } 127 }
128 return(ret); 128 return(ret);
@@ -165,11 +165,11 @@ int DSO_free(DSO *dso)
165 165
166 sk_void_free(dso->meth_data); 166 sk_void_free(dso->meth_data);
167 if(dso->filename != NULL) 167 if(dso->filename != NULL)
168 OPENSSL_free(dso->filename); 168 free(dso->filename);
169 if(dso->loaded_filename != NULL) 169 if(dso->loaded_filename != NULL)
170 OPENSSL_free(dso->loaded_filename); 170 free(dso->loaded_filename);
171 171
172 OPENSSL_free(dso); 172 free(dso);
173 return(1); 173 return(1);
174 } 174 }
175 175
@@ -377,7 +377,7 @@ int DSO_set_filename(DSO *dso, const char *filename)
377 return(0); 377 return(0);
378 } 378 }
379 /* We'll duplicate filename */ 379 /* We'll duplicate filename */
380 copied = OPENSSL_malloc(strlen(filename) + 1); 380 copied = malloc(strlen(filename) + 1);
381 if(copied == NULL) 381 if(copied == NULL)
382 { 382 {
383 DSOerr(DSO_F_DSO_SET_FILENAME,ERR_R_MALLOC_FAILURE); 383 DSOerr(DSO_F_DSO_SET_FILENAME,ERR_R_MALLOC_FAILURE);
@@ -385,7 +385,7 @@ int DSO_set_filename(DSO *dso, const char *filename)
385 } 385 }
386 BUF_strlcpy(copied, filename, strlen(filename) + 1); 386 BUF_strlcpy(copied, filename, strlen(filename) + 1);
387 if(dso->filename) 387 if(dso->filename)
388 OPENSSL_free(dso->filename); 388 free(dso->filename);
389 dso->filename = copied; 389 dso->filename = copied;
390 return(1); 390 return(1);
391 } 391 }
@@ -435,7 +435,7 @@ char *DSO_convert_filename(DSO *dso, const char *filename)
435 } 435 }
436 if(result == NULL) 436 if(result == NULL)
437 { 437 {
438 result = OPENSSL_malloc(strlen(filename) + 1); 438 result = malloc(strlen(filename) + 1);
439 if(result == NULL) 439 if(result == NULL)
440 { 440 {
441 DSOerr(DSO_F_DSO_CONVERT_FILENAME, 441 DSOerr(DSO_F_DSO_CONVERT_FILENAME,