summaryrefslogtreecommitdiffstats
path: root/secure/lib/libcrypto/man/d2i_X509.3
diff options
context:
space:
mode:
authornectar <nectar@FreeBSD.org>2005-02-25 06:04:12 +0000
committernectar <nectar@FreeBSD.org>2005-02-25 06:04:12 +0000
commitdeac0ae54c501cec8549d18e9482a730cc2d4b97 (patch)
treecc99086df80af0d12671c7151a7b49233e19f39d /secure/lib/libcrypto/man/d2i_X509.3
parentced877b043d77d97f1ad196f15b25ed720c1fcdc (diff)
downloadFreeBSD-src-deac0ae54c501cec8549d18e9482a730cc2d4b97.zip
FreeBSD-src-deac0ae54c501cec8549d18e9482a730cc2d4b97.tar.gz
Update OpenSSL 0.9.7d -> 0.9.7e.
Diffstat (limited to 'secure/lib/libcrypto/man/d2i_X509.3')
-rw-r--r--secure/lib/libcrypto/man/d2i_X509.379
1 files changed, 52 insertions, 27 deletions
diff --git a/secure/lib/libcrypto/man/d2i_X509.3 b/secure/lib/libcrypto/man/d2i_X509.3
index bb337f0..20ddb94 100644
--- a/secure/lib/libcrypto/man/d2i_X509.3
+++ b/secure/lib/libcrypto/man/d2i_X509.3
@@ -1,8 +1,7 @@
-.\" Automatically generated by Pod::Man version 1.15
-.\" Wed Mar 17 09:38:42 2004
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
.\"
.\" Standard preamble:
-.\" ======================================================================
+.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
@@ -15,12 +14,6 @@
.if t .sp .5v
.if n .sp
..
-.de Ip \" List item
-.br
-.ie \\n(.$>=3 .ne \\$3
-.el .ne 3
-.IP "\\$1" \\$2
-..
.de Vb \" Begin verbatim text
.ft CW
.nf
@@ -28,15 +21,14 @@
..
.de Ve \" End verbatim text
.ft R
-
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. | will give a
-.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used
-.\" to do unbreakable dashes and therefore won't be available. \*(C` and
-.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
+.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
+.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
+.\" expand to `' in nroff, nothing in troff, for use with C<>.
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
@@ -56,10 +48,10 @@
. ds R" ''
'br\}
.\"
-.\" If the F register is turned on, we'll generate index entries on stderr
-.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
-.\" index entries marked with X<> in POD. Of course, you'll have to process
-.\" the output yourself in some meaningful fashion.
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
.if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
@@ -68,14 +60,13 @@
. rr F
.\}
.\"
-.\" For nroff, turn off justification. Always turn off hyphenation; it
-.\" makes way too many mistakes in technical documents.
+.\" For nroff, turn off justification. Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
-.bd B 3
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
@@ -135,11 +126,10 @@
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
-.\" ======================================================================
+.\" ========================================================================
.\"
.IX Title "d2i_X509 3"
-.TH d2i_X509 3 "0.9.7d" "2004-03-17" "OpenSSL"
-.UC
+.TH d2i_X509 3 "2005-02-24" "0.9.7d" "OpenSSL"
.SH "NAME"
d2i_X509, i2d_X509, d2i_X509_bio, d2i_X509_fp, i2d_X509_bio,
i2d_X509_fp \- X509 encode and decode functions
@@ -148,14 +138,17 @@ i2d_X509_fp \- X509 encode and decode functions
.Vb 1
\& #include <openssl/x509.h>
.Ve
+.PP
.Vb 2
\& X509 *d2i_X509(X509 **px, unsigned char **in, int len);
\& int i2d_X509(X509 *x, unsigned char **out);
.Ve
+.PP
.Vb 2
\& X509 *d2i_X509_bio(BIO *bp, X509 **x);
\& X509 *d2i_X509_fp(FILE *fp, X509 **x);
.Ve
+.PP
.Vb 2
\& int i2d_X509_bio(X509 *x, BIO *bp);
\& int i2d_X509_fp(X509 *x, FILE *fp);
@@ -230,22 +223,28 @@ Allocate and encode the \s-1DER\s0 encoding of an X509 structure:
\& int len;
\& unsigned char *buf, *p;
.Ve
+.PP
.Vb 1
\& len = i2d_X509(x, NULL);
.Ve
+.PP
.Vb 1
\& buf = OPENSSL_malloc(len);
.Ve
+.PP
.Vb 2
\& if (buf == NULL)
\& /* error */
.Ve
+.PP
.Vb 1
\& p = buf;
.Ve
+.PP
.Vb 1
\& i2d_X509(x, &p);
.Ve
+.PP
If you are using OpenSSL 0.9.7 or later then this can be
simplified to:
.PP
@@ -253,60 +252,77 @@ simplified to:
\& int len;
\& unsigned char *buf;
.Ve
+.PP
.Vb 1
\& buf = NULL;
.Ve
+.PP
.Vb 1
\& len = i2d_X509(x, &buf);
.Ve
+.PP
.Vb 2
\& if (len < 0)
\& /* error */
.Ve
+.PP
Attempt to decode a buffer:
.PP
.Vb 1
\& X509 *x;
.Ve
+.PP
.Vb 1
\& unsigned char *buf, *p;
.Ve
+.PP
.Vb 1
\& int len;
.Ve
+.PP
.Vb 1
\& /* Something to setup buf and len */
.Ve
+.PP
.Vb 1
\& p = buf;
.Ve
+.PP
.Vb 1
\& x = d2i_X509(NULL, &p, len);
.Ve
+.PP
.Vb 2
\& if (x == NULL)
\& /* Some error */
.Ve
+.PP
Alternative technique:
.PP
.Vb 1
\& X509 *x;
.Ve
+.PP
.Vb 1
\& unsigned char *buf, *p;
.Ve
+.PP
.Vb 1
\& int len;
.Ve
+.PP
.Vb 1
\& /* Something to setup buf and len */
.Ve
+.PP
.Vb 1
\& p = buf;
.Ve
+.PP
.Vb 1
\& x = NULL;
.Ve
+.PP
.Vb 2
\& if(!d2i_X509(&x, &p, len))
\& /* Some error */
@@ -320,25 +336,32 @@ mistake is to attempt to use a buffer directly as follows:
\& int len;
\& unsigned char *buf;
.Ve
+.PP
.Vb 1
\& len = i2d_X509(x, NULL);
.Ve
+.PP
.Vb 1
\& buf = OPENSSL_malloc(len);
.Ve
+.PP
.Vb 2
\& if (buf == NULL)
\& /* error */
.Ve
+.PP
.Vb 1
\& i2d_X509(x, &buf);
.Ve
+.PP
.Vb 1
\& /* Other stuff ... */
.Ve
+.PP
.Vb 1
\& OPENSSL_free(buf);
.Ve
+.PP
This code will result in \fBbuf\fR apparently containing garbage because
it was incremented after the call to point after the data just written.
Also \fBbuf\fR will no longer contain the pointer allocated by \fB\f(BIOPENSSL_malloc()\fB\fR
@@ -353,10 +376,12 @@ Another trap to avoid is misuse of the \fBxp\fR argument to \fB\f(BId2i_X509()\f
.Vb 1
\& X509 *x;
.Ve
+.PP
.Vb 2
\& if (!d2i_X509(&x, &p, len))
\& /* Some error */
.Ve
+.PP
This will probably crash somewhere in \fB\f(BId2i_X509()\fB\fR. The reason for this
is that the variable \fBx\fR is uninitialized and an attempt will be made to
interpret its (invalid) value as an \fBX509\fR structure, typically causing
@@ -379,17 +404,17 @@ always succeed.
.IX Header "RETURN VALUES"
\&\fId2i_X509()\fR, \fId2i_X509_bio()\fR and \fId2i_X509_fp()\fR return a valid \fBX509\fR structure
or \fB\s-1NULL\s0\fR if an error occurs. The error code that can be obtained by
-ERR_get_error(3).
+\&\fIERR_get_error\fR\|(3).
.PP
\&\fIi2d_X509()\fR, \fIi2d_X509_bio()\fR and \fIi2d_X509_fp()\fR return a the number of bytes
successfully encoded or a negative value if an error occurs. The error code
-can be obtained by ERR_get_error(3).
+can be obtained by \fIERR_get_error\fR\|(3).
.PP
\&\fIi2d_X509_bio()\fR and \fIi2d_X509_fp()\fR returns 1 for success and 0 if an error
-occurs The error code can be obtained by ERR_get_error(3).
+occurs The error code can be obtained by \fIERR_get_error\fR\|(3).
.SH "SEE ALSO"
.IX Header "SEE ALSO"
-ERR_get_error(3)
+\&\fIERR_get_error\fR\|(3)
.SH "HISTORY"
.IX Header "HISTORY"
d2i_X509, i2d_X509, d2i_X509_bio, d2i_X509_fp, i2d_X509_bio and i2d_X509_fp
OpenPOWER on IntegriCloud