Thanks Ray. That helps. BTW, I'm getting close to completing so I'll post my code for all to see maybe.
Do you think it's ok to set my type to just BIO_TYPE_SOURCE_SINK, or do I need to set it to (BIO_TYPE_SOURCE_SINK | some_magic_number_that_hopefully_noone_else_is_using)? Phillip On Mon, Apr 12, 2010 at 1:58 PM, Ray Satiro <[email protected]> wrote: > --- On *Mon, 4/12/10, Phillip Hellewell <[email protected]>* wrote: > > > So the goal is to implement a BIO interface that can "wrap" a > file_read_random or file_read_write object. I don't think it will be too > tough, but after reading your email I'm sure there will be a couple tricky > parts. Thanks for the hint about using the bio->ptr. I'm pretty sure that > is where I will store a pointer to my stream, but I hope OpenSSL doesn't go > mucking with it... > > Hi again, > > I used BIO_TYPE_SOURCE_SINK and ptr was free to use. In general there are > several members available (ptr, num, flags, etc.) but which are unused > absolutely depends on your BIO type. For example ptr is *not* free to use if > you're going to knock off a memory BIO (see bss_mem.c). > > I read Howard's reply just now regarding ptr and I think it would be more > correct to say it's type dependent. For example if you implement using > BIO_TYPE_MEM then ptr *is* used internally by OpenSSL. OpenSSL internal > functions in some places check the BIO type and rely on it > if (indata && (BIO_method_type(indata) == BIO_TYPE_MEM)) > ^^^ from pkcs7_verify() > So at that point you'd better have ptr pointing to a valid memory location > that holds the data you want read. In other words BIO_TYPE_MEM makes use of > ptr so you can't use it for your own purposes. > > And of course all this could change in future OpenSSL releases. I would > stick with the generic BIO_TYPE_SOURCE_SINK and review bss_fd.c for > inspiration. > > -Jay > > >
