diff options
| author | schwarze <> | 2016-12-24 23:22:52 +0000 |
|---|---|---|
| committer | schwarze <> | 2016-12-24 23:22:52 +0000 |
| commit | 042129ea4be88b53a8d4b3951fb253a0374045c4 (patch) | |
| tree | 828cc4296f112b0ccb0438564ec92ccff95d6d5b /src | |
| parent | 823ebb4bac20fa9711aa3eeabca11eed198723da (diff) | |
| download | openbsd-042129ea4be88b53a8d4b3951fb253a0374045c4.tar.gz openbsd-042129ea4be88b53a8d4b3951fb253a0374045c4.tar.bz2 openbsd-042129ea4be88b53a8d4b3951fb253a0374045c4.zip | |
First example of how to fix the d2i_*() manuals:
- add four missing functions found in OpenSSL doc/man3/d2i_X509.pod
- simplify .Nd
- drop needless extra include line
- use the same parameter names as in ASN1_item_d2i(3)
- point to ASN1_item_d2i(3) for details
- sort the text and simplify the wording
More work is needed on STANDARDS references.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/man/d2i_DSAPublicKey.3 | 221 |
1 files changed, 123 insertions, 98 deletions
diff --git a/src/lib/libcrypto/man/d2i_DSAPublicKey.3 b/src/lib/libcrypto/man/d2i_DSAPublicKey.3 index 421a6e5053..3468131178 100644 --- a/src/lib/libcrypto/man/d2i_DSAPublicKey.3 +++ b/src/lib/libcrypto/man/d2i_DSAPublicKey.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: d2i_DSAPublicKey.3,v 1.6 2016/12/12 13:58:46 schwarze Exp $ | 1 | .\" $OpenBSD: d2i_DSAPublicKey.3,v 1.7 2016/12/24 23:22:52 schwarze Exp $ |
| 2 | .\" OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400 | 2 | .\" OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
| @@ -49,7 +49,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 51 | .\" |
| 52 | .Dd $Mdocdate: December 12 2016 $ | 52 | .Dd $Mdocdate: December 24 2016 $ |
| 53 | .Dt D2I_DSAPUBLICKEY 3 | 53 | .Dt D2I_DSAPUBLICKEY 3 |
| 54 | .Os | 54 | .Os |
| 55 | .Sh NAME | 55 | .Sh NAME |
| @@ -63,116 +63,162 @@ | |||
| 63 | .Nm i2d_DSA_PUBKEY_fp , | 63 | .Nm i2d_DSA_PUBKEY_fp , |
| 64 | .Nm d2i_DSAPrivateKey , | 64 | .Nm d2i_DSAPrivateKey , |
| 65 | .Nm i2d_DSAPrivateKey , | 65 | .Nm i2d_DSAPrivateKey , |
| 66 | .Nm d2i_DSAPrivateKey_bio , | ||
| 67 | .Nm d2i_DSAPrivateKey_fp , | ||
| 68 | .Nm i2d_DSAPrivateKey_bio , | ||
| 69 | .Nm i2d_DSAPrivateKey_fp , | ||
| 66 | .Nm d2i_DSAparams , | 70 | .Nm d2i_DSAparams , |
| 67 | .Nm i2d_DSAparams , | 71 | .Nm i2d_DSAparams , |
| 68 | .Nm DSAparams_dup , | 72 | .Nm DSAparams_dup , |
| 69 | .Nm d2i_DSA_SIG , | 73 | .Nm d2i_DSA_SIG , |
| 70 | .Nm i2d_DSA_SIG | 74 | .Nm i2d_DSA_SIG |
| 71 | .Nd DSA key encoding and parsing functions | 75 | .Nd decode and encode DSA keys |
| 72 | .Sh SYNOPSIS | 76 | .Sh SYNOPSIS |
| 73 | .In openssl/dsa.h | 77 | .In openssl/dsa.h |
| 74 | .In openssl/x509.h | ||
| 75 | .Ft DSA * | 78 | .Ft DSA * |
| 76 | .Fo d2i_DSAPublicKey | 79 | .Fo d2i_DSAPublicKey |
| 77 | .Fa "DSA **a" | 80 | .Fa "DSA **val_out" |
| 78 | .Fa "const unsigned char **pp" | 81 | .Fa "const unsigned char **der_in" |
| 79 | .Fa "long length" | 82 | .Fa "long length" |
| 80 | .Fc | 83 | .Fc |
| 81 | .Ft int | 84 | .Ft int |
| 82 | .Fo i2d_DSAPublicKey | 85 | .Fo i2d_DSAPublicKey |
| 83 | .Fa "const DSA *a" | 86 | .Fa "const DSA *val_in" |
| 84 | .Fa "unsigned char **pp" | 87 | .Fa "unsigned char **der_out" |
| 85 | .Fc | 88 | .Fc |
| 86 | .Ft DSA * | 89 | .Ft DSA * |
| 87 | .Fo d2i_DSA_PUBKEY | 90 | .Fo d2i_DSA_PUBKEY |
| 88 | .Fa "DSA **a" | 91 | .Fa "DSA **val_out" |
| 89 | .Fa "const unsigned char **pp" | 92 | .Fa "const unsigned char **der_in" |
| 90 | .Fa "long length" | 93 | .Fa "long length" |
| 91 | .Fc | 94 | .Fc |
| 92 | .Ft int | 95 | .Ft int |
| 93 | .Fo i2d_DSA_PUBKEY | 96 | .Fo i2d_DSA_PUBKEY |
| 94 | .Fa "const DSA *a" | 97 | .Fa "const DSA *val_in" |
| 95 | .Fa "unsigned char **pp" | 98 | .Fa "unsigned char **der_out" |
| 96 | .Fc | 99 | .Fc |
| 97 | .Ft DSA * | 100 | .Ft DSA * |
| 98 | .Fo d2i_DSA_PUBKEY_bio | 101 | .Fo d2i_DSA_PUBKEY_bio |
| 99 | .Fa "BIO *bp" | 102 | .Fa "BIO *in_bio" |
| 100 | .Fa "DSA **dsa" | 103 | .Fa "DSA **val_out" |
| 101 | .Fc | 104 | .Fc |
| 102 | .Ft DSA * | 105 | .Ft DSA * |
| 103 | .Fo d2i_DSA_PUBKEY_fp | 106 | .Fo d2i_DSA_PUBKEY_fp |
| 104 | .Fa "FILE *fp" | 107 | .Fa "FILE *in_fp" |
| 105 | .Fa "DSA *dsa" | 108 | .Fa "DSA **val_out" |
| 106 | .Fc | 109 | .Fc |
| 107 | .Ft int | 110 | .Ft int |
| 108 | .Fo i2d_DSA_PUBKEY_bio | 111 | .Fo i2d_DSA_PUBKEY_bio |
| 109 | .Fa "BIO *bp" | 112 | .Fa "BIO *out_bio" |
| 110 | .Fa "DSA *dsa" | 113 | .Fa "DSA *val_in" |
| 111 | .Fc | 114 | .Fc |
| 112 | .Ft int | 115 | .Ft int |
| 113 | .Fo i2d_DSA_PUBKEY_fp | 116 | .Fo i2d_DSA_PUBKEY_fp |
| 114 | .Fa "FILE *fp" | 117 | .Fa "FILE *out_fp" |
| 115 | .Fa "DSA *dsa" | 118 | .Fa "DSA *val_in" |
| 116 | .Fc | 119 | .Fc |
| 117 | .Ft DSA * | 120 | .Ft DSA * |
| 118 | .Fo d2i_DSAPrivateKey | 121 | .Fo d2i_DSAPrivateKey |
| 119 | .Fa "DSA **a" | 122 | .Fa "DSA **val_out" |
| 120 | .Fa "const unsigned char **pp" | 123 | .Fa "const unsigned char **der_in" |
| 121 | .Fa "long length" | 124 | .Fa "long length" |
| 122 | .Fc | 125 | .Fc |
| 123 | .Ft int | 126 | .Ft int |
| 124 | .Fo i2d_DSAPrivateKey | 127 | .Fo i2d_DSAPrivateKey |
| 125 | .Fa "const DSA *a" | 128 | .Fa "const DSA *val_in" |
| 126 | .Fa "unsigned char **pp" | 129 | .Fa "unsigned char **der_out" |
| 130 | .Fc | ||
| 131 | .Ft DSA * | ||
| 132 | .Fo d2i_DSAPrivateKey_bio | ||
| 133 | .Fa "BIO *in_bio" | ||
| 134 | .Fa "DSA **val_out" | ||
| 135 | .Fc | ||
| 136 | .Ft DSA * | ||
| 137 | .Fo d2i_DSAPrivateKey_fp | ||
| 138 | .Fa "FILE *in_fp" | ||
| 139 | .Fa "DSA **val_out" | ||
| 140 | .Fc | ||
| 141 | .Ft int | ||
| 142 | .Fo i2d_DSAPrivateKey_bio | ||
| 143 | .Fa "BIO *out_bio" | ||
| 144 | .Fa "DSA *val_in" | ||
| 145 | .Fc | ||
| 146 | .Ft int | ||
| 147 | .Fo i2d_DSAPrivateKey_fp | ||
| 148 | .Fa "FILE *out_fp" | ||
| 149 | .Fa "DSA *val_in" | ||
| 127 | .Fc | 150 | .Fc |
| 128 | .Ft DSA * | 151 | .Ft DSA * |
| 129 | .Fo d2i_DSAparams | 152 | .Fo d2i_DSAparams |
| 130 | .Fa "DSA **a" | 153 | .Fa "DSA **val_out" |
| 131 | .Fa "const unsigned char **pp" | 154 | .Fa "const unsigned char **der_in" |
| 132 | .Fa "long length" | 155 | .Fa "long length" |
| 133 | .Fc | 156 | .Fc |
| 134 | .Ft int | 157 | .Ft int |
| 135 | .Fo i2d_DSAparams | 158 | .Fo i2d_DSAparams |
| 136 | .Fa "const DSA *a" | 159 | .Fa "const DSA *val_in" |
| 137 | .Fa "unsigned char **pp" | 160 | .Fa "unsigned char **der_out" |
| 138 | .Fc | 161 | .Fc |
| 139 | .Ft DSA * | 162 | .Ft DSA * |
| 140 | .Fo DSAparams_dup | 163 | .Fo DSAparams_dup |
| 141 | .Fa "DSA *dsa" | 164 | .Fa "DSA *val_in" |
| 142 | .Fc | 165 | .Fc |
| 143 | .Ft DSA_SIG * | 166 | .Ft DSA_SIG * |
| 144 | .Fo d2i_DSA_SIG | 167 | .Fo d2i_DSA_SIG |
| 145 | .Fa "DSA_SIG **a" | 168 | .Fa "DSA_SIG **val_out" |
| 146 | .Fa "const unsigned char **pp" | 169 | .Fa "const unsigned char **der_in" |
| 147 | .Fa "long length" | 170 | .Fa "long length" |
| 148 | .Fc | 171 | .Fc |
| 149 | .Ft int | 172 | .Ft int |
| 150 | .Fo i2d_DSA_SIG | 173 | .Fo i2d_DSA_SIG |
| 151 | .Fa "const DSA_SIG *a" | 174 | .Fa "const DSA_SIG *val_in" |
| 152 | .Fa "unsigned char **pp" | 175 | .Fa "unsigned char **der_out" |
| 153 | .Fc | 176 | .Fc |
| 154 | .Sh DESCRIPTION | 177 | .Sh DESCRIPTION |
| 178 | These functions decode and encode DSA keys and parameters. | ||
| 179 | For details about the semantics, examples, caveats, and bugs, see | ||
| 180 | .Xr ASN1_item_d2i 3 . | ||
| 181 | .Pp | ||
| 155 | .Fn d2i_DSAPublicKey | 182 | .Fn d2i_DSAPublicKey |
| 156 | and | 183 | and |
| 157 | .Fn i2d_DSAPublicKey | 184 | .Fn i2d_DSAPublicKey |
| 158 | decode and encode the DSA public key components structure. | 185 | decode and encode the DSA public key components using a non-standard |
| 186 | format, so consider using | ||
| 187 | .Fn d2i_DSA_PUBKEY | ||
| 188 | and | ||
| 189 | .Fn i2d_DSA_PUBKEY | ||
| 190 | instead. | ||
| 191 | The actual data encoded depends on the value of | ||
| 192 | .Fa val_in->write_params . | ||
| 193 | If | ||
| 194 | .Fa val_in->write_params | ||
| 195 | is zero, only the | ||
| 196 | .Fa val_in->pub_key | ||
| 197 | field is encoded as an | ||
| 198 | .Sy INTEGER . | ||
| 199 | If | ||
| 200 | .Fa val_in->write_params | ||
| 201 | is 1, then a | ||
| 202 | .Sy SEQUENCE | ||
| 203 | consisting of the | ||
| 204 | .Fa val_in->p , | ||
| 205 | .Fa val_in->q , | ||
| 206 | .Fa val_in->g , | ||
| 207 | and | ||
| 208 | .Fa val_in->pub_key | ||
| 209 | fields is encoded. | ||
| 159 | .Pp | 210 | .Pp |
| 160 | .Fn d2i_DSA_PUBKEY | 211 | .Fn d2i_DSA_PUBKEY |
| 161 | and | 212 | and |
| 162 | .Fn i2d_DSA_PUBKEY | 213 | .Fn i2d_DSA_PUBKEY |
| 163 | decode and encode a DSA public key using a SubjectPublicKeyInfo | 214 | decode and encode a DSA public key using a SubjectPublicKeyInfo |
| 164 | (certificate public key) structure. | 215 | (certificate public key) structure. |
| 165 | .Pp | ||
| 166 | .Fn d2i_DSA_PUBKEY_bio , | 216 | .Fn d2i_DSA_PUBKEY_bio , |
| 167 | .Fn d2i_DSA_PUBKEY_fp , | 217 | .Fn d2i_DSA_PUBKEY_fp , |
| 168 | .Fn i2d_DSA_PUBKEY_bio , | 218 | .Fn i2d_DSA_PUBKEY_bio , |
| 169 | and | 219 | and |
| 170 | .Fn i2d_DSA_PUBKEY_fp | 220 | .Fn i2d_DSA_PUBKEY_fp |
| 171 | are similar to | 221 | are similar except that they decode or encode using a |
| 172 | .Fn d2i_DSA_PUBKEY | ||
| 173 | and | ||
| 174 | .Fn i2d_DSA_PUBKEY | ||
| 175 | except that they decode or encode using a | ||
| 176 | .Vt BIO | 222 | .Vt BIO |
| 177 | or | 223 | or |
| 178 | .Vt FILE | 224 | .Vt FILE |
| @@ -182,6 +228,35 @@ pointer. | |||
| 182 | and | 228 | and |
| 183 | .Fn i2d_DSAPrivateKey | 229 | .Fn i2d_DSAPrivateKey |
| 184 | decode and encode the DSA private key components. | 230 | decode and encode the DSA private key components. |
| 231 | The | ||
| 232 | .Vt DSA | ||
| 233 | object passed to the private key encoding functions should have all | ||
| 234 | the private key components present. | ||
| 235 | These functions use a non-standard structure consisting of a | ||
| 236 | SEQUENCE containing the | ||
| 237 | .Fa val_in->p , | ||
| 238 | .Fa val_in->q , | ||
| 239 | .Fa val_in->g , | ||
| 240 | .Fa val_in->pub_key , | ||
| 241 | and | ||
| 242 | .Fa val_in->priv_key | ||
| 243 | fields. | ||
| 244 | This data format is unencrypted. | ||
| 245 | For private key security when writing private keys to files, | ||
| 246 | consider using | ||
| 247 | .Xr PEM_write_DSAPrivateKey 3 | ||
| 248 | instead. | ||
| 249 | The | ||
| 250 | .Fn d2i_DSAPrivateKey_bio , | ||
| 251 | .Fn d2i_DSAPrivateKey_fp , | ||
| 252 | .Fn i2d_DSAPrivateKey_bio , | ||
| 253 | and | ||
| 254 | .Fn i2d_DSAPrivateKey_fp | ||
| 255 | are similar except that they decode or encode using a | ||
| 256 | .Vt BIO | ||
| 257 | or | ||
| 258 | .Vt FILE | ||
| 259 | pointer. | ||
| 185 | .Pp | 260 | .Pp |
| 186 | .Fn d2i_DSAparams | 261 | .Fn d2i_DSAparams |
| 187 | and | 262 | and |
| @@ -203,81 +278,31 @@ and | |||
| 203 | decode and encode a DSA signature using a | 278 | decode and encode a DSA signature using a |
| 204 | .Sy Dss-Sig-Value | 279 | .Sy Dss-Sig-Value |
| 205 | structure as defined in RFC 2459. | 280 | structure as defined in RFC 2459. |
| 206 | .Pp | ||
| 207 | The usage of all of these functions is similar to | ||
| 208 | .Xr d2i_X509 3 | ||
| 209 | and | ||
| 210 | .Xr i2d_X509 3 . | ||
| 211 | .Pp | ||
| 212 | The | ||
| 213 | .Vt DSA | ||
| 214 | structure passed to the private key encoding functions should have all | ||
| 215 | the private key components present. | ||
| 216 | .Pp | ||
| 217 | The data encoded by the private key functions is unencrypted and | ||
| 218 | therefore offers no private key security. | ||
| 219 | .Pp | ||
| 220 | The | ||
| 221 | .Fn *_DSA_PUBKEY | ||
| 222 | functions should be used in preference to the | ||
| 223 | .Fn *_DSAPublicKey | ||
| 224 | functions when encoding public keys because they use a standard format. | ||
| 225 | .Pp | ||
| 226 | The | ||
| 227 | .Fn *_DSAPublicKey | ||
| 228 | functions use a non-standard format. | ||
| 229 | The actual data encoded depends on the value of | ||
| 230 | .Fa a->write_params . | ||
| 231 | If | ||
| 232 | .Fa a->write_params | ||
| 233 | is zero, then only the | ||
| 234 | .Fa a->pub_key | ||
| 235 | field is encoded as an | ||
| 236 | .Sy INTEGER . | ||
| 237 | If | ||
| 238 | .Fa a->write_params | ||
| 239 | is 1, then a | ||
| 240 | .Sy SEQUENCE | ||
| 241 | consisting of the | ||
| 242 | .Fa a->p , | ||
| 243 | .Fa a->q , | ||
| 244 | .Fa a->g , | ||
| 245 | and | ||
| 246 | .Fa a->pub_key | ||
| 247 | fields is encoded. | ||
| 248 | .Pp | ||
| 249 | The | ||
| 250 | .Fn *_DSAPrivateKey | ||
| 251 | functions also use a non-standard structure consisting of a | ||
| 252 | SEQUENCE containing the | ||
| 253 | .Fa a->p , | ||
| 254 | .Fa a->q , | ||
| 255 | .Fa a->g , | ||
| 256 | .Fa a->pub_key , | ||
| 257 | and | ||
| 258 | .Fa a->priv_key | ||
| 259 | fields. | ||
| 260 | .Sh RETURN VALUES | 281 | .Sh RETURN VALUES |
| 261 | .Fn d2i_DSAPublicKey , | 282 | .Fn d2i_DSAPublicKey , |
| 262 | .Fn d2i_DSA_PUBKEY , | 283 | .Fn d2i_DSA_PUBKEY , |
| 263 | .Fn d2i_DSA_PUBKEY_bio , | 284 | .Fn d2i_DSA_PUBKEY_bio , |
| 264 | .Fn d2i_DSA_PUBKEY_fp , | 285 | .Fn d2i_DSA_PUBKEY_fp , |
| 265 | .Fn d2i_DSAPrivateKey , | 286 | .Fn d2i_DSAPrivateKey , |
| 287 | .Fn d2i_DSAPrivateKey_bio , | ||
| 288 | .Fn d2i_DSAPrivateKey_fp , | ||
| 266 | .Fn d2i_DSAparams , | 289 | .Fn d2i_DSAparams , |
| 267 | and | 290 | and |
| 268 | .Fn DSAparams_dup | 291 | .Fn DSAparams_dup |
| 269 | return a valid | 292 | return a valid |
| 270 | .Vt DSA | 293 | .Vt DSA |
| 271 | structure or | 294 | object or |
| 272 | .Dv NULL | 295 | .Dv NULL |
| 273 | if an error occurs. | 296 | if an error occurs. |
| 274 | .Pp | 297 | .Pp |
| 275 | .Fn d2i_DSA_SIG | 298 | .Fn d2i_DSA_SIG |
| 276 | returns a valid | 299 | returns a valid |
| 277 | .Vt DSA_SIG | 300 | .Vt DSA_SIG |
| 278 | structure or | 301 | object or |
| 279 | .Dv NULL | 302 | .Dv NULL |
| 280 | if an error occurs. | 303 | if an error occurs. |
| 281 | .Sh SEE ALSO | 304 | .Sh SEE ALSO |
| 282 | .Xr d2i_X509 3 , | 305 | .Xr ASN1_item_d2i 3 , |
| 283 | .Xr DSA_new 3 | 306 | .Xr DSA_new 3 , |
| 307 | .Xr DSA_SIG_new 3 , | ||
| 308 | .Xr PEM_write_DSAPrivateKey 3 | ||
