xref: /onnv-gate/usr/src/common/openssl/doc/crypto/BIO_push.pod (revision 2175:b0b2f052a486)
1*2175Sjp161948=pod
2*2175Sjp161948
3*2175Sjp161948=head1 NAME
4*2175Sjp161948
5*2175Sjp161948BIO_push, BIO_pop - add and remove BIOs from a chain.
6*2175Sjp161948
7*2175Sjp161948=head1 SYNOPSIS
8*2175Sjp161948
9*2175Sjp161948 #include <openssl/bio.h>
10*2175Sjp161948
11*2175Sjp161948 BIO *	BIO_push(BIO *b,BIO *append);
12*2175Sjp161948 BIO *	BIO_pop(BIO *b);
13*2175Sjp161948
14*2175Sjp161948=head1 DESCRIPTION
15*2175Sjp161948
16*2175Sjp161948The BIO_push() function appends the BIO B<append> to B<b>, it returns
17*2175Sjp161948B<b>.
18*2175Sjp161948
19*2175Sjp161948BIO_pop() removes the BIO B<b> from a chain and returns the next BIO
20*2175Sjp161948in the chain, or NULL if there is no next BIO. The removed BIO then
21*2175Sjp161948becomes a single BIO with no association with the original chain,
22*2175Sjp161948it can thus be freed or attached to a different chain.
23*2175Sjp161948
24*2175Sjp161948=head1 NOTES
25*2175Sjp161948
26*2175Sjp161948The names of these functions are perhaps a little misleading. BIO_push()
27*2175Sjp161948joins two BIO chains whereas BIO_pop() deletes a single BIO from a chain,
28*2175Sjp161948the deleted BIO does not need to be at the end of a chain.
29*2175Sjp161948
30*2175Sjp161948The process of calling BIO_push() and BIO_pop() on a BIO may have additional
31*2175Sjp161948consequences (a control call is made to the affected BIOs) any effects will
32*2175Sjp161948be noted in the descriptions of individual BIOs.
33*2175Sjp161948
34*2175Sjp161948=head1 EXAMPLES
35*2175Sjp161948
36*2175Sjp161948For these examples suppose B<md1> and B<md2> are digest BIOs, B<b64> is
37*2175Sjp161948a base64 BIO and B<f> is a file BIO.
38*2175Sjp161948
39*2175Sjp161948If the call:
40*2175Sjp161948
41*2175Sjp161948 BIO_push(b64, f);
42*2175Sjp161948
43*2175Sjp161948is made then the new chain will be B<b64-chain>. After making the calls
44*2175Sjp161948
45*2175Sjp161948 BIO_push(md2, b64);
46*2175Sjp161948 BIO_push(md1, md2);
47*2175Sjp161948
48*2175Sjp161948the new chain is B<md1-md2-b64-f>. Data written to B<md1> will be digested
49*2175Sjp161948by B<md1> and B<md2>, B<base64> encoded and written to B<f>.
50*2175Sjp161948
51*2175Sjp161948It should be noted that reading causes data to pass in the reverse
52*2175Sjp161948direction, that is data is read from B<f>, base64 B<decoded> and digested
53*2175Sjp161948by B<md1> and B<md2>. If the call:
54*2175Sjp161948
55*2175Sjp161948 BIO_pop(md2);
56*2175Sjp161948
57*2175Sjp161948The call will return B<b64> and the new chain will be B<md1-b64-f> data can
58*2175Sjp161948be written to B<md1> as before.
59*2175Sjp161948
60*2175Sjp161948=head1 RETURN VALUES
61*2175Sjp161948
62*2175Sjp161948BIO_push() returns the end of the chain, B<b>.
63*2175Sjp161948
64*2175Sjp161948BIO_pop() returns the next BIO in the chain, or NULL if there is no next
65*2175Sjp161948BIO.
66*2175Sjp161948
67*2175Sjp161948=head1 SEE ALSO
68*2175Sjp161948
69*2175Sjp161948TBA
70