From eb90a483ad85e9dc430610a78362837ad344cac1 Mon Sep 17 00:00:00 2001 From: Ben Laurie Date: Sun, 28 Feb 1999 17:41:55 +0000 Subject: Add functions to add certs to stacks, used for CA file/path stuff in servers. --- crypto/bio/bio.h | 4 +++- crypto/stack/stack.c | 6 +++++- crypto/stack/stack.h | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'crypto') diff --git a/crypto/bio/bio.h b/crypto/bio/bio.h index 82aaf31719..9206f8d734 100644 --- a/crypto/bio/bio.h +++ b/crypto/bio/bio.h @@ -383,8 +383,10 @@ int BIO_get_ex_new_index(long argl, char *argp, int (*new_func)(), #define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL) #define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL) +/* name is cast to lose const, but might be better to route through a function + so we can do it safely */ #define BIO_read_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ - BIO_CLOSE|BIO_FP_READ,name) + BIO_CLOSE|BIO_FP_READ,(char *)name) #define BIO_write_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ BIO_CLOSE|BIO_FP_WRITE,name) #define BIO_append_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \ diff --git a/crypto/stack/stack.c b/crypto/stack/stack.c index 7b96326156..683468264a 100644 --- a/crypto/stack/stack.c +++ b/crypto/stack/stack.c @@ -82,13 +82,17 @@ char *STACK_version="Stack part of OpenSSL 0.9.2 31-Dec-1998"; #include -void sk_set_cmp_func(sk,c) +int (*sk_set_cmp_func(sk,c))() STACK *sk; int (*c)(); { + int (*old)()=sk->comp; + if (sk->comp != c) sk->sorted=0; sk->comp=c; + + return old; } STACK *sk_dup(sk) diff --git a/crypto/stack/stack.h b/crypto/stack/stack.h index 615eb6ff94..6dc52db63c 100644 --- a/crypto/stack/stack.h +++ b/crypto/stack/stack.h @@ -91,7 +91,7 @@ int sk_unshift(STACK *st,char *data); char *sk_shift(STACK *st); char *sk_pop(STACK *st); void sk_zero(STACK *st); -void sk_set_cmp_func(STACK *sk, int (*c)()); +int (*sk_set_cmp_func(STACK *sk, int (*c)()))(); STACK *sk_dup(STACK *st); #else @@ -108,7 +108,7 @@ int sk_unshift(); char *sk_shift(); char *sk_pop(); void sk_zero(); -void sk_set_cmp_func(); +int (*sk_set_cmp_func())(); STACK *sk_dup(); #endif -- cgit v1.2.3