Some more stack stuff.
authorBen Laurie <ben@openssl.org>
Mon, 3 May 1999 19:55:00 +0000 (19:55 +0000)
committerBen Laurie <ben@openssl.org>
Mon, 3 May 1999 19:55:00 +0000 (19:55 +0000)
crypto/stack/safestack.h
ssl/ssl.h
ssl/ssl_cert.c

index 154468e699e319c43fa40e9630ddbb0ee09d635a..48e695fb2711d2210b98d1788a3497c8a6230a47 100644 (file)
@@ -76,7 +76,8 @@ int sk_##type##_find(STACK_OF(type) *sk,type *v); \
 type *sk_##type##_delete(STACK_OF(type) *sk,int n); \
 void sk_##type##_delete_ptr(STACK_OF(type) *sk,type *v); \
 int sk_##type##_insert(STACK_OF(type) *sk,type *v,int n); \
-void sk_##type##_set_cmp_func(STACK_OF(type) *sk,int (*cmp)(type **,type **)); \
+int (*sk_##type##_set_cmp_func(STACK_OF(type) *sk, \
+                              int (*cmp)(type **,type **)))(type **,type **); \
 STACK_OF(type) *sk_##type##_dup(STACK_OF(type) *sk); \
 void sk_##type##_pop_free(STACK_OF(type) *sk,void (*func)(type *)); \
 type *sk_##type##_shift(STACK_OF(type) *sk); \
@@ -107,8 +108,9 @@ void sk_##type##_delete_ptr(STACK_OF(type) *sk,type *v) \
     { sk_delete_ptr((STACK *)sk,(char *)v); } \
 int sk_##type##_insert(STACK_OF(type) *sk,type *v,int n) \
     { return sk_insert((STACK *)sk,(char *)v,n); } \
-void sk_##type##_set_cmp_func(STACK_OF(type) *sk,int (*cmp)(type **,type **)) \
-    { sk_set_cmp_func((STACK *)sk,cmp); } \
+int (*sk_##type##_set_cmp_func(STACK_OF(type) *sk, \
+                              int (*cmp)(type **,type **)))(type **,type **) \
+    { return (int (*)(type **,type **))sk_set_cmp_func((STACK *)sk,cmp); } \
 STACK_OF(type) *sk_##type##_dup(STACK_OF(type) *sk) \
     { return (STACK_OF(type) *)sk_dup((STACK *)sk); } \
 void sk_##type##_pop_free(STACK_OF(type) *sk,void (*func)(type *)) \
index 0f4fbe8e23b38a17ed39dfc5fb66f8191bb6e6d7..e93debcf6ffdf4fb158906ff0ac48f568e488df1 100644 (file)
--- a/ssl/ssl.h
+++ b/ssl/ssl.h
@@ -876,9 +876,9 @@ int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, char *file, int type);
 int    SSL_CTX_use_certificate_file(SSL_CTX *ctx, char *file, int type);
 int    SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); /* PEM type */
 STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file);
-int    SSL_add_file_cert_subjects_to_stack(STACK *stackCAs,
+int    SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,
                                            const char *file);
-int    SSL_add_dir_cert_subjects_to_stack(STACK *stackCAs,
+int    SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,
                                           const char *dir);
 #endif
 
index 91494dffb695fa03cebc293f37c8553796562cc0..30877eaef69cabd93b8b9ed80b17af7a5718f1d0 100644 (file)
@@ -373,7 +373,8 @@ err:
  * certs may have been added to \c stack.
  */
 
-int SSL_add_file_cert_subjects_to_stack(STACK *stack,const char *file)
+int SSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
+                                       const char *file)
     {
     BIO *in;
     X509 *x=NULL;
@@ -381,7 +382,7 @@ int SSL_add_file_cert_subjects_to_stack(STACK *stack,const char *file)
     int ret=1;
     int (*oldcmp)();
 
-    oldcmp=sk_set_cmp_func(stack,name_cmp);
+    oldcmp=sk_X509_NAME_set_cmp_func(stack,name_cmp);
 
     in=BIO_new(BIO_s_file_internal());
 
@@ -401,10 +402,10 @@ int SSL_add_file_cert_subjects_to_stack(STACK *stack,const char *file)
        if ((xn=X509_get_subject_name(x)) == NULL) goto err;
        xn=X509_NAME_dup(xn);
        if (xn == NULL) goto err;
-       if (sk_find(stack,(char *)xn) >= 0)
+       if (sk_X509_NAME_find(stack,xn) >= 0)
            X509_NAME_free(xn);
        else
-           sk_push(stack,(char *)xn);
+           sk_X509_NAME_push(stack,xn);
        }
 
     if (0)
@@ -417,7 +418,7 @@ err:
     if(x != NULL)
        X509_free(x);
 
-    sk_set_cmp_func(stack,oldcmp);
+    sk_X509_NAME_set_cmp_func(stack,oldcmp);
 
     return ret;
     }
@@ -435,7 +436,8 @@ err:
 
 #ifndef WIN32
 
-int SSL_add_dir_cert_subjects_to_stack(STACK *stack,const char *dir)
+int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
+                                      const char *dir)
     {
     DIR *d=opendir(dir);
     struct dirent *dstruct;