diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/doc/OBJ_nid2obj.pod | 147 | ||||
| -rw-r--r-- | src/lib/libcrypto/doc/d2i_ASN1_OBJECT.pod | 25 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/Makefile | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/OBJ_nid2obj.3 | 267 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/d2i_ASN1_OBJECT.3 | 29 |
5 files changed, 299 insertions, 175 deletions
diff --git a/src/lib/libcrypto/doc/OBJ_nid2obj.pod b/src/lib/libcrypto/doc/OBJ_nid2obj.pod deleted file mode 100644 index 95949ac091..0000000000 --- a/src/lib/libcrypto/doc/OBJ_nid2obj.pod +++ /dev/null | |||
| @@ -1,147 +0,0 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | OBJ_nid2obj, OBJ_nid2ln, OBJ_nid2sn, OBJ_obj2nid, OBJ_txt2nid, OBJ_ln2nid, | ||
| 6 | OBJ_sn2nid, OBJ_cmp, OBJ_dup, OBJ_txt2obj, OBJ_obj2txt, OBJ_create, OBJ_cleanup | ||
| 7 | - ASN1 object utility functions | ||
| 8 | |||
| 9 | =head1 SYNOPSIS | ||
| 10 | |||
| 11 | #include <openssl/objects.h> | ||
| 12 | |||
| 13 | ASN1_OBJECT * OBJ_nid2obj(int n); | ||
| 14 | const char * OBJ_nid2ln(int n); | ||
| 15 | const char * OBJ_nid2sn(int n); | ||
| 16 | |||
| 17 | int OBJ_obj2nid(const ASN1_OBJECT *o); | ||
| 18 | int OBJ_ln2nid(const char *ln); | ||
| 19 | int OBJ_sn2nid(const char *sn); | ||
| 20 | |||
| 21 | int OBJ_txt2nid(const char *s); | ||
| 22 | |||
| 23 | ASN1_OBJECT * OBJ_txt2obj(const char *s, int no_name); | ||
| 24 | int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name); | ||
| 25 | |||
| 26 | int OBJ_cmp(const ASN1_OBJECT *a,const ASN1_OBJECT *b); | ||
| 27 | ASN1_OBJECT * OBJ_dup(const ASN1_OBJECT *o); | ||
| 28 | |||
| 29 | int OBJ_create(const char *oid,const char *sn,const char *ln); | ||
| 30 | void OBJ_cleanup(void); | ||
| 31 | |||
| 32 | =head1 DESCRIPTION | ||
| 33 | |||
| 34 | The ASN1 object utility functions process ASN1_OBJECT structures which are | ||
| 35 | a representation of the ASN1 OBJECT IDENTIFIER (OID) type. | ||
| 36 | |||
| 37 | OBJ_nid2obj(), OBJ_nid2ln() and OBJ_nid2sn() convert the NID B<n> to | ||
| 38 | an ASN1_OBJECT structure, its long name and its short name respectively, | ||
| 39 | or B<NULL> is an error occurred. | ||
| 40 | |||
| 41 | OBJ_obj2nid(), OBJ_ln2nid(), OBJ_sn2nid() return the corresponding NID | ||
| 42 | for the object B<o>, the long name <ln> or the short name <sn> respectively | ||
| 43 | or NID_undef if an error occurred. | ||
| 44 | |||
| 45 | OBJ_txt2nid() returns NID corresponding to text string <s>. B<s> can be | ||
| 46 | a long name, a short name or the numerical representation of an object. | ||
| 47 | |||
| 48 | OBJ_txt2obj() converts the text string B<s> into an ASN1_OBJECT structure. | ||
| 49 | If B<no_name> is 0 then long names and short names will be interpreted | ||
| 50 | as well as numerical forms. If B<no_name> is 1 only the numerical form | ||
| 51 | is acceptable. | ||
| 52 | |||
| 53 | OBJ_obj2txt() converts the B<ASN1_OBJECT> B<a> into a textual representation. | ||
| 54 | The representation is written as a null terminated string to B<buf> | ||
| 55 | at most B<buf_len> bytes are written, truncating the result if necessary. | ||
| 56 | The total amount of space required is returned. If B<no_name> is 0 then | ||
| 57 | if the object has a long or short name then that will be used, otherwise | ||
| 58 | the numerical form will be used. If B<no_name> is 1 then the numerical | ||
| 59 | form will always be used. | ||
| 60 | |||
| 61 | OBJ_cmp() compares B<a> to B<b>. If the two are identical 0 is returned. | ||
| 62 | |||
| 63 | OBJ_dup() returns a copy of B<o>. | ||
| 64 | |||
| 65 | OBJ_create() adds a new object to the internal table. B<oid> is the | ||
| 66 | numerical form of the object, B<sn> the short name and B<ln> the | ||
| 67 | long name. A new NID is returned for the created object. | ||
| 68 | |||
| 69 | OBJ_cleanup() cleans up OpenSSLs internal object table: this should | ||
| 70 | be called before an application exits if any new objects were added | ||
| 71 | using OBJ_create(). | ||
| 72 | |||
| 73 | =head1 NOTES | ||
| 74 | |||
| 75 | Objects in OpenSSL can have a short name, a long name and a numerical | ||
| 76 | identifier (NID) associated with them. A standard set of objects is | ||
| 77 | represented in an internal table. The appropriate values are defined | ||
| 78 | in the header file B<objects.h>. | ||
| 79 | |||
| 80 | For example the OID for commonName has the following definitions: | ||
| 81 | |||
| 82 | #define SN_commonName "CN" | ||
| 83 | #define LN_commonName "commonName" | ||
| 84 | #define NID_commonName 13 | ||
| 85 | |||
| 86 | New objects can be added by calling OBJ_create(). | ||
| 87 | |||
| 88 | Table objects have certain advantages over other objects: for example | ||
| 89 | their NIDs can be used in a C language switch statement. They are | ||
| 90 | also static constant structures which are shared: that is there | ||
| 91 | is only a single constant structure for each table object. | ||
| 92 | |||
| 93 | Objects which are not in the table have the NID value NID_undef. | ||
| 94 | |||
| 95 | Objects do not need to be in the internal tables to be processed, | ||
| 96 | the functions OBJ_txt2obj() and OBJ_obj2txt() can process the numerical | ||
| 97 | form of an OID. | ||
| 98 | |||
| 99 | =head1 EXAMPLES | ||
| 100 | |||
| 101 | Create an object for B<commonName>: | ||
| 102 | |||
| 103 | ASN1_OBJECT *o; | ||
| 104 | o = OBJ_nid2obj(NID_commonName); | ||
| 105 | |||
| 106 | Check if an object is B<commonName> | ||
| 107 | |||
| 108 | if (OBJ_obj2nid(obj) == NID_commonName) | ||
| 109 | /* Do something */ | ||
| 110 | |||
| 111 | Create a new NID and initialize an object from it: | ||
| 112 | |||
| 113 | int new_nid; | ||
| 114 | ASN1_OBJECT *obj; | ||
| 115 | new_nid = OBJ_create("1.2.3.4", "NewOID", "New Object Identifier"); | ||
| 116 | |||
| 117 | obj = OBJ_nid2obj(new_nid); | ||
| 118 | |||
| 119 | Create a new object directly: | ||
| 120 | |||
| 121 | obj = OBJ_txt2obj("1.2.3.4", 1); | ||
| 122 | |||
| 123 | =head1 BUGS | ||
| 124 | |||
| 125 | OBJ_obj2txt() is awkward and messy to use: it doesn't follow the | ||
| 126 | convention of other OpenSSL functions where the buffer can be set | ||
| 127 | to B<NULL> to determine the amount of data that should be written. | ||
| 128 | Instead B<buf> must point to a valid buffer and B<buf_len> should | ||
| 129 | be set to a positive value. A buffer length of 80 should be more | ||
| 130 | than enough to handle any OID encountered in practice. | ||
| 131 | |||
| 132 | =head1 RETURN VALUES | ||
| 133 | |||
| 134 | OBJ_nid2obj() returns an B<ASN1_OBJECT> structure or B<NULL> is an | ||
| 135 | error occurred. | ||
| 136 | |||
| 137 | OBJ_nid2ln() and OBJ_nid2sn() returns a valid string or B<NULL> | ||
| 138 | on error. | ||
| 139 | |||
| 140 | OBJ_obj2nid(), OBJ_ln2nid(), OBJ_sn2nid() and OBJ_txt2nid() return | ||
| 141 | a NID or B<NID_undef> on error. | ||
| 142 | |||
| 143 | =head1 SEE ALSO | ||
| 144 | |||
| 145 | L<ERR_get_error(3)|ERR_get_error(3)> | ||
| 146 | |||
| 147 | =cut | ||
diff --git a/src/lib/libcrypto/doc/d2i_ASN1_OBJECT.pod b/src/lib/libcrypto/doc/d2i_ASN1_OBJECT.pod deleted file mode 100644 index b2712dc55c..0000000000 --- a/src/lib/libcrypto/doc/d2i_ASN1_OBJECT.pod +++ /dev/null | |||
| @@ -1,25 +0,0 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | d2i_ASN1_OBJECT, i2d_ASN1_OBJECT - ASN1 OBJECT IDENTIFIER functions | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/objects.h> | ||
| 10 | |||
| 11 | ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, unsigned char **pp, long length); | ||
| 12 | int i2d_ASN1_OBJECT(ASN1_OBJECT *a, unsigned char **pp); | ||
| 13 | |||
| 14 | =head1 DESCRIPTION | ||
| 15 | |||
| 16 | These functions decode and encode an ASN1 OBJECT IDENTIFIER. | ||
| 17 | |||
| 18 | Othewise these behave in a similar way to d2i_X509() and i2d_X509() | ||
| 19 | described in the L<d2i_X509(3)|d2i_X509(3)> manual page. | ||
| 20 | |||
| 21 | =head1 SEE ALSO | ||
| 22 | |||
| 23 | L<d2i_X509(3)|d2i_X509(3)> | ||
| 24 | |||
| 25 | =cut | ||
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index 1989a25092..802b34399f 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.39 2016/11/03 10:02:57 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.40 2016/11/03 10:24:26 schwarze Exp $ |
| 2 | 2 | ||
| 3 | .include <bsd.own.mk> # for NOMAN | 3 | .include <bsd.own.mk> # for NOMAN |
| 4 | 4 | ||
| @@ -117,16 +117,17 @@ MAN= \ | |||
| 117 | EVP_VerifyInit.3 \ | 117 | EVP_VerifyInit.3 \ |
| 118 | HMAC.3 \ | 118 | HMAC.3 \ |
| 119 | MD5.3 \ | 119 | MD5.3 \ |
| 120 | OBJ_nid2obj.3 \ | ||
| 120 | UI_new.3 \ | 121 | UI_new.3 \ |
| 121 | bn_dump.3 \ | 122 | bn_dump.3 \ |
| 122 | crypto.3 \ | 123 | crypto.3 \ |
| 124 | d2i_ASN1_OBJECT.3 \ | ||
| 123 | d2i_PKCS8PrivateKey_bio.3 \ | 125 | d2i_PKCS8PrivateKey_bio.3 \ |
| 124 | des_read_pw.3 \ | 126 | des_read_pw.3 \ |
| 125 | evp.3 \ | 127 | evp.3 \ |
| 126 | lh_new.3 \ | 128 | lh_new.3 \ |
| 127 | 129 | ||
| 128 | GENMAN= \ | 130 | GENMAN= \ |
| 129 | OBJ_nid2obj.3 \ | ||
| 130 | OPENSSL_VERSION_NUMBER.3 \ | 131 | OPENSSL_VERSION_NUMBER.3 \ |
| 131 | OPENSSL_config.3 \ | 132 | OPENSSL_config.3 \ |
| 132 | OPENSSL_load_builtin_modules.3 \ | 133 | OPENSSL_load_builtin_modules.3 \ |
| @@ -178,7 +179,6 @@ GENMAN= \ | |||
| 178 | X509_new.3 \ | 179 | X509_new.3 \ |
| 179 | X509_verify_cert.3 \ | 180 | X509_verify_cert.3 \ |
| 180 | bn.3 \ | 181 | bn.3 \ |
| 181 | d2i_ASN1_OBJECT.3 \ | ||
| 182 | d2i_DHparams.3 \ | 182 | d2i_DHparams.3 \ |
| 183 | d2i_DSAPublicKey.3 \ | 183 | d2i_DSAPublicKey.3 \ |
| 184 | d2i_ECPKParameters.3 \ | 184 | d2i_ECPKParameters.3 \ |
diff --git a/src/lib/libcrypto/man/OBJ_nid2obj.3 b/src/lib/libcrypto/man/OBJ_nid2obj.3 new file mode 100644 index 0000000000..5634d8ea4a --- /dev/null +++ b/src/lib/libcrypto/man/OBJ_nid2obj.3 | |||
| @@ -0,0 +1,267 @@ | |||
| 1 | .Dd $Mdocdate: November 3 2016 $ | ||
| 2 | .Dt OBJ_NID2OBJ 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm OBJ_nid2obj , | ||
| 6 | .Nm OBJ_nid2ln , | ||
| 7 | .Nm OBJ_nid2sn , | ||
| 8 | .Nm OBJ_obj2nid , | ||
| 9 | .Nm OBJ_txt2nid , | ||
| 10 | .Nm OBJ_ln2nid , | ||
| 11 | .Nm OBJ_sn2nid , | ||
| 12 | .Nm OBJ_cmp , | ||
| 13 | .Nm OBJ_dup , | ||
| 14 | .Nm OBJ_txt2obj , | ||
| 15 | .Nm OBJ_obj2txt , | ||
| 16 | .Nm OBJ_create , | ||
| 17 | .Nm OBJ_cleanup | ||
| 18 | .Nd ASN1 object utility functions | ||
| 19 | .Sh SYNOPSIS | ||
| 20 | .In openssl/objects.h | ||
| 21 | .Ft ASN1_OBJECT * | ||
| 22 | .Fo OBJ_nid2obj | ||
| 23 | .Fa "int n" | ||
| 24 | .Fc | ||
| 25 | .Ft const char * | ||
| 26 | .Fo OBJ_nid2ln | ||
| 27 | .Fa "int n" | ||
| 28 | .Fc | ||
| 29 | .Ft const char * | ||
| 30 | .Fo OBJ_nid2sn | ||
| 31 | .Fa "int n" | ||
| 32 | .Fc | ||
| 33 | .Ft int | ||
| 34 | .Fo OBJ_obj2nid | ||
| 35 | .Fa "const ASN1_OBJECT *o" | ||
| 36 | .Fc | ||
| 37 | .Ft int | ||
| 38 | .Fo OBJ_ln2nid | ||
| 39 | .Fa "const char *ln" | ||
| 40 | .Fc | ||
| 41 | .Ft int | ||
| 42 | .Fo OBJ_sn2nid | ||
| 43 | .Fa "const char *sn" | ||
| 44 | .Fc | ||
| 45 | .Ft int | ||
| 46 | .Fo OBJ_txt2nid | ||
| 47 | .Fa "const char *s" | ||
| 48 | .Fc | ||
| 49 | .Ft ASN1_OBJECT * | ||
| 50 | .Fo OBJ_txt2obj | ||
| 51 | .Fa "const char *s" | ||
| 52 | .Fa "int no_name" | ||
| 53 | .Fc | ||
| 54 | .Ft int | ||
| 55 | .Fo OBJ_obj2txt | ||
| 56 | .Fa "char *buf" | ||
| 57 | .Fa "int buf_len" | ||
| 58 | .Fa "const ASN1_OBJECT *a" | ||
| 59 | .Fa "int no_name" | ||
| 60 | .Fc | ||
| 61 | .Ft int | ||
| 62 | .Fo OBJ_cmp | ||
| 63 | .Fa "const ASN1_OBJECT *a" | ||
| 64 | .Fa "const ASN1_OBJECT *b" | ||
| 65 | .Fc | ||
| 66 | .Ft ASN1_OBJECT * | ||
| 67 | .Fo OBJ_dup | ||
| 68 | .Fa "const ASN1_OBJECT *o" | ||
| 69 | .Fc | ||
| 70 | .Ft int | ||
| 71 | .Fo OBJ_create | ||
| 72 | .Fa "const char *oid" | ||
| 73 | .Fa "const char *sn" | ||
| 74 | .Fa "const char *ln" | ||
| 75 | .Fc | ||
| 76 | .Ft void | ||
| 77 | .Fn OBJ_cleanup void | ||
| 78 | .Sh DESCRIPTION | ||
| 79 | The ASN1 object utility functions process | ||
| 80 | .Vt ASN1_OBJECT | ||
| 81 | structures which are a representation of the ASN1 OBJECT IDENTIFIER | ||
| 82 | (OID) type. | ||
| 83 | .Pp | ||
| 84 | .Fn OBJ_nid2obj , | ||
| 85 | .Fn OBJ_nid2ln , | ||
| 86 | and | ||
| 87 | .Fn OBJ_nid2sn | ||
| 88 | convert the NID | ||
| 89 | .Fa n | ||
| 90 | to an | ||
| 91 | .Vt ASN1_OBJECT | ||
| 92 | structure, its long name, and its short name, respectively, or return | ||
| 93 | .Dv NULL | ||
| 94 | if an error occurred. | ||
| 95 | .Pp | ||
| 96 | .Fn OBJ_obj2nid , | ||
| 97 | .Fn OBJ_ln2nid , | ||
| 98 | and | ||
| 99 | .Fn OBJ_sn2nid | ||
| 100 | return the corresponding NID for the object | ||
| 101 | .Fa o , | ||
| 102 | the long name | ||
| 103 | .Fa ln , | ||
| 104 | or the short name | ||
| 105 | .Fa sn , | ||
| 106 | respectively, or | ||
| 107 | .Dv NID_undef | ||
| 108 | if an error occurred. | ||
| 109 | .Pp | ||
| 110 | .Fn OBJ_txt2nid | ||
| 111 | returns the NID corresponding to text string | ||
| 112 | .Fa s . | ||
| 113 | .Fa s | ||
| 114 | can be a long name, a short name, or the numerical representation | ||
| 115 | of an object. | ||
| 116 | .Pp | ||
| 117 | .Fn OBJ_txt2obj | ||
| 118 | converts the text string | ||
| 119 | .Fa s | ||
| 120 | into an | ||
| 121 | .Vt ASN1_OBJECT | ||
| 122 | structure. | ||
| 123 | If | ||
| 124 | .Fa no_name | ||
| 125 | is 0 then long names and short names will be interpreted as well as | ||
| 126 | numerical forms. | ||
| 127 | If | ||
| 128 | .Fa no_name | ||
| 129 | is 1 only the numerical form is acceptable. | ||
| 130 | .Pp | ||
| 131 | .Fn OBJ_obj2txt | ||
| 132 | converts the | ||
| 133 | .Vt ASN1_OBJECT | ||
| 134 | .Fa a | ||
| 135 | into a textual representation. | ||
| 136 | The representation is written as a NUL terminated string to | ||
| 137 | .Fa buf . | ||
| 138 | At most | ||
| 139 | .Fa buf_len | ||
| 140 | bytes are written, truncating the result if necessary. | ||
| 141 | The total amount of space required is returned. | ||
| 142 | If | ||
| 143 | .Fa no_name | ||
| 144 | is 0 and the object has a long or short name, then that will be used, | ||
| 145 | otherwise the numerical form will be used. | ||
| 146 | .Pp | ||
| 147 | .Fn OBJ_cmp | ||
| 148 | compares | ||
| 149 | .Fa a | ||
| 150 | to | ||
| 151 | .Fa b . | ||
| 152 | If the two are identical, 0 is returned. | ||
| 153 | .Pp | ||
| 154 | .Fn OBJ_dup | ||
| 155 | returns a copy of | ||
| 156 | .Fa o . | ||
| 157 | .Pp | ||
| 158 | .Fn OBJ_create | ||
| 159 | adds a new object to the internal table. | ||
| 160 | .Fa oid | ||
| 161 | is the numerical form of the object, | ||
| 162 | .Fa sn | ||
| 163 | the short name and | ||
| 164 | .Fa ln | ||
| 165 | the long name. | ||
| 166 | A new NID is returned for the created object. | ||
| 167 | .Pp | ||
| 168 | .Fn OBJ_cleanup | ||
| 169 | cleans up the internal object table: this should be called before | ||
| 170 | an application exits if any new objects were added using | ||
| 171 | .Fn OBJ_create . | ||
| 172 | .Pp | ||
| 173 | Objects can have a short name, a long name, and a numerical | ||
| 174 | identifier (NID) associated with them. | ||
| 175 | A standard set of objects is represented in an internal table. | ||
| 176 | The appropriate values are defined in the header file | ||
| 177 | .In openssl/objects.h . | ||
| 178 | .Pp | ||
| 179 | For example, the OID for commonName has the following definitions: | ||
| 180 | .Bd -literal | ||
| 181 | #define SN_commonName "CN" | ||
| 182 | #define LN_commonName "commonName" | ||
| 183 | #define NID_commonName 13 | ||
| 184 | .Ed | ||
| 185 | .Pp | ||
| 186 | New objects can be added by calling | ||
| 187 | .Fn OBJ_create . | ||
| 188 | .Pp | ||
| 189 | Table objects have certain advantages over other objects: for example | ||
| 190 | their NIDs can be used in a C language switch statement. | ||
| 191 | They are also static constant structures which are shared: that is there | ||
| 192 | is only a single constant structure for each table object. | ||
| 193 | .Pp | ||
| 194 | Objects which are not in the table have the NID value | ||
| 195 | .Dv NID_undef . | ||
| 196 | .Pp | ||
| 197 | Objects do not need to be in the internal tables to be processed, the | ||
| 198 | functions | ||
| 199 | .Fn OBJ_txt2obj | ||
| 200 | and | ||
| 201 | .Fn OBJ_obj2txt | ||
| 202 | can process the numerical form of an OID. | ||
| 203 | .Sh RETURN VALUES | ||
| 204 | .Fn OBJ_nid2obj | ||
| 205 | returns an | ||
| 206 | .Vt ASN1_OBJECT | ||
| 207 | structure or | ||
| 208 | .Dv NULL | ||
| 209 | if an error occurred. | ||
| 210 | .Pp | ||
| 211 | .Fn OBJ_nid2ln | ||
| 212 | and | ||
| 213 | .Fn OBJ_nid2sn | ||
| 214 | returns a valid string or | ||
| 215 | .Dv NULL | ||
| 216 | on error. | ||
| 217 | .Pp | ||
| 218 | .Fn OBJ_obj2nid , | ||
| 219 | .Fn OBJ_ln2nid , | ||
| 220 | .Fn OBJ_sn2nid , | ||
| 221 | and | ||
| 222 | .Fn OBJ_txt2nid | ||
| 223 | return a NID or | ||
| 224 | .Dv NID_undef | ||
| 225 | on error. | ||
| 226 | .Sh EXAMPLES | ||
| 227 | Create an object for | ||
| 228 | .Sy commonName : | ||
| 229 | .Bd -literal | ||
| 230 | ASN1_OBJECT *o; | ||
| 231 | o = OBJ_nid2obj(NID_commonName); | ||
| 232 | .Ed | ||
| 233 | .Pp | ||
| 234 | Check if an object is | ||
| 235 | .Sy commonName | ||
| 236 | .Bd -literal | ||
| 237 | if (OBJ_obj2nid(obj) == NID_commonName) | ||
| 238 | /* Do something */ | ||
| 239 | .Ed | ||
| 240 | .Pp | ||
| 241 | Create a new NID and initialize an object from it: | ||
| 242 | .Bd -literal | ||
| 243 | int new_nid; | ||
| 244 | ASN1_OBJECT *obj; | ||
| 245 | new_nid = OBJ_create("1.2.3.4", "NewOID", "New Object Identifier"); | ||
| 246 | obj = OBJ_nid2obj(new_nid); | ||
| 247 | .Ed | ||
| 248 | .Pp | ||
| 249 | Create a new object directly: | ||
| 250 | .Bd -literal | ||
| 251 | obj = OBJ_txt2obj("1.2.3.4", 1); | ||
| 252 | .Ed | ||
| 253 | .Sh SEE ALSO | ||
| 254 | .Xr ERR_get_error 3 | ||
| 255 | .Sh BUGS | ||
| 256 | .Fn OBJ_obj2txt | ||
| 257 | is awkward and messy to use: it doesn't follow the convention of other | ||
| 258 | OpenSSL functions where the buffer can be set to | ||
| 259 | .Dv NULL | ||
| 260 | to determine the amount of data that should be written. | ||
| 261 | Instead | ||
| 262 | .Fa buf | ||
| 263 | must point to a valid buffer and | ||
| 264 | .Fa buf_len | ||
| 265 | should be set to a positive value. | ||
| 266 | A buffer length of 80 should be more than enough to handle any OID | ||
| 267 | encountered in practice. | ||
diff --git a/src/lib/libcrypto/man/d2i_ASN1_OBJECT.3 b/src/lib/libcrypto/man/d2i_ASN1_OBJECT.3 new file mode 100644 index 0000000000..686101cff5 --- /dev/null +++ b/src/lib/libcrypto/man/d2i_ASN1_OBJECT.3 | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | .Dd $Mdocdate: November 3 2016 $ | ||
| 2 | .Dt D2I_ASN1_OBJECT 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm d2i_ASN1_OBJECT , | ||
| 6 | .Nm i2d_ASN1_OBJECT | ||
| 7 | .Nd ASN1 OBJECT IDENTIFIER functions | ||
| 8 | .Sh SYNOPSIS | ||
| 9 | .In openssl/objects.h | ||
| 10 | .Ft ASN1_OBJECT * | ||
| 11 | .Fo d2i_ASN1_OBJECT | ||
| 12 | .Fa "ASN1_OBJECT **a" | ||
| 13 | .Fa "unsigned char **pp" | ||
| 14 | .Fa "long length" | ||
| 15 | .Fc | ||
| 16 | .Ft int | ||
| 17 | .Fo i2d_ASN1_OBJECT | ||
| 18 | .Fa "ASN1_OBJECT *a" | ||
| 19 | .Fa "unsigned char **pp" | ||
| 20 | .Fc | ||
| 21 | .Sh DESCRIPTION | ||
| 22 | These functions decode and encode an ASN1 OBJECT IDENTIFIER. | ||
| 23 | .Pp | ||
| 24 | Otherwise these behave in a similar way to | ||
| 25 | .Xr d2i_X509 3 | ||
| 26 | and | ||
| 27 | .Xr i2d_X509 3 . | ||
| 28 | .Sh SEE ALSO | ||
| 29 | .Xr d2i_X509 3 | ||
