diff options
author | Ben Laurie <ben@openssl.org> | 1999-05-03 19:55:00 +0000 |
---|---|---|
committer | Ben Laurie <ben@openssl.org> | 1999-05-03 19:55:00 +0000 |
commit | 661b361b4b5c9ff2bb11bcc59356aa5dd7d1ccf1 (patch) | |
tree | 209c32e3b4ed9cf0d4604f53df53f36adcda565a | |
parent | 0b3f827cf5a44937fa6c8797d8c25337350fb599 (diff) |
Some more stack stuff.
-rw-r--r-- | crypto/stack/safestack.h | 8 | ||||
-rw-r--r-- | ssl/ssl.h | 4 | ||||
-rw-r--r-- | ssl/ssl_cert.c | 14 |
3 files changed, 15 insertions, 11 deletions
diff --git a/crypto/stack/safestack.h b/crypto/stack/safestack.h index 154468e699..48e695fb27 100644 --- a/crypto/stack/safestack.h +++ b/crypto/stack/safestack.h @@ -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 *)) \ @@ -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 diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c index 91494dffb6..30877eaef6 100644 --- a/ssl/ssl_cert.c +++ b/ssl/ssl_cert.c @@ -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; |