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

David Benjamin via RT rt at openssl.org
Sun Mar 20 22:20:01 UTC 2016

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.


Ticket here: http://rt.openssl.org/Ticket/Display.html?id=4460
Please log in as guest with password guest if prompted

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-BIO_METHODs-should-be-const.patch
Type: application/octet-stream
Size: 28985 bytes
Desc: not available
URL: <http://mta.openssl.org/pipermail/openssl-dev/attachments/20160320/93218350/attachment-0001.obj>

More information about the openssl-dev mailing list