[openssl-dev] [openssl.org #4460] [PATCH] BIO_METHODs should be const

Jeffrey Walton noloader at gmail.com
Mon Mar 21 00:50:10 UTC 2016


On Sun, Mar 20, 2016 at 6:20 PM, David Benjamin via RT <rt at openssl.org> wrote:
> Patch attached. This is a mechanical change. BIO_new takes a non-const
> BIO_METHOD and the various BIO_METHODs defined in the library are also
> non-const, so they don't get placed in .rodata.
>
> The change to BIO_new and the BIO struct should be source-compatible.
> Fixing the in-library BIO_METHODs is not. This will work as-is:
>     BIO *bio = BIO_new(BIO_s_mem());
> This will not:
>     BIO_METHOD *method = BIO_s_mem();
>     BIO *bio = BIO_new(method);
> (method would have to be const.)
>
> If this is a concern, I can split out just the BIO_new change (so that
> external BIO_METHODs may be const without requiring casts). It would be
> nice to put the in-library BIOs in .rodata too, but then functions like
> BIO_s_mem would need to cast away const-ness internally. Happy to switch it
> to whichever is preferable.

+1 for getting const-ness in order.

The const-ness issues have been around a long time. They should be
sorted out before the 1.1.0 release. The major version bump is
precisely the time when it should occur.

Jeff


More information about the openssl-dev mailing list