[openssl-dev] Under-utilization of "const" in prototyping?

Philip Prindeville philipp_subx at redfish-solutions.com
Thu Dec 4 19:34:11 EST 2014


On 12/04/2014 05:30 PM, Kurt Roeckx wrote:
> On Thu, Dec 04, 2014 at 05:22:02PM -0700, Philip Prindeville wrote:
>> Hi all,
>>
>> I was looking at some functions like ASN1_digest() or macros like
>> TYPEDEF_I2D_OF() and wondering why more of the parameters that are
>> unmodified aren't marked as "const", for instance "data" in ASN1_digest()
>> and "type" in TYPEDEF_I2D_OF().
>>
>> I started to think about doing a scrub of this, but it likely couldn't be
>> done incrementally: there's too much interdependence in some of the code.
>>
>> It would best be done as "throwing a switch".
>>
>> How likely is this?
>>
>> In most cases, changing a parameter to "const" in the API shouldn't affect
>> user code, so this wouldn't break existing source using OpenSSL.
>>
>> Looks like all of the code could be changed in a couple of man-days.
>>
>> Is it worthwhile doing?
> I would like to see such changes.  We've been slowly adding more
> const, but it could always use more of them.  So feel free to send
> a patch.
>
>
> Kurt
>

I'll make a deal: if you can suggest a way to carve up the task so that 
it *can* be done incrementally, I'll see what I can do.

For kicks and giggles, I tried to change crypto/asn1/asn1.h and the 
functions it contains, and it quickly rippled out into other modules 
(like RSA, etc).

-Philip



More information about the openssl-dev mailing list