diff options
author | beck <> | 2000-12-15 02:58:47 +0000 |
---|---|---|
committer | beck <> | 2000-12-15 02:58:47 +0000 |
commit | 9200bb13d15da4b2a23e6bc92c20e95b74aa2113 (patch) | |
tree | 5c52d628ec1e34be76e7ef2a4235d248b7c44d24 /src/lib/libcrypto/x509/by_dir.c | |
parent | e131d25072e3d4197ba4b9bcc0d1b27d34d6488d (diff) | |
download | openbsd-9200bb13d15da4b2a23e6bc92c20e95b74aa2113.tar.gz openbsd-9200bb13d15da4b2a23e6bc92c20e95b74aa2113.tar.bz2 openbsd-9200bb13d15da4b2a23e6bc92c20e95b74aa2113.zip |
openssl-engine-0.9.6 merge
Diffstat (limited to 'src/lib/libcrypto/x509/by_dir.c')
-rw-r--r-- | src/lib/libcrypto/x509/by_dir.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/lib/libcrypto/x509/by_dir.c b/src/lib/libcrypto/x509/by_dir.c index 14d12c56bd..cac64a6f40 100644 --- a/src/lib/libcrypto/x509/by_dir.c +++ b/src/lib/libcrypto/x509/by_dir.c | |||
@@ -146,11 +146,11 @@ static int new_dir(X509_LOOKUP *lu) | |||
146 | { | 146 | { |
147 | BY_DIR *a; | 147 | BY_DIR *a; |
148 | 148 | ||
149 | if ((a=(BY_DIR *)Malloc(sizeof(BY_DIR))) == NULL) | 149 | if ((a=(BY_DIR *)OPENSSL_malloc(sizeof(BY_DIR))) == NULL) |
150 | return(0); | 150 | return(0); |
151 | if ((a->buffer=BUF_MEM_new()) == NULL) | 151 | if ((a->buffer=BUF_MEM_new()) == NULL) |
152 | { | 152 | { |
153 | Free(a); | 153 | OPENSSL_free(a); |
154 | return(0); | 154 | return(0); |
155 | } | 155 | } |
156 | a->num_dirs=0; | 156 | a->num_dirs=0; |
@@ -168,11 +168,11 @@ static void free_dir(X509_LOOKUP *lu) | |||
168 | 168 | ||
169 | a=(BY_DIR *)lu->method_data; | 169 | a=(BY_DIR *)lu->method_data; |
170 | for (i=0; i<a->num_dirs; i++) | 170 | for (i=0; i<a->num_dirs; i++) |
171 | if (a->dirs[i] != NULL) Free(a->dirs[i]); | 171 | if (a->dirs[i] != NULL) OPENSSL_free(a->dirs[i]); |
172 | if (a->dirs != NULL) Free(a->dirs); | 172 | if (a->dirs != NULL) OPENSSL_free(a->dirs); |
173 | if (a->dirs_type != NULL) Free(a->dirs_type); | 173 | if (a->dirs_type != NULL) OPENSSL_free(a->dirs_type); |
174 | if (a->buffer != NULL) BUF_MEM_free(a->buffer); | 174 | if (a->buffer != NULL) BUF_MEM_free(a->buffer); |
175 | Free(a); | 175 | OPENSSL_free(a); |
176 | } | 176 | } |
177 | 177 | ||
178 | static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) | 178 | static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) |
@@ -204,9 +204,9 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) | |||
204 | if (ctx->num_dirs_alloced < (ctx->num_dirs+1)) | 204 | if (ctx->num_dirs_alloced < (ctx->num_dirs+1)) |
205 | { | 205 | { |
206 | ctx->num_dirs_alloced+=10; | 206 | ctx->num_dirs_alloced+=10; |
207 | pp=(char **)Malloc(ctx->num_dirs_alloced* | 207 | pp=(char **)OPENSSL_malloc(ctx->num_dirs_alloced* |
208 | sizeof(char *)); | 208 | sizeof(char *)); |
209 | ip=(int *)Malloc(ctx->num_dirs_alloced* | 209 | ip=(int *)OPENSSL_malloc(ctx->num_dirs_alloced* |
210 | sizeof(int)); | 210 | sizeof(int)); |
211 | if ((pp == NULL) || (ip == NULL)) | 211 | if ((pp == NULL) || (ip == NULL)) |
212 | { | 212 | { |
@@ -218,14 +218,14 @@ static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) | |||
218 | memcpy(ip,ctx->dirs_type,(ctx->num_dirs_alloced-10)* | 218 | memcpy(ip,ctx->dirs_type,(ctx->num_dirs_alloced-10)* |
219 | sizeof(int)); | 219 | sizeof(int)); |
220 | if (ctx->dirs != NULL) | 220 | if (ctx->dirs != NULL) |
221 | Free(ctx->dirs); | 221 | OPENSSL_free(ctx->dirs); |
222 | if (ctx->dirs_type != NULL) | 222 | if (ctx->dirs_type != NULL) |
223 | Free(ctx->dirs_type); | 223 | OPENSSL_free(ctx->dirs_type); |
224 | ctx->dirs=pp; | 224 | ctx->dirs=pp; |
225 | ctx->dirs_type=ip; | 225 | ctx->dirs_type=ip; |
226 | } | 226 | } |
227 | ctx->dirs_type[ctx->num_dirs]=type; | 227 | ctx->dirs_type[ctx->num_dirs]=type; |
228 | ctx->dirs[ctx->num_dirs]=(char *)Malloc((unsigned int)len+1); | 228 | ctx->dirs[ctx->num_dirs]=(char *)OPENSSL_malloc((unsigned int)len+1); |
229 | if (ctx->dirs[ctx->num_dirs] == NULL) return(0); | 229 | if (ctx->dirs[ctx->num_dirs] == NULL) return(0); |
230 | strncpy(ctx->dirs[ctx->num_dirs],ss,(unsigned int)len); | 230 | strncpy(ctx->dirs[ctx->num_dirs],ss,(unsigned int)len); |
231 | ctx->dirs[ctx->num_dirs][len]='\0'; | 231 | ctx->dirs[ctx->num_dirs][len]='\0'; |
@@ -326,7 +326,9 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, | |||
326 | /* we have added it to the cache so now pull | 326 | /* we have added it to the cache so now pull |
327 | * it out again */ | 327 | * it out again */ |
328 | CRYPTO_r_lock(CRYPTO_LOCK_X509_STORE); | 328 | CRYPTO_r_lock(CRYPTO_LOCK_X509_STORE); |
329 | tmp=(X509_OBJECT *)lh_retrieve(xl->store_ctx->certs,&stmp); | 329 | j = sk_X509_OBJECT_find(xl->store_ctx->objs,&stmp); |
330 | if(j != -1) tmp=sk_X509_OBJECT_value(xl->store_ctx->objs,i); | ||
331 | else tmp = NULL; | ||
330 | CRYPTO_r_unlock(CRYPTO_LOCK_X509_STORE); | 332 | CRYPTO_r_unlock(CRYPTO_LOCK_X509_STORE); |
331 | 333 | ||
332 | if (tmp != NULL) | 334 | if (tmp != NULL) |