From: Rich Salz Date: Sat, 25 Jun 2016 18:51:53 +0000 (-0400) Subject: RT2964: Fix it via doc X-Git-Tag: OpenSSL_1_0_2i~128 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=58b18779ba6e6060ac357cd0803d83317ed00f8b;p=oweals%2Fopenssl.git RT2964: Fix it via doc OBJ_nid2obj() and friends should be treated as const. Reviewed-by: Dr. Stephen Henson (cherry picked from commit 82f31fe4dd0dac30229fa8684229b49d2bcef404) --- diff --git a/doc/crypto/OBJ_nid2obj.pod b/doc/crypto/OBJ_nid2obj.pod index 1e45dd40f6..7388f2002b 100644 --- a/doc/crypto/OBJ_nid2obj.pod +++ b/doc/crypto/OBJ_nid2obj.pod @@ -33,6 +33,12 @@ functions The ASN1 object utility functions process ASN1_OBJECT structures which are a representation of the ASN1 OBJECT IDENTIFIER (OID) type. +For convenience, OID's are usually represented in source code as numeric +identifiers, or B's. OpenSSL has an internal table of OID's that +are generated when the library is built, and their corresponding NID's +are available as define'd constants. For the functions below, application +code should treat all returned values -- OID's, NID's, or names -- as +constants. OBJ_nid2obj(), OBJ_nid2ln() and OBJ_nid2sn() convert the NID B to an ASN1_OBJECT structure, its long name and its short name respectively, @@ -112,6 +118,7 @@ Create a new NID and initialize an object from it: int new_nid; ASN1_OBJECT *obj; + new_nid = OBJ_create("1.2.3.4", "NewOID", "New Object Identifier"); obj = OBJ_nid2obj(new_nid); @@ -129,6 +136,9 @@ Instead B must point to a valid buffer and B should be set to a positive value. A buffer length of 80 should be more than enough to handle any OID encountered in practice. +Many of the functions here should probably be changed to return B +pointers. But the lack of consistency makes that too awkward to do. + =head1 RETURN VALUES OBJ_nid2obj() returns an B structure or B is an