@@ -199,17 +199,15 @@ OPENSSL_EXPORT X509_NAME *X509_get_subject_name(const X509 *x509);
199
199
OPENSSL_EXPORT X509_PUBKEY * X509_get_X509_PUBKEY (const X509 * x509 );
200
200
201
201
// X509_get0_pubkey returns |x509|'s public key as an |EVP_PKEY|, or NULL if the
202
- // public key was unsupported or could not be decoded. It is similar to
203
- // |X509_get_pubkey|, but it does not increment the reference count of the
204
- // returned |EVP_PKEY|. This means that the caller must not free the result
205
- // after use.
206
- OPENSSL_EXPORT EVP_PKEY * X509_get0_pubkey (const X509 * x );
207
-
208
- // X509_get_pubkey returns |x509|'s public key as an |EVP_PKEY|, or NULL if the
209
- // public key was unsupported or could not be decoded. This function returns a
210
- // reference to the |EVP_PKEY|. The caller must release the result with
211
- // |EVP_PKEY_free| when done.
212
- OPENSSL_EXPORT EVP_PKEY * X509_get_pubkey (X509 * x509 );
202
+ // public key was unsupported or could not be decoded. The |EVP_PKEY| is cached
203
+ // in |x509|, so callers must not mutate the result.
204
+ OPENSSL_EXPORT EVP_PKEY * X509_get0_pubkey (const X509 * x509 );
205
+
206
+ // X509_get_pubkey behaves like |X509_get0_pubkey| but increments the reference
207
+ // count on the |EVP_PKEY|. The caller must release the result with
208
+ // |EVP_PKEY_free| when done. The |EVP_PKEY| is cached in |x509|, so callers
209
+ // must not mutate the result.
210
+ OPENSSL_EXPORT EVP_PKEY * X509_get_pubkey (const X509 * x509 );
213
211
214
212
// X509_get0_pubkey_bitstr returns the BIT STRING portion of |x509|'s public
215
213
// key. Note this does not contain the AlgorithmIdentifier portion.
@@ -1152,15 +1150,16 @@ OPENSSL_EXPORT long X509_REQ_get_version(const X509_REQ *req);
1152
1150
// not const-correct for legacy reasons.
1153
1151
OPENSSL_EXPORT X509_NAME * X509_REQ_get_subject_name (const X509_REQ * req );
1154
1152
1155
- // X509_REQ_get_pubkey returns |req|'s public key as an |EVP_PKEY|, or NULL if
1156
- // the public key was unsupported or could not be decoded. This function returns
1157
- // a reference to the |EVP_PKEY|. The caller must release the result with
1158
- // |EVP_PKEY_free| when done.
1159
- OPENSSL_EXPORT EVP_PKEY * X509_REQ_get_pubkey (X509_REQ * req );
1153
+ // X509_REQ_get0_pubkey returns |req|'s public key as an |EVP_PKEY|, or NULL if
1154
+ // the public key was unsupported or could not be decoded. The |EVP_PKEY| is
1155
+ // cached in |req|, so callers must not mutate the result.
1156
+ OPENSSL_EXPORT EVP_PKEY * X509_REQ_get0_pubkey (const X509_REQ * req );
1160
1157
1161
- // X509_REQ_get0_pubkey is like |X509_REQ_get_pubkey|, but directly returns the
1162
- // reference to |req|. The caller must not free the result after use.
1163
- OPENSSL_EXPORT EVP_PKEY * X509_REQ_get0_pubkey (X509_REQ * req );
1158
+ // X509_REQ_get_pubkey behaves like |X509_REQ_get0_pubkey| but increments the
1159
+ // reference count on the |EVP_PKEY|. The caller must release the result with
1160
+ // |EVP_PKEY_free| when done. The |EVP_PKEY| is cached in |req|, so callers must
1161
+ // not mutate the result.
1162
+ OPENSSL_EXPORT EVP_PKEY * X509_REQ_get_pubkey (const X509_REQ * req );
1164
1163
1165
1164
// X509_REQ_check_private_key returns one if |req|'s public key matches |pkey|
1166
1165
// and zero otherwise.
@@ -1643,11 +1642,16 @@ OPENSSL_EXPORT int i2d_X509_PUBKEY(const X509_PUBKEY *key, uint8_t **outp);
1643
1642
// object, and returns one. Otherwise, it returns zero.
1644
1643
OPENSSL_EXPORT int X509_PUBKEY_set (X509_PUBKEY * * x , EVP_PKEY * pkey );
1645
1644
1646
- // X509_PUBKEY_get decodes the public key in |key| and returns an |EVP_PKEY| on
1647
- // success, or NULL on error or unrecognized algorithm. The caller must release
1648
- // the result with |EVP_PKEY_free| when done. The |EVP_PKEY| is cached in |key|,
1649
- // so callers must not mutate the result.
1650
- OPENSSL_EXPORT EVP_PKEY * X509_PUBKEY_get (X509_PUBKEY * key );
1645
+ // X509_PUBKEY_get0 returns |key| as an |EVP_PKEY|, or NULL if |key| either
1646
+ // could not be parsed or is an unrecognized algorithm. The |EVP_PKEY| is cached
1647
+ // in |key|, so callers must not mutate the result.
1648
+ OPENSSL_EXPORT EVP_PKEY * X509_PUBKEY_get0 (const X509_PUBKEY * key );
1649
+
1650
+ // X509_PUBKEY_get behaves like |X509_PUBKEY_get0| but increments the reference
1651
+ // count on the |EVP_PKEY|. The caller must release the result with
1652
+ // |EVP_PKEY_free| when done. The |EVP_PKEY| is cached in |key|, so callers must
1653
+ // not mutate the result.
1654
+ OPENSSL_EXPORT EVP_PKEY * X509_PUBKEY_get (const X509_PUBKEY * key );
1651
1655
1652
1656
// X509_PUBKEY_set0_param sets |pub| to a key with AlgorithmIdentifier
1653
1657
// determined by |obj|, |param_type|, and |param_value|, and an encoded
@@ -2295,7 +2299,7 @@ OPENSSL_EXPORT char *NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *spki);
2295
2299
// NETSCAPE_SPKI_get_pubkey decodes and returns the public key in |spki| as an
2296
2300
// |EVP_PKEY|, or NULL on error. The caller takes ownership of the resulting
2297
2301
// pointer and must call |EVP_PKEY_free| when done.
2298
- OPENSSL_EXPORT EVP_PKEY * NETSCAPE_SPKI_get_pubkey (NETSCAPE_SPKI * spki );
2302
+ OPENSSL_EXPORT EVP_PKEY * NETSCAPE_SPKI_get_pubkey (const NETSCAPE_SPKI * spki );
2299
2303
2300
2304
// NETSCAPE_SPKI_set_pubkey sets |spki|'s public key to |pkey|. It returns one
2301
2305
// on success or zero on error. This function does not take ownership of |pkey|,
0 commit comments