EVP_PKEY structures could be of any number of key types. Switch to
EVP_PKEY_get1_RSA because that will check that the key type before it
tries to pull out the RSA pointer. This prevents crashes when the key
type is not actually RSA.
Bug:
10647482
Change-Id: I6848db52b04ed11331138ac00f0796574a87fa6a
OWNERSHIP_TRANSFERRED(pkcs8);
/* change key format */
- RSA* rsa = pkey.get()->pkey.rsa;
- if (rsa == NULL) {
+ Unique_RSA rsa(EVP_PKEY_get1_RSA(pkey.get()));
+ if (rsa.get() == NULL) {
logOpenSSLError("get rsa key format");
return -1;
}