diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2020-12-23 19:33:03 +0100 |
---|---|---|
committer | Dr. David von Oheimb <dev@ddvo.net> | 2021-02-04 07:28:11 +0100 |
commit | d53b437f9992f974c1623e9b9b9bdf053aefbcc3 (patch) | |
tree | 12b15a5d0a6e885be5e9118c5b4542c6234039f0 /doc | |
parent | b91a13f429570512bfee290e8ec50096b0667e45 (diff) |
Allow NULL arg to OPENSSL_sk_{dup,deep_copy} returning empty stack
This simplifies many usages
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14040)
Diffstat (limited to 'doc')
-rw-r--r-- | doc/man3/DEFINE_STACK_OF.pod | 12 | ||||
-rw-r--r-- | doc/man3/X509_new.pod | 13 |
2 files changed, 13 insertions, 12 deletions
diff --git a/doc/man3/DEFINE_STACK_OF.pod b/doc/man3/DEFINE_STACK_OF.pod index 9088dc040b..b5908fead5 100644 --- a/doc/man3/DEFINE_STACK_OF.pod +++ b/doc/man3/DEFINE_STACK_OF.pod @@ -182,12 +182,14 @@ B<sk_I<TYPE>_sort>() sorts I<sk> using the supplied comparison function. B<sk_I<TYPE>_is_sorted>() returns B<1> if I<sk> is sorted and B<0> otherwise. -B<sk_I<TYPE>_dup>() returns a copy of I<sk>. Note the pointers in the copy -are identical to the original. +B<sk_I<TYPE>_dup>() returns a shallow copy of I<sk> +or an empty stack if the passed stack is NULL. +Note the pointers in the copy are identical to the original. B<sk_I<TYPE>_deep_copy>() returns a new stack where each element has been -copied. Copying is performed by the supplied copyfunc() and freeing by -freefunc(). The function freefunc() is only called if an error occurs. +copied or an empty stack if the passed stack is NULL. +Copying is performed by the supplied copyfunc() and freeing by freefunc(). +The function freefunc() is only called if an error occurs. =head1 NOTES @@ -258,7 +260,7 @@ B<sk_I<TYPE>_is_sorted>() returns B<1> if the stack is sorted and B<0> if it is not. B<sk_I<TYPE>_dup>() and B<sk_I<TYPE>_deep_copy>() return a pointer to the copy -of the stack. +of the stack or NULL on error. =head1 HISTORY diff --git a/doc/man3/X509_new.pod b/doc/man3/X509_new.pod index b40715bddf..ab310bff57 100644 --- a/doc/man3/X509_new.pod +++ b/doc/man3/X509_new.pod @@ -2,9 +2,9 @@ =head1 NAME -X509_chain_up_ref, X509_new, X509_new_ex, -X509_free, X509_up_ref - X509 certificate ASN1 allocation functions +X509_free, X509_up_ref, +X509_chain_up_ref - X509 certificate ASN1 allocation functions =head1 SYNOPSIS @@ -37,7 +37,7 @@ 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_chain_up_ref() increases the reference count of all certificates in -chain B<x> and returns a copy of the stack. +chain B<x> and returns a copy of the stack, or an empty stack if B<a> is NULL. =head1 NOTES @@ -46,20 +46,19 @@ 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(), +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 +If the allocation fails, X509_new() returns NULL and sets an error code that can be obtained by L<ERR_get_error(3)>. Otherwise it returns a pointer to the newly allocated structure. X509_up_ref() returns 1 for success and 0 for failure. -X509_chain_up_ref() returns a copy of the stack or B<NULL> if an error -occurred. +X509_chain_up_ref() returns a copy of the stack or NULL if an error occurred. =head1 SEE ALSO |