Add documenation for X509_chain_up_ref()
authorDr. Stephen Henson <steve@openssl.org>
Sat, 6 Feb 2016 16:42:22 +0000 (16:42 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sat, 6 Feb 2016 18:18:28 +0000 (18:18 +0000)
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
doc/crypto/X509_new.pod

index d6c365fc4999a7a6c4016b30c2acab714e8a030b..8db6cdb245e4b3a58d68852b323ea6b505020dc5 100644 (file)
@@ -11,6 +11,7 @@ X509_new, X509_free, X509_up_ref - X509 certificate ASN1 allocation functions
  X509 *X509_new(void);
  void X509_free(X509 *a);
  void X509_up_ref(X509 *a);
  X509 *X509_new(void);
  void X509_free(X509 *a);
  void X509_up_ref(X509 *a);
+ STACK_OF(X509) *X509_chain_up_ref(STACK_OF(X509) *x);
 
 =head1 DESCRIPTION
 
 
 =head1 DESCRIPTION
 
@@ -25,12 +26,20 @@ frees it up if the reference count is zero. If B<a> is NULL nothing is done.
 
 X509_up_ref() increments the reference count of B<a>.
 
 
 X509_up_ref() increments the reference count of B<a>.
 
+X509_chain_up_ref() increases the reference count of all certificates in
+chain B<x> and returns a copy of the stack.
+
 =head1 NOTES
 
 The function X509_up_ref() if useful if a certificate structure is being
 used by several different operations each of which will free it up after
 use: this avoids the need to duplicate the entire certificate structure.
 
 =head1 NOTES
 
 The function X509_up_ref() if useful if a certificate structure is being
 used by several different operations each of which will free it up after
 use: this avoids the need to duplicate the entire certificate structure.
 
+The function X509_chain_up_ref() doesn't just up the reference count of
+each certificate it also returns a copy of the stack, using sk_X509_dup(),
+but it serves a similar purpose: the returned chain persists after the
+original has been freed.
+
 =head1 RETURN VALUES
 
 If the allocation fails, X509_new() returns B<NULL> and sets an error
 =head1 RETURN VALUES
 
 If the allocation fails, X509_new() returns B<NULL> and sets an error
@@ -39,6 +48,9 @@ Otherwise it returns a pointer to the newly allocated structure.
 
 X509_free() and X509_up_ref() do not return a value.
 
 
 X509_free() and X509_up_ref() do not return a value.
 
+X509_chain_up_ref() returns a copy of the stack or B<NULL> if an error
+occurred.
+
 =head1 SEE ALSO
 
 L<d2i_X509(3)>,
 =head1 SEE ALSO
 
 L<d2i_X509(3)>,