[openssl-dev] Missing const EC_KEY *EC_KEY_dup(EC_KEY *src);

Richard Levitte levitte at openssl.org
Sun Jul 24 20:05:15 UTC 2016


In message <a62628880fea43fa8505f895c22f03c2 at usma1ex-dag1mb1.msg.corp.akamai.com> on Sun, 24 Jul 2016 17:19:05 +0000, "Salz, Rich" <rsalz at akamai.com> said:

rsalz> 
rsalz> > Shouldn't this be  EC_KEY *EC_KEY_dup(const EC_KEY *src);
rsalz> 
rsalz> I think the reason it is not is because the EC_KEY has an ENGINE* and that can't be const.

The pointer to ENGINE will be const, yes, but not the ENGINE content
itself, as if it was defined like this:

    ENGINE * const engine;

What happens is that the ENGINE pointer is copied to the new
structure, and the ENGINE itself will work perfectly, both in the
source EC_KEY and the new one.

So there's no actual reason not to have const there.  It does,
however, mean that we need to add const in a few more places.  Now
many at all, actually, it took me 5 minutes.  PR coming tomorrow.

Cheers,
Richard

-- 
Richard Levitte         levitte at openssl.org
OpenSSL Project         http://www.openssl.org/~levitte/


More information about the openssl-dev mailing list