diff options
author | Richard Levitte <levitte@openssl.org> | 2000-02-20 23:43:02 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2000-02-20 23:43:02 +0000 |
commit | d3442bc780473f0cd4f378bc31130d4579da640b (patch) | |
tree | a9e0e2f1ba5080829e22783c739a9cacaa95ebd5 /crypto/pkcs7/bio_ber.c | |
parent | dab6f09573742df94c4767663565aca3863f8173 (diff) | |
download | openssl-d3442bc780473f0cd4f378bc31130d4579da640b.tar.gz |
Move the registration of callback functions to special functions
designed for that. This removes the potential error to mix data and
function pointers.
Please note that I'm a little unsure how incorrect calls to the old
ctrl functions should be handled, in som cases. I currently return 0
and that's it, but it may be more correct to generate a genuine error
in those cases.
Diffstat (limited to 'crypto/pkcs7/bio_ber.c')
-rw-r--r-- | crypto/pkcs7/bio_ber.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/crypto/pkcs7/bio_ber.c b/crypto/pkcs7/bio_ber.c index 25831e577e..4803966fd2 100644 --- a/crypto/pkcs7/bio_ber.c +++ b/crypto/pkcs7/bio_ber.c @@ -69,6 +69,7 @@ static int ber_read(BIO *h,char *buf,int size); static long ber_ctrl(BIO *h,int cmd,long arg1,char *arg2); static int ber_new(BIO *h); static int ber_free(BIO *data); +static long ber_callback_ctrl(BIO *h,int cmd,void *(*fp)()); #define BER_BUF_SIZE (32) /* This is used to hold the state of the BER objects being read. */ @@ -115,6 +116,7 @@ static BIO_METHOD methods_ber= ber_ctrl, ber_new, ber_free, + ber_callback_ctrl, }; BIO_METHOD *BIO_f_ber(void) @@ -409,6 +411,20 @@ again: return(ret); } +static long ber_callback_ctrl(BIO *b, int cmd, void *(*fp)()) + { + long ret=1; + + if (b->next_bio == NULL) return(0); + switch (cmd) + { + default: + ret=BIO_callback_ctrl(b->next_bio,cmd,fp); + break; + } + return(ret); + } + /* void BIO_set_cipher_ctx(b,c) BIO *b; |