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 c67f609f07ecabbfb41dd076d5a6ce3cfd94a601..2b2cbcee1737cc348c9abb1bc32f19a60482ad43 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 2740f983869785f5c05ce05bd1ad702eea01c6bf..c2fb5c0836c2dcd6f9cd06e926af4bf176666b0c 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 4f22dc3050654c856d46655b7c21671f8d0ef820..ae2fb1dabf2f40cda7941bd1a96ed7df6378d6f2 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 e1ca4efd9f489b10f57dd059558630b993966a87..581a84b8fcf357106a6ba282f7413999cb581f9f 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: