Add X509_REQ_get0_pubkey method
authorFdaSilvaYY <fdasilvayy@gmail.com>
Sun, 3 Apr 2016 21:24:51 +0000 (23:24 +0200)
committerFdaSilvaYY <fdasilvayy@gmail.com>
Mon, 4 Apr 2016 18:38:11 +0000 (20:38 +0200)
Reviewed-by: Stephen Henson <steve@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/x509/x509_req.c
doc/crypto/X509_get_pubkey.pod
include/openssl/x509.h
util/libcrypto.num

index c67f609..2b2cbce 100644 (file)
@@ -115,6 +115,13 @@ EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req)
     return (X509_PUBKEY_get(req->req_info.pubkey));
 }
 
+EVP_PKEY *X509_REQ_get0_pubkey(X509_REQ *req)
+{
+    if (req == NULL)
+        return NULL;
+    return (X509_PUBKEY_get0(req->req_info.pubkey));
+}
+
 X509_PUBKEY *X509_REQ_get_X509_PUBKEY(X509_REQ *req)
 {
     return req->req_info.pubkey;
index 2740f98..c2fb5c0 100644 (file)
@@ -3,8 +3,9 @@
 =head1 NAME
 
 X509_get_pubkey, X509_get0_pubkey, X509_set_pubkey, X509_get_X509_PUBKEY,
-X509_REQ_get_pubkey, X509_REQ_set_pubkey, X509_REQ_get_X509_PUBKEY - get or
-set certificate or certificate request public key.
+X509_REQ_get_pubkey, X509_REQ_get0_pubkey, X509_REQ_set_pubkey, 
+X509_REQ_get_X509_PUBKEY - get or set certificate or certificate request 
+public key.
 
 =head1 SYNOPSIS
 
@@ -16,6 +17,7 @@ set certificate or certificate request public key.
  X509_PUBKEY *X509_get_X509_PUBKEY(X509 *x);
 
  EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req);
+ EVP_PKEY *X509_REQ_get0_pubkey(X509_REQ *req);
  int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey);
  X509_PUBKEY *X509_REQ_get_X509_PUBKEY(X509_REQ *x);
 
@@ -35,8 +37,8 @@ must not be freed up after use.
 X509_set_pubkey() attempts to set the public key for certificate B<x> to
 B<pkey>. The key B<pkey> should be freed up after use.
 
-X509_REQ_get_pubkey(), X509_REQ_set_pubkey() and X509_REQ_get_X509_PUBKEY()
-are similar but operate on certificate request B<req>.
+X509_REQ_get_pubkey(), X509_REQ_get0_pubkey(), X509_REQ_set_pubkey() and 
+X509_REQ_get_X509_PUBKEY() are similar but operate on certificate request B<req>.
 
 =head1 NOTES
 
@@ -51,7 +53,7 @@ X509_get_pubkey(), X509_get0_pubkey(), X509_get_X509_PUBKEY(),
 X509_REQ_get_pubkey() and X509_REQ_get_X509_PUBKEY() return a public key or
 B<NULL> if an error occurred.
 
-X509_set_pubkey() and X509_REQ_set_pubkey() rerturn 1 for success and 0
+X509_set_pubkey() and X509_REQ_set_pubkey() return 1 for success and 0
 for failure.
 
 =head1 SEE ALSO
index 4f22dc3..ae2fb1d 100644 (file)
@@ -696,6 +696,7 @@ int X509_REQ_get_signature_nid(const X509_REQ *req);
 int i2d_re_X509_REQ_tbs(X509_REQ *req, unsigned char **pp);
 int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey);
 EVP_PKEY *X509_REQ_get_pubkey(X509_REQ *req);
+EVP_PKEY *X509_REQ_get0_pubkey(X509_REQ *req);
 X509_PUBKEY *X509_REQ_get_X509_PUBKEY(X509_REQ *req);
 int X509_REQ_extension_nid(int nid);
 int *X509_REQ_get_extension_nids(void);
index e1ca4ef..581a84b 100644 (file)
@@ -4124,3 +4124,4 @@ DSA_meth_get_sign_setup                 3989      1_1_0   EXIST::FUNCTION:DSA
 DSA_get0_engine                         3990   1_1_0   EXIST::FUNCTION:DSA
 X509_VERIFY_PARAM_set_auth_level        3991   1_1_0   EXIST::FUNCTION:
 X509_VERIFY_PARAM_get_auth_level        3992   1_1_0   EXIST::FUNCTION:
+X509_REQ_get0_pubkey                    3993   1_1_0   EXIST::FUNCTION: