[openssl-users] Porting to OpenSSL 1.1

Dr. Stephen Henson steve at openssl.org
Tue Oct 11 14:31:28 UTC 2016

On Tue, Oct 11, 2016, Bernhard Rosenkraenzer wrote:

> Also from Qt 5.7:
> rsa = RSA_new();
> memcpy(rsa, EVP_PKEY_get1_RSA(pkey), sizeof(RSA));
> [breaks because sizeof(RSA) is no longer known]
> for EC, there's EC_KEY_dup -- for RSA and DSA, not so much.

That wouldn't work because the RSA structure contains pointers and you just
end up copying the "top level". Well it might appear to work but you could end
up accessing freed memory or leaking when the parent structure is freed.

Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org

More information about the openssl-users mailing list