summaryrefslogtreecommitdiff
path: root/lib/libcrypto/x509v3/v3_lib.c
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2000-12-15 02:58:48 +0000
committerBob Beck <beck@cvs.openbsd.org>2000-12-15 02:58:48 +0000
commit01c37e03996dffeff1618614755c6cc676899acb (patch)
tree988002fb9b1d859c10890511aa5273cfb00662dc /lib/libcrypto/x509v3/v3_lib.c
parent9865f3ff77de9cfef0c5c8b0470daf6faa2f14af (diff)
openssl-engine-0.9.6 merge
Diffstat (limited to 'lib/libcrypto/x509v3/v3_lib.c')
-rw-r--r--lib/libcrypto/x509v3/v3_lib.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/lib/libcrypto/x509v3/v3_lib.c b/lib/libcrypto/x509v3/v3_lib.c
index 4242d130a2c..ea86b9ebb95 100644
--- a/lib/libcrypto/x509v3/v3_lib.c
+++ b/lib/libcrypto/x509v3/v3_lib.c
@@ -64,25 +64,27 @@
#include "ext_dat.h"
-static STACK *ext_list = NULL;
+static STACK_OF(X509V3_EXT_METHOD) *ext_list = NULL;
-static int ext_cmp(X509V3_EXT_METHOD **a, X509V3_EXT_METHOD **b);
+static int ext_cmp(const X509V3_EXT_METHOD * const *a,
+ const X509V3_EXT_METHOD * const *b);
static void ext_list_free(X509V3_EXT_METHOD *ext);
int X509V3_EXT_add(X509V3_EXT_METHOD *ext)
{
- if(!ext_list && !(ext_list = sk_new(ext_cmp))) {
+ if(!ext_list && !(ext_list = sk_X509V3_EXT_METHOD_new(ext_cmp))) {
X509V3err(X509V3_F_X509V3_EXT_ADD,ERR_R_MALLOC_FAILURE);
return 0;
}
- if(!sk_push(ext_list, (char *)ext)) {
+ if(!sk_X509V3_EXT_METHOD_push(ext_list, ext)) {
X509V3err(X509V3_F_X509V3_EXT_ADD,ERR_R_MALLOC_FAILURE);
return 0;
}
return 1;
}
-static int ext_cmp(X509V3_EXT_METHOD **a, X509V3_EXT_METHOD **b)
+static int ext_cmp(const X509V3_EXT_METHOD * const *a,
+ const X509V3_EXT_METHOD * const *b)
{
return ((*a)->ext_nid - (*b)->ext_nid);
}
@@ -95,12 +97,12 @@ X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid)
tmp.ext_nid = nid;
ret = (X509V3_EXT_METHOD **) OBJ_bsearch((char *)&t,
(char *)standard_exts, STANDARD_EXTENSION_COUNT,
- sizeof(X509V3_EXT_METHOD *), (int (*)())ext_cmp);
+ sizeof(X509V3_EXT_METHOD *), (int (*)(const void *, const void *))ext_cmp);
if(ret) return *ret;
if(!ext_list) return NULL;
- idx = sk_find(ext_list, (char *)&tmp);
+ idx = sk_X509V3_EXT_METHOD_find(ext_list, &tmp);
if(idx == -1) return NULL;
- return (X509V3_EXT_METHOD *)sk_value(ext_list, idx);
+ return sk_X509V3_EXT_METHOD_value(ext_list, idx);
}
X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext)
@@ -125,7 +127,7 @@ int X509V3_EXT_add_alias(int nid_to, int nid_from)
X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,X509V3_R_EXTENSION_NOT_FOUND);
return 0;
}
- if(!(tmpext = (X509V3_EXT_METHOD *)Malloc(sizeof(X509V3_EXT_METHOD)))) {
+ if(!(tmpext = (X509V3_EXT_METHOD *)OPENSSL_malloc(sizeof(X509V3_EXT_METHOD)))) {
X509V3err(X509V3_F_X509V3_EXT_ADD_ALIAS,ERR_R_MALLOC_FAILURE);
return 0;
}
@@ -137,13 +139,13 @@ int X509V3_EXT_add_alias(int nid_to, int nid_from)
void X509V3_EXT_cleanup(void)
{
- sk_pop_free(ext_list, ext_list_free);
+ sk_X509V3_EXT_METHOD_pop_free(ext_list, ext_list_free);
ext_list = NULL;
}
static void ext_list_free(X509V3_EXT_METHOD *ext)
{
- if(ext->ext_flags & X509V3_EXT_DYNAMIC) Free(ext);
+ if(ext->ext_flags & X509V3_EXT_DYNAMIC) OPENSSL_free(ext);
}
/* Legacy function: we don't need to add standard extensions
@@ -213,9 +215,11 @@ void *X509V3_get_d2i(STACK_OF(X509_EXTENSION) *x, int nid, int *crit, int *idx)
if(crit) *crit = found_ex->critical;
return X509V3_EXT_d2i(found_ex);
}
-
+
/* Extension not found */
if(idx) *idx = -1;
if(crit) *crit = -1;
return NULL;
}
+
+IMPLEMENT_STACK_OF(X509V3_EXT_METHOD)