When I have seen base64 decode examples such as below the BIO_read
function is often called with size that is based of the original
message. Is this the only way to decode a message with the known
length of the original message? This is difficult to find and the
situation is compounded when the original message has been encrypted.
Is there an alternate paramter value that can be passed here?

FYI the decbuf is 1024 bytes.

void decode( unsigned char * encbuf, unsigned char * decbuf ) {
BIO *b64, *bio ;
long i ;

b64 = BIO_new(BIO_f_base64() ) ;
bio = BIO_new(BIO_s_mem()) ;

i=BIO_write(bio, encbuf, strlen(encbuf)) ;

bio = BIO_push(b64, bio) ;
//i = BIO_ctrl_pending(bio);
i = BIO_read(bio, decbuf, sizeof-original-unencryptedmessage ) ;
}