The main() return value is a program's exit code.
[oweals/openssl.git] / crypto / pkcs7 / bio_ber.c
index e4b9db03cf7368066734fb8d8b45345661f96229..4803966fd2b1eb96cb0a0f2fdf445462298966dc 100644 (file)
@@ -62,7 +62,6 @@
 #include <openssl/buffer.h>
 #include <openssl/evp.h>
 
-#ifndef NOPROTO
 static int ber_write(BIO *h,char *buf,int num);
 static int ber_read(BIO *h,char *buf,int size);
 /*static int ber_puts(BIO *h,char *str); */
@@ -70,16 +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);
-#else
-static int ber_write();
-static int ber_read();
-/*static int ber_puts(); */
-/*static int ber_gets(); */
-static long ber_ctrl();
-static int ber_new();
-static int ber_free();
-#endif
-
+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. */
@@ -103,7 +93,7 @@ typedef struct bio_ber_struct
        /* most of the following are used when doing non-blocking IO */
        /* reading */
        long num_left;  /* number of bytes still to read/write in block */
-       int depth;      /* used with idefinite encoding. */
+       int depth;      /* used with indefinite encoding. */
        int finished;   /* No more read data */
 
        /* writting */ 
@@ -126,6 +116,7 @@ static BIO_METHOD methods_ber=
        ber_ctrl,
        ber_new,
        ber_free,
+       ber_callback_ctrl,
        };
 
 BIO_METHOD *BIO_f_ber(void)
@@ -420,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;