Skip to content

Commit

Permalink
document -2 return value
Browse files Browse the repository at this point in the history
Reviewed-by: Rich Salz <[email protected]>
  • Loading branch information
snhenson committed Jul 6, 2015
1 parent 9cca7be commit 5727582
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions doc/crypto/X509_NAME_get_index_by_NID.pod
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ and issuer names.
X509_NAME_get_index_by_NID() and X509_NAME_get_index_by_OBJ() retrieve
the next index matching B<nid> or B<obj> after B<lastpos>. B<lastpos>
should initially be set to -1. If there are no more entries -1 is returned.
If B<nid> is invalid (doesn't correspond to a valid OID) then -2 is returned.

X509_NAME_entry_count() returns the total number of entries in B<name>.

Expand Down Expand Up @@ -63,6 +64,10 @@ The list of all relevant B<NID_*> and B<OBJ_* codes> can be found in
the source code header files E<lt>openssl/obj_mac.hE<gt> and/or
E<lt>openssl/objects.hE<gt>.

Applications which could pass invalid NIDs to X509_NAME_get_index_by_NID()
should check for the return value of -2. Alternatively the NID validity
can be determined first by checking OBJ_nid2obj(nid) is not NULL.

=head1 EXAMPLES

Process all entries:
Expand Down Expand Up @@ -95,6 +100,8 @@ Process all commonName entries:

X509_NAME_get_index_by_NID() and X509_NAME_get_index_by_OBJ()
return the index of the next matching entry or -1 if not found.
X509_NAME_get_index_by_NID() can also return -2 if the supplied
NID is invalid.

X509_NAME_entry_count() returns the total number of entries.

Expand Down

0 comments on commit 5727582

Please sign in to comment.