static int test_X509_PUBKEY_inplace(void) { int ret = 0; X509_PUBKEY *xp = NULL; const unsigned char *p = kExampleECPubKeyDER; size_t input_len = sizeof(kExampleECPubKeyDER); if (!TEST_ptr(xp = d2i_X509_PUBKEY(NULL, &p, input_len))) goto done; if (!TEST_ptr(X509_PUBKEY_get0(xp))) goto done; p = kExampleBadECPubKeyDER; input_len = sizeof(kExampleBadECPubKeyDER); if (!TEST_ptr(xp = d2i_X509_PUBKEY(&xp, &p, input_len))) goto done; if (!TEST_true(X509_PUBKEY_get0(xp) == NULL)) goto done; ret = 1; done: X509_PUBKEY_free(xp); return ret; }
EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) { EVP_PKEY *ret = X509_PUBKEY_get0(key); if (ret != NULL) EVP_PKEY_up_ref(ret); return ret; }
EVP_PKEY * X509_PUBKEY_get(X509_PUBKEY *key) { EVP_PKEY *pkey; if ((pkey = X509_PUBKEY_get0(key)) == NULL) return (NULL); CRYPTO_add(&pkey->references, 1, CRYPTO_LOCK_EVP_PKEY); return pkey; }
EVP_PKEY *X509_REQ_get0_pubkey(X509_REQ *req) { if (req == NULL) return NULL; return (X509_PUBKEY_get0(req->req_info.pubkey)); }