summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschwarze <>2015-02-14 14:09:01 +0000
committerschwarze <>2015-02-14 14:09:01 +0000
commit88853a20be023939d14cfde9e86a81bfcc75ef7b (patch)
tree14e96de4625e6c5d8612c27a513ebf5ed519b352
parent948b14a55ded39aea589e34e23c19085fd99cac5 (diff)
downloadopenbsd-88853a20be023939d14cfde9e86a81bfcc75ef7b.tar.gz
openbsd-88853a20be023939d14cfde9e86a81bfcc75ef7b.tar.bz2
openbsd-88853a20be023939d14cfde9e86a81bfcc75ef7b.zip
second batch of perlpod(1) to mdoc(7) conversion
-rw-r--r--src/lib/libcrypto/man/BF_set_key.3215
-rw-r--r--src/lib/libcrypto/man/BIO.356
-rw-r--r--src/lib/libcrypto/man/BIO_ctrl.3264
-rw-r--r--src/lib/libcrypto/man/BIO_f_base64.380
-rw-r--r--src/lib/libcrypto/man/BIO_f_buffer.3110
-rw-r--r--src/lib/libcrypto/man/BIO_f_cipher.3114
-rw-r--r--src/lib/libcrypto/man/BIO_f_md.3209
-rw-r--r--src/lib/libcrypto/man/BIO_f_null.325
-rw-r--r--src/lib/libcrypto/man/BIO_find_type.3117
-rw-r--r--src/lib/libcrypto/man/BIO_new.3104
-rw-r--r--src/lib/libcrypto/man/BIO_new_CMS.383
-rw-r--r--src/lib/libcrypto/man/Makefile8
-rw-r--r--src/lib/libssl/src/doc/crypto/BF_set_key.pod107
-rw-r--r--src/lib/libssl/src/doc/crypto/BIO.pod54
-rw-r--r--src/lib/libssl/src/doc/crypto/BIO_ctrl.pod128
-rw-r--r--src/lib/libssl/src/doc/crypto/BIO_f_base64.pod80
-rw-r--r--src/lib/libssl/src/doc/crypto/BIO_f_buffer.pod77
-rw-r--r--src/lib/libssl/src/doc/crypto/BIO_f_cipher.pod71
-rw-r--r--src/lib/libssl/src/doc/crypto/BIO_f_md.pod146
-rw-r--r--src/lib/libssl/src/doc/crypto/BIO_f_null.pod30
-rw-r--r--src/lib/libssl/src/doc/crypto/BIO_find_type.pod97
-rw-r--r--src/lib/libssl/src/doc/crypto/BIO_new.pod64
-rw-r--r--src/lib/libssl/src/doc/crypto/BIO_new_CMS.pod66
23 files changed, 1381 insertions, 924 deletions
diff --git a/src/lib/libcrypto/man/BF_set_key.3 b/src/lib/libcrypto/man/BF_set_key.3
new file mode 100644
index 0000000000..53ff53896c
--- /dev/null
+++ b/src/lib/libcrypto/man/BF_set_key.3
@@ -0,0 +1,215 @@
1.Dd July 17, 2014
2.Dt BF_SET_KEY 3
3.Os
4.Sh NAME
5.Nm BF_set_key ,
6.Nm BF_encrypt ,
7.Nm BF_decrypt ,
8.Nm BF_ecb_encrypt ,
9.Nm BF_cbc_encrypt ,
10.Nm BF_cfb64_encrypt ,
11.Nm BF_ofb64_encrypt ,
12.Nm BF_options
13.Nd Blowfish encryption
14.Sh SYNOPSIS
15.In openssl/blowfish.h
16.Ft void
17.Fo BF_set_key
18.Fa "BF_KEY *key"
19.Fa "int len"
20.Fa "const unsigned char *data"
21.Fc
22.Ft void
23.Fo BF_ecb_encrypt
24.Fa "const unsigned char *in"
25.Fa "unsigned char *out"
26.Fa "BF_KEY *key"
27.Fa "int enc"
28.Fc
29.Ft void
30.Fo BF_cbc_encrypt
31.Fa "const unsigned char *in"
32.Fa "unsigned char *out"
33.Fa "long length"
34.Fa "BF_KEY *schedule"
35.Fa "unsigned char *ivec"
36.Fa "int enc"
37.Fc
38.Ft void
39.Fo BF_cfb64_encrypt
40.Fa "const unsigned char *in"
41.Fa "unsigned char *out"
42.Fa "long length"
43.Fa "BF_KEY *schedule"
44.Fa "unsigned char *ivec"
45.Fa "int *num"
46.Fa "int enc"
47.Fc
48.Ft void
49.Fo BF_ofb64_encrypt
50.Fa "const unsigned char *in"
51.Fa "unsigned char *out"
52.Fa "long length"
53.Fa "BF_KEY *schedule"
54.Fa "unsigned char *ivec"
55.Fa "int *num"
56.Fc
57.Ft const char *
58.Fo BF_options
59.Fa void
60.Fc
61.Ft void
62.Fo BF_encrypt
63.Fa "BF_LONG *data"
64.Fa "const BF_KEY *key"
65.Fc
66.Ft void
67.Fo BF_decrypt
68.Fa "BF_LONG *data"
69.Fa "const BF_KEY *key"
70.Fc
71.Sh DESCRIPTION
72This library implements the Blowfish cipher,
73which was invented and described by
74.An Counterpane .
75.Pp
76Blowfish is a block cipher that operates on 64 bit (8 byte) blocks of data.
77It uses a variable size key, but typically, 128 bit (16 byte) keys
78are considered good for strong encryption.
79Blowfish can be used in the same modes as DES (see
80.Xr des_modes 3 ) .
81Blowfish is currently one of the faster block ciphers.
82It is quite a bit faster than DES, and much faster than IDEA or RC2.
83.Pp
84Blowfish consists of a key setup phase
85and the actual encryption or decryption phase.
86.Pp
87.Fn BF_set_key
88sets up the
89.Vt BF_KEY
90.Fa key
91using the
92.Fa len
93bytes long key at
94.Fa data .
95.Pp
96.Fn BF_ecb_encrypt
97is the basic Blowfish encryption and decryption function.
98It encrypts or decrypts the first 64 bits of
99.Fa in
100using the key
101.Fa key ,
102putting the result in
103.Fa out .
104.Fa enc
105decides if encryption
106.Pq Dv BF_ENCRYPT
107or decryption
108.Pq Dv BF_DECRYPT
109shall be performed.
110The vector pointed at by
111.Fa in
112and
113.Fa out
114must be 64 bits in length, no less.
115If they are larger, everything after the first 64 bits is ignored.
116.Pp
117The mode functions
118.Fn BF_cbc_encrypt ,
119.Fn BF_cfb64_encrypt ,
120and
121.Fn BF_ofb64_encrypt
122all operate on variable length data.
123They all take an initialization vector
124.Fa ivec
125which needs to be passed along into the next call of the same function
126for the same message.
127.Fa ivec
128may be initialized with anything, but the recipient needs to know what
129it was initialized with, or it won't be able to decrypt.
130Some programs and protocols simplify this, like SSH, where
131.Fa ivec
132is simply initialized to zero.
133.Fn BF_cbc_encrypt
134operates on data that is a multiple of 8 bytes long, while
135.Fn BF_cfb64_encrypt
136and
137.Fn BF_ofb64_encrypt
138are used to encrypt an variable number of bytes (the amount
139does not have to be an exact multiple of 8).
140The purpose of the latter two is to simulate stream ciphers,
141and therefore, they need the parameter
142.Fa num ,
143which is a pointer to an integer where the current offset in
144.Fa ivec
145is stored between calls.
146This integer must be initialized to zero when
147.Fa ivec
148is initialized.
149.Pp
150.Fn BF_cbc_encrypt
151is the Cipher Block Chaining function for Blowfish.
152It encrypts or decrypts the 64 bits chunks of
153.Fa in
154using the key
155.Fa schedule ,
156putting the result in
157.Fa out .
158.Fa enc
159decides if encryption
160.Pq Dv BF_ENCRYPT
161or decryption
162.Pq Dv BF_DECRYPT
163shall be performed.
164.Fa ivec
165must point at an 8 byte long initialization vector.
166.Pp
167.Fn BF_cfb64_encrypt
168is the CFB mode for Blowfish with 64 bit feedback.
169It encrypts or decrypts the bytes in
170.Fa in
171using the key
172.Fa schedule ,
173putting the result in
174.Fa out .
175.Fa enc
176decides if encryption
177.Pq Dv BF_ENCRYPT
178or decryption
179.Pq Dv BF_DECRYPT
180shall be performed.
181.Fa ivec
182must point at an
1838 byte long initialization vector.
184.Fa num
185must point at an integer which must be initially zero.
186.Pp
187.Fn BF_ofb64_encrypt
188is the OFB mode for Blowfish with 64 bit feedback.
189It uses the same parameters as
190.Fn BF_cfb64_encrypt ,
191which must be initialized the same way.
192.Pp
193.Fn BF_encrypt
194and
195.Fn BF_decrypt
196are the lowest level functions for Blowfish encryption.
197They encrypt/decrypt the first 64 bits of the vector pointed by
198.Fa data ,
199using the key
200.Fa key .
201These functions should not be used unless you implement 'modes' of Blowfish.
202The alternative is to use
203.Fn BF_ecb_encrypt .
204If you still want to use these functions, you should be aware
205that they take each 32-bit chunk in host-byte order,
206which is little-endian on little-endian platforms
207and big-endian on big-endian ones.
208.Sh RETURN VALUES
209None of the functions presented here return any value.
210.Sh NOTE
211Applications should use the higher level functions
212.Xr EVP_EncryptInit 3
213etc. instead of calling the blowfish functions directly.
214.Sh HISTORY
215The Blowfish functions are available in all versions of SSLeay and OpenSSL.
diff --git a/src/lib/libcrypto/man/BIO.3 b/src/lib/libcrypto/man/BIO.3
new file mode 100644
index 0000000000..f352379003
--- /dev/null
+++ b/src/lib/libcrypto/man/BIO.3
@@ -0,0 +1,56 @@
1.Dd July 17, 2014
2.Dt BIO 3
3.Os
4.Sh NAME
5.Nm BIO
6.Nd I/O abstraction
7.Sh SYNOPSIS
8.In openssl/bio.h
9.Sh DESCRIPTION
10A BIO is an I/O abstraction,
11it hides many of the underlying I/O details from an application.
12If an application uses a BIO for its I/O, it can transparently handle
13SSL connections, unencrypted network connections and file I/O.
14.Pp
15There are two types of BIO, a source/sink BIO and a filter BIO.
16.Pp
17As its name implies, a source/sink BIO is a source and/or sink of data,
18examples include a socket BIO and a file BIO.
19.Pp
20A filter BIO takes data from one BIO and passes it through
21to another, or to the application.
22The data may be left unmodified (for example a message digest BIO)
23or translated (for example an encryption BIO).
24The effect of a filter BIO may change according to the I/O operation
25it is performing: for example an encryption BIO will encrypt data
26if it is being written to and decrypt data if it is being read from.
27.Pp
28BIOs can be joined together to form a chain
29(a single BIO is a chain with one component).
30A chain normally consist of one source/sink BIO
31and one or more filter BIOs.
32Data read from or written to the first BIO then traverses the chain
33to the end (normally a source/sink BIO).
34.Sh SEE ALSO
35.Xr BIO_ctrl 3 ,
36.Xr BIO_f_base64 3 ,
37.Xr BIO_f_buffer 3 ,
38.Xr BIO_f_cipher 3 ,
39.Xr BIO_f_md 3 ,
40.Xr BIO_f_null 3 ,
41.Xr BIO_f_ssl 3 ,
42.Xr BIO_find_type 3 ,
43.Xr BIO_new 3 ,
44.Xr BIO_new_bio_pair 3 ,
45.Xr BIO_push 3 ,
46.Xr BIO_read 3 ,
47.Xr BIO_s_accept 3 ,
48.Xr BIO_s_bio 3 ,
49.Xr BIO_s_connect 3 ,
50.Xr BIO_s_fd 3 ,
51.Xr BIO_s_file 3 ,
52.Xr BIO_s_mem 3 ,
53.Xr BIO_s_null 3 ,
54.Xr BIO_s_socket 3 ,
55.Xr BIO_set_callback 3 ,
56.Xr BIO_should_retry 3
diff --git a/src/lib/libcrypto/man/BIO_ctrl.3 b/src/lib/libcrypto/man/BIO_ctrl.3
new file mode 100644
index 0000000000..75d665a4be
--- /dev/null
+++ b/src/lib/libcrypto/man/BIO_ctrl.3
@@ -0,0 +1,264 @@
1.Dd July 17, 2014
2.Dt BIO_CTRL 3
3.Os
4.Sh NAME
5.Nm BIO_ctrl ,
6.Nm BIO_callback_ctrl ,
7.Nm BIO_ptr_ctrl ,
8.Nm BIO_int_ctrl ,
9.Nm BIO_reset ,
10.Nm BIO_seek ,
11.Nm BIO_tell ,
12.Nm BIO_flush ,
13.Nm BIO_eof ,
14.Nm BIO_set_close ,
15.Nm BIO_get_close ,
16.Nm BIO_pending ,
17.Nm BIO_wpending ,
18.Nm BIO_ctrl_pending ,
19.Nm BIO_ctrl_wpending ,
20.Nm BIO_get_info_callback ,
21.Nm BIO_set_info_callback
22.Nd BIO control operations
23.Sh SYNOPSIS
24.In openssl/bio.h
25.Ft long
26.Fo BIO_ctrl
27.Fa "BIO *bp"
28.Fa "int cmd"
29.Fa "long larg"
30.Fa "void *parg"
31.Fc
32.Ft long
33.Fo BIO_callback_ctrl
34.Fa "BIO *b"
35.Fa "int cmd"
36.Fa "void (*fp)(struct bio_st *, int, const char *, int, long, long)"
37.Fc
38.Ft char *
39.Fo BIO_ptr_ctrl
40.Fa "BIO *bp"
41.Fa "int cmd"
42.Fa "long larg"
43.Fc
44.Ft long
45.Fo BIO_int_ctrl
46.Fa "BIO *bp"
47.Fa "int cmd"
48.Fa "long larg"
49.Fa "int iarg"
50.Fc
51.Ft int
52.Fo BIO_reset
53.Fa "BIO *b"
54.Fc
55.Ft int
56.Fo BIO_seek
57.Fa "BIO *b"
58.Fa "int ofs"
59.Fc
60.Ft int
61.Fo BIO_tell
62.Fa "BIO *b"
63.Fc
64.Ft int
65.Fo BIO_flush
66.Fa "BIO *b"
67.Fc
68.Ft int
69.Fo BIO_eof
70.Fa "BIO *b"
71.Fc
72.Ft int
73.Fo BIO_set_close
74.Fa "BIO *b"
75.Fa "long flag"
76.Fc
77.Ft int
78.Fo BIO_get_close
79.Fa "BIO *b"
80.Fc
81.Ft int
82.Fo BIO_pending
83.Fa "BIO *b"
84.Fc
85.Ft int
86.Fo BIO_wpending
87.Fa "BIO *b"
88.Fc
89.Ft size_t
90.Fo BIO_ctrl_pending
91.Fa "BIO *b"
92.Fc
93.Ft size_t
94.Fo BIO_ctrl_wpending
95.Fa "BIO *b"
96.Fc
97.Ft int
98.Fo BIO_get_info_callback
99.Fa "BIO *b"
100.Fa "bio_info_cb **cbp"
101.Fc
102.Ft int
103.Fo BIO_set_info_callback
104.Fa "BIO *b"
105.Fa "bio_info_cb *cb"
106.Fc
107.Ft typedef void
108.Fo bio_info_cb
109.Fa "BIO *b"
110.Fa "int oper"
111.Fa "const char *ptr"
112.Fa "int arg1"
113.Fa "long arg2"
114.Fa "long arg3"
115.Fc
116.Sh DESCRIPTION
117.Fn BIO_ctrl ,
118.Fn BIO_callback_ctrl ,
119.Fn BIO_ptr_ctrl ,
120and
121.Fn BIO_int_ctrl
122are BIO "control" operations taking arguments of various types.
123These functions are not normally called directly,
124various macros are used instead.
125The standard macros are described below, macros specific to a
126particular type of BIO are described in the specific BIO's manual
127page as well as any special features of the standard calls.
128.Pp
129.Fn BIO_reset
130typically resets a BIO to some initial state, in the case
131of file related BIOs for example it rewinds the file pointer
132to the start of the file.
133.Pp
134.Fn BIO_seek
135resets a file related BIO's (that is file descriptor and
136FILE BIOs) file position pointer to
137.Fa ofs
138bytes from start of file.
139.Pp
140.Fn BIO_tell
141returns the current file position of a file related BIO.
142.Pp
143.Fn BIO_flush
144normally writes out any internally buffered data, in some cases
145it is used to signal EOF and that no more data will be written.
146.Pp
147.Fn BIO_eof
148returns 1 if the BIO has read EOF, the precise meaning of
149"EOF" varies according to the BIO type.
150.Pp
151.Fn BIO_set_close
152sets the BIO
153.Fa b
154close flag to
155.Fa flag .
156.Fa flag
157can take the value
158.Dv BIO_CLOSE
159or
160.Dv BIO_NOCLOSE .
161Typically
162.Dv BIO_CLOSE
163is used in a source/sink BIO to indicate that the underlying I/O stream
164should be closed when the BIO is freed.
165.Pp
166.Fn BIO_get_close
167returns the BIO's close flag.
168.Pp
169.Fn BIO_pending ,
170.Fn BIO_ctrl_pending ,
171.Fn BIO_wpending ,
172and
173.Fn BIO_ctrl_wpending
174return the number of pending characters in the BIO's read and write buffers.
175Not all BIOs support these calls.
176.Fn BIO_ctrl_pending
177and
178.Fn BIO_ctrl_wpending
179return a
180.Vt size_t
181type and are functions,
182.Fn BIO_pending
183and
184.Fn BIO_wpending
185are macros which call
186.Fn BIO_ctrl .
187.Sh RETURN VALUES
188.Fn BIO_reset
189normally returns 1 for success and 0 or -1 for failure.
190File BIOs are an exception, they return 0 for success and -1 for failure.
191.Pp
192.Fn BIO_seek
193and
194.Fn BIO_tell
195both return the current file position on success
196and -1 for failure, except file BIOs which for
197.Fn BIO_seek
198always return 0 for success and -1 for failure.
199.Pp
200.Fn BIO_flush
201returns 1 for success and 0 or -1 for failure.
202.Pp
203.Fn BIO_eof
204returns 1 if EOF has been reached 0 otherwise.
205.Pp
206.Fn BIO_set_close
207always returns 1.
208.Pp
209.Fn BIO_get_close
210returns the close flag value
211.Dv BIO_CLOSE
212or
213.Dv BIO_NOCLOSE .
214.Pp
215.Fn BIO_pending ,
216.Fn BIO_ctrl_pending ,
217.Fn BIO_wpending ,
218and
219.Fn BIO_ctrl_wpending
220return the amount of pending data.
221.Sh NOTES
222Because it can write data,
223.Fn BIO_flush
224may return 0 or -1 indicating that the call should be retried later
225in a similar manner to
226.Fn BIO_write .
227The
228.Fn BIO_should_retry
229call should be used and appropriate action taken is the call fails.
230.Pp
231The return values of
232.Fn BIO_pending
233and
234.Fn BIO_wpending
235may not reliably determine the amount of pending data in all cases.
236For example in the case of a file BIO some data may be available in the
237.Vt FILE
238structure's internal buffers but it is not possible
239to determine this in a portably way.
240For other types of BIO they may not be supported.
241.Pp
242If they do not internally handle a particular
243.Fn BIO_ctrl
244operation, filter BIOs usually pass the operation
245to the next BIO in the chain.
246This often means there is no need to locate the required BIO for
247a particular operation, it can be called on a chain and it will
248be automatically passed to the relevant BIO.
249However this can cause unexpected results:
250for example no current filter BIOs implement
251.Fn BIO_seek ,
252but this may still succeed if the chain ends
253in a FILE or file descriptor BIO.
254.Pp
255Source/sink BIOs return an 0 if they do not recognize the
256.Fn BIO_ctrl
257operation.
258.Sh BUGS
259Some of the return values are ambiguous and care should be taken.
260In particular a return value of 0 can be returned if an operation
261is not supported, if an error occurred, if EOF has not been reached
262and in the case of
263.Fn BIO_seek
264on a file BIO for a successful operation.
diff --git a/src/lib/libcrypto/man/BIO_f_base64.3 b/src/lib/libcrypto/man/BIO_f_base64.3
new file mode 100644
index 0000000000..e08191b84a
--- /dev/null
+++ b/src/lib/libcrypto/man/BIO_f_base64.3
@@ -0,0 +1,80 @@
1.Dd July 17, 2014
2.Dt BIO_F_BASE64 3
3.Os
4.Sh NAME
5.Nm BIO_f_base64
6.Nd base64 BIO filter
7.Sh SYNOPSIS
8.In openssl/bio.h
9.In openssl/evp.h
10.Ft BIO_METHOD *
11.Fo BIO_f_base64
12.Fa void
13.Fc
14.Sh DESCRIPTION
15.Fn BIO_f_base64
16returns the base64 BIO method.
17This is a filter BIO that base64 encodes any data written through it
18and decodes any data read through it.
19.Pp
20Base64 BIOs do not support
21.Xr BIO_gets 3
22or
23.Xr BIO_puts 3 .
24.Pp
25.Xr BIO_flush 3
26on a base64 BIO that is being written through
27is used to signal that no more data is to be encoded:
28this is used to flush the final block through the BIO.
29.Pp
30The flag
31.Dv BIO_FLAGS_BASE64_NO_NL
32can be set with
33.Xr BIO_set_flags 3
34to encode the data all on one line
35or expect the data to be all on one line.
36.Sh NOTES
37Because of the format of base64 encoding the end of the encoded
38block cannot always be reliably determined.
39.Sh RETURN VALUES
40.Fn BIO_f_base64
41returns the base64 BIO method.
42.Sh EXAMPLES
43Base64 encode the string "Hello World\en"
44and write the result to standard output:
45.Bd -literal -offset indent
46BIO *bio, *b64;
47char message[] = "Hello World \en";
48
49b64 = BIO_new(BIO_f_base64());
50bio = BIO_new_fp(stdout, BIO_NOCLOSE);
51BIO_push(b64, bio);
52BIO_write(b64, message, strlen(message));
53BIO_flush(b64);
54
55BIO_free_all(b64);
56.Ed
57.Pp
58Read Base64 encoded data from standard input
59and write the decoded data to standard output:
60.Bd -literal -offset indent
61BIO *bio, *b64, *bio_out;
62char inbuf[512];
63int inlen;
64
65b64 = BIO_new(BIO_f_base64());
66bio = BIO_new_fp(stdin, BIO_NOCLOSE);
67bio_out = BIO_new_fp(stdout, BIO_NOCLOSE);
68BIO_push(b64, bio);
69while((inlen = BIO_read(b64, inbuf, 512)) > 0)
70 BIO_write(bio_out, inbuf, inlen);
71
72BIO_flush(bio_out);
73BIO_free_all(b64);
74.Ed
75.Sh BUGS
76The ambiguity of EOF in base64 encoded data can cause additional
77data following the base64 encoded block to be misinterpreted.
78.Pp
79There should be some way of specifying a test that the BIO can perform
80to reliably determine EOF (for example a MIME boundary).
diff --git a/src/lib/libcrypto/man/BIO_f_buffer.3 b/src/lib/libcrypto/man/BIO_f_buffer.3
new file mode 100644
index 0000000000..c01ab4809b
--- /dev/null
+++ b/src/lib/libcrypto/man/BIO_f_buffer.3
@@ -0,0 +1,110 @@
1.Dd July 17, 2014
2.Dt BIO_F_BUFFER 3
3.Os
4.Sh NAME
5.Nm BIO_f_buffer
6.Nd buffering BIO
7.Sh SYNOPSIS
8.In openssl/bio.h
9.Ft BIO_METHOD *
10.Fo BIO_f_buffer
11.Fa void
12.Fc
13.Bd -literal
14#define BIO_get_buffer_num_lines(b) \e
15 BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL)
16#define BIO_set_read_buffer_size(b,size) \e
17 BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0)
18#define BIO_set_write_buffer_size(b,size) \e
19 BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1)
20#define BIO_set_buffer_size(b,size) \e
21 BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL)
22#define BIO_set_buffer_read_data(b,buf,num) \e
23 BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf)
24.Ed
25.Sh DESCRIPTION
26.Fn BIO_f_buffer
27returns the buffering BIO method.
28.Pp
29Data written to a buffering BIO is buffered and periodically written
30to the next BIO in the chain.
31Data read from a buffering BIO comes from an internal buffer
32which is filled from the next BIO in the chain.
33Both
34.Xr BIO_gets 3
35and
36.Xr BIO_puts 3
37are supported.
38.Pp
39Calling
40.Xr BIO_reset 3
41on a buffering BIO clears any buffered data.
42.Pp
43.Fn BIO_get_buffer_num_lines
44returns the number of lines currently buffered.
45.Pp
46.Fn BIO_set_read_buffer_size ,
47.Fn BIO_set_write_buffer_size ,
48and
49.Fn BIO_set_buffer_size
50set the read, write or both read and write buffer sizes to
51.Fa size .
52The initial buffer size is
53.Dv DEFAULT_BUFFER_SIZE ,
54currently 4096.
55Any attempt to reduce the buffer size below
56.Dv DEFAULT_BUFFER_SIZE
57is ignored.
58Any buffered data is cleared when the buffer is resized.
59.Pp
60.Fn BIO_set_buffer_read_data
61clears the read buffer and fills it with
62.Fa num
63bytes of
64.Fa buf .
65If
66.Fa num
67is larger than the current buffer size the buffer is expanded.
68.Sh NOTES
69Buffering BIOs implement
70.Xr BIO_gets 3
71by using
72.Xr BIO_read 3
73operations on the next BIO in the chain.
74By prepending a buffering BIO to a chain
75it is therefore possible to provide
76.Xr BIO_gets 3
77functionality if the following BIOs do not support it (for example SSL BIOs).
78.Pp
79Data is only written to the next BIO in the chain
80when the write buffer fills or when
81.Xr BIO_flush 3
82is called.
83It is therefore important to call
84.Xr BIO_flush 3
85whenever any pending data should be written
86such as when removing a buffering BIO using
87.Xr BIO_pop 3 .
88.Xr BIO_flush 3
89may need to be retried if the ultimate source/sink BIO is non blocking.
90.Sh RETURN VALUES
91.Fn BIO_f_buffer
92returns the buffering BIO method.
93.Pp
94.Fn BIO_get_buffer_num_lines
95returns the number of lines buffered (may be 0).
96.Pp
97.Fn BIO_set_read_buffer_size ,
98.Fn BIO_set_write_buffer_size ,
99and
100.Fn BIO_set_buffer_size
101return 1 if the buffer was successfully resized or 0 for failure.
102.Pp
103.Fn BIO_set_buffer_read_data
104returns 1 if the data was set correctly or 0 if there was an error.
105.Sh SEE ALSO
106.Xr BIO 3 ,
107.Xr BIO_ctrl 3 ,
108.Xr BIO_flush 3 ,
109.Xr BIO_pop 3 ,
110.Xr BIO_reset 3
diff --git a/src/lib/libcrypto/man/BIO_f_cipher.3 b/src/lib/libcrypto/man/BIO_f_cipher.3
new file mode 100644
index 0000000000..68f425eb75
--- /dev/null
+++ b/src/lib/libcrypto/man/BIO_f_cipher.3
@@ -0,0 +1,114 @@
1.Dd July 17, 2014
2.Dt BIO_F_CIPHER 3
3.Os
4.Sh NAME
5.Nm BIO_f_cipher ,
6.Nm BIO_set_cipher ,
7.Nm BIO_get_cipher_status ,
8.Nm BIO_get_cipher_ctx
9.Nd cipher BIO filter
10.Sh SYNOPSIS
11.In openssl/bio.h
12.In openssl/evp.h
13.Ft BIO_METHOD *
14.Fo BIO_f_cipher
15.Fa void
16.Fc
17.Ft void
18.Fo BIO_set_cipher
19.Fa "BIO *b"
20.Fa "const EVP_CIPHER *cipher"
21.Fa "unsigned char *key"
22.Fa "unsigned char *iv"
23.Fa "int enc"
24.Fc
25.Ft int
26.Fo BIO_get_cipher_status
27.Fa "BIO *b"
28.Fc
29.Ft int
30.Fo BIO_get_cipher_ctx
31.Fa "BIO *b"
32.Fa "EVP_CIPHER_CTX **pctx"
33.Fc
34.Sh DESCRIPTION
35.Fn BIO_f_cipher
36returns the cipher BIO method.
37This is a filter BIO that encrypts any data written through it,
38and decrypts any data read from it.
39It is a BIO wrapper for the cipher routines
40.Xr EVP_CipherInit 3 ,
41.Xr EVP_CipherUpdate 3 ,
42and
43.Xr EVP_CipherFinal 3 .
44.Pp
45Cipher BIOs do not support
46.Xr BIO_gets 3
47or
48.Xr BIO_puts 3 .
49.Pp
50.Xr BIO_flush 3
51on an encryption BIO that is being written through
52is used to signal that no more data is to be encrypted:
53this is used to flush and possibly pad the final block through the BIO.
54.Pp
55.Fn BIO_set_cipher
56sets the cipher of BIO
57.Fa b
58to
59.Fa cipher
60using key
61.Fa key
62and IV
63.Fa iv .
64.Fa enc
65should be set to 1 for encryption and zero for decryption.
66.Pp
67When reading from an encryption BIO, the final block is automatically
68decrypted and checked when EOF is detected.
69.Fn BIO_get_cipher_status
70is a
71.Xr BIO_ctrl 3
72macro which can be called to determine
73whether the decryption operation was successful.
74.Pp
75.Fn BIO_get_cipher_ctx
76is a
77.Xr BIO_ctrl 3
78macro which retrieves the internal BIO cipher context.
79The retrieved context can be used in conjunction
80with the standard cipher routines to set it up.
81This is useful when
82.Fn BIO_set_cipher
83is not flexible enough for the applications needs.
84.Sh NOTES
85When encrypting,
86.Xr BIO_flush 3
87must be called to flush the final block through the BIO.
88If it is not, then the final block will fail a subsequent decrypt.
89.Pp
90When decrypting, an error on the final block is signalled
91by a zero return value from the read operation.
92A successful decrypt followed by EOF
93will also return zero for the final read.
94.Fn BIO_get_cipher_status
95should be called to determine if the decrypt was successful.
96.Pp
97As always, if
98.Xr BIO_gets 3
99or
100.Xr BIO_puts 3
101support is needed, then it can be achieved
102by preceding the cipher BIO with a buffering BIO.
103.Sh RETURN VALUES
104.Fn BIO_f_cipher
105returns the cipher BIO method.
106.Pp
107.Fn BIO_set_cipher
108does not return a value.
109.Pp
110.Fn BIO_get_cipher_status
111returns 1 for a successful decrypt and 0 for failure.
112.Pp
113.Fn BIO_get_cipher_ctx
114currently always returns 1.
diff --git a/src/lib/libcrypto/man/BIO_f_md.3 b/src/lib/libcrypto/man/BIO_f_md.3
new file mode 100644
index 0000000000..de21722608
--- /dev/null
+++ b/src/lib/libcrypto/man/BIO_f_md.3
@@ -0,0 +1,209 @@
1.Dd July 17, 2014
2.Dt BIO_F_MD 3
3.Os
4.Sh NAME
5.Nm BIO_f_md ,
6.Nm BIO_set_md ,
7.Nm BIO_get_md ,
8.Nm BIO_get_md_ctx
9.Nd message digest BIO filter
10.Sh SYNOPSIS
11.In openssl/bio.h
12.In openssl/evp.h
13.Ft BIO_METHOD *
14.Fo BIO_f_md
15.Fa void
16.Fc
17.Ft int
18.Fo BIO_set_md
19.Fa "BIO *b"
20.Fa "EVP_MD *md"
21.Fc
22.Ft int
23.Fo BIO_get_md
24.Fa "BIO *b"
25.Fa "EVP_MD **mdp"
26.Fc
27.Ft int
28.Fo BIO_get_md_ctx
29.Fa "BIO *b"
30.Fa "EVP_MD_CTX **mdcp"
31.Fc
32.Sh DESCRIPTION
33.Fn BIO_f_md
34returns the message digest BIO method.
35This is a filter BIO that digests any data passed through it.
36It is a BIO wrapper for the digest routines
37.Fn EVP_DigestInit ,
38.Fn EVP_DigestUpdate ,
39and
40.Fn EVP_DigestFinal .
41.Pp
42Any data written or read through a digest BIO using
43.Xr BIO_read 3
44and
45.Xr BIO_write 3
46is digested.
47.Pp
48.Xr BIO_gets 3 ,
49if its
50.Sy size
51parameter is large enough,
52finishes the digest calculation and returns the digest value.
53.Xr BIO_puts 3
54is
55not supported.
56.Pp
57.Xr BIO_reset 3
58reinitialises a digest BIO.
59.Pp
60.Fn BIO_set_md
61sets the message digest of BIO
62.Fa b
63to
64.Fa md :
65this must be called to initialize a digest BIO
66before any data is passed through it.
67It is a
68.Xr BIO_ctrl 3
69macro.
70.Pp
71.Fn BIO_get_md
72places the a pointer to the digest BIOs digest method in
73.Fa mdp .
74It is a
75.Xr BIO_ctrl 3
76macro.
77.Pp
78.Fn BIO_get_md_ctx
79returns the digest BIOs context in
80.Fa mdcp .
81.Sh NOTES
82The context returned by
83.Fn BIO_get_md_ctx
84can be used in calls to
85.Xr EVP_DigestFinal 3
86and also in the signature routines
87.Xr EVP_SignFinal 3
88and
89.Xr EVP_VerifyFinal 3 .
90.Pp
91The context returned by
92.Fn BIO_get_md_ctx
93is an internal context structure.
94Changes made to this context will affect the digest BIO itself, and
95the context pointer will become invalid when the digest BIO is freed.
96.Pp
97After the digest has been retrieved from a digest BIO,
98it must be reinitialized by calling
99.Xr BIO_reset 3
100or
101.Fn BIO_set_md
102before any more data is passed through it.
103.Pp
104If an application needs to call
105.Xr BIO_gets 3
106or
107.Xr BIO_puts 3
108through a chain containing digest BIOs,
109then this can be done by prepending a buffering BIO.
110.Pp
111Before OpenSSL 1.0.0 the call to
112.Fn BIO_get_md_ctx
113would only work if the BIO had been initialized for example by calling
114.Fn BIO_set_md .
115In OpenSSL 1.0.0 and later the context is always returned
116and the BIO is state is set to initialized.
117This allows applications to initialize the context externally
118if the standard calls such as
119.Fn BIO_set_md
120are not sufficiently flexible.
121.Sh RETURN VALUES
122.Fn BIO_f_md
123returns the digest BIO method.
124.Pp
125.Fn BIO_set_md ,
126.Fn BIO_get_md ,
127and
128.Fn BIO_get_md_ctx
129return 1 for success and 0 for failure.
130.Sh EXAMPLES
131The following example creates a BIO chain containing an SHA1 and MD5
132digest BIO and passes the string "Hello World" through it.
133Error checking has been omitted for clarity.
134.Bd -literal -offset 2n
135BIO *bio, *mdtmp;
136const char message[] = "Hello World";
137bio = BIO_new(BIO_s_null());
138mdtmp = BIO_new(BIO_f_md());
139BIO_set_md(mdtmp, EVP_sha1());
140/*
141 * For BIO_push() we want to append the sink BIO
142 * and keep a note of the start of the chain.
143 */
144bio = BIO_push(mdtmp, bio);
145mdtmp = BIO_new(BIO_f_md());
146BIO_set_md(mdtmp, EVP_md5());
147bio = BIO_push(mdtmp, bio);
148/* Note: mdtmp can now be discarded */
149BIO_write(bio, message, strlen(message));
150.Ed
151.Pp
152The next example digests data by reading through a chain instead:
153.Bd -literal -offset 2n
154BIO *bio, *mdtmp;
155char buf[1024];
156int rdlen;
157
158bio = BIO_new_file(file, "rb");
159mdtmp = BIO_new(BIO_f_md());
160BIO_set_md(mdtmp, EVP_sha1());
161bio = BIO_push(mdtmp, bio);
162mdtmp = BIO_new(BIO_f_md());
163BIO_set_md(mdtmp, EVP_md5());
164bio = BIO_push(mdtmp, bio);
165do {
166 rdlen = BIO_read(bio, buf, sizeof(buf));
167 /* Might want to do something with the data here */
168} while (rdlen > 0);
169.Ed
170.Pp
171This next example retrieves the message digests from a BIO chain
172and outputs them.
173This could be used with the examples above.
174.Bd -literal -offset 2n
175BIO *mdtmp;
176unsigned char mdbuf[EVP_MAX_MD_SIZE];
177int mdlen;
178int i;
179
180mdtmp = bio; /* Assume bio has previously been set up */
181do {
182 EVP_MD *md;
183 mdtmp = BIO_find_type(mdtmp, BIO_TYPE_MD);
184 if (!mdtmp)
185 break;
186 BIO_get_md(mdtmp, &md);
187 printf("%s digest", OBJ_nid2sn(EVP_MD_type(md)));
188 mdlen = BIO_gets(mdtmp, mdbuf, EVP_MAX_MD_SIZE);
189 for(i = 0; i < mdlen; i++)
190 printf(":%02X", mdbuf[i]);
191 printf("\en");
192 mdtmp = BIO_next(mdtmp);
193} while(mdtmp);
194BIO_free_all(bio);
195.Ed
196.Sh BUGS
197The lack of support for
198.Xr BIO_puts 3
199and the non standard behaviour of
200.Xr BIO_gets 3
201could be regarded as anomalous.
202It could be argued that
203.Xr BIO_gets 3
204and
205.Xr BIO_puts 3
206should be passed to the next BIO in the chain and digest the data
207passed through and that digests should be retrieved using a separate
208.Xr BIO_ctrl 3
209call.
diff --git a/src/lib/libcrypto/man/BIO_f_null.3 b/src/lib/libcrypto/man/BIO_f_null.3
new file mode 100644
index 0000000000..a09cc77631
--- /dev/null
+++ b/src/lib/libcrypto/man/BIO_f_null.3
@@ -0,0 +1,25 @@
1.Dd July 17, 2014
2.Dt BIO_F_NULL 3
3.Os
4.Sh NAME
5.Nm BIO_f_null
6.Nd null filter
7.Sh SYNOPSIS
8.In openssl/bio.h
9.Ft BIO_METHOD *
10.Fo BIO_f_null
11.Fa void
12.Fc
13.Sh DESCRIPTION
14.Fn BIO_f_null
15returns the null filter BIO method.
16This is a filter BIO that does nothing.
17.Pp
18All requests to a null filter BIO are passed through to the next BIO
19in the chain: this means that a BIO chain containing a null filter BIO
20behaves just as though the BIO was not there.
21.Sh NOTES
22As may be apparent, a null filter BIO is not particularly useful.
23.Sh RETURN VALUES
24.Fn BIO_f_null
25returns the null filter BIO method.
diff --git a/src/lib/libcrypto/man/BIO_find_type.3 b/src/lib/libcrypto/man/BIO_find_type.3
new file mode 100644
index 0000000000..f573ad7675
--- /dev/null
+++ b/src/lib/libcrypto/man/BIO_find_type.3
@@ -0,0 +1,117 @@
1.Dd July 17, 2014
2.Dt BIO_FIND_TYPE 3
3.Os
4.Sh NAME
5.Nm BIO_find_type ,
6.Nm BIO_next ,
7.Nm BIO_method_type
8.Nd BIO chain traversal
9.Sh SYNOPSIS
10.In openssl/bio.h
11.Ft BIO *
12.Fo BIO_find_type
13.Fa "BIO *b"
14.Fa "int bio_type"
15.Fc
16.Ft BIO *
17.Fo BIO_next
18.Fa "BIO *b"
19.Fc
20.Fd #define BIO_method_type(b) ((b)->method->type)
21.Fd #define BIO_TYPE_NONE 0
22.Fd #define BIO_TYPE_MEM (1|0x0400)
23.Fd #define BIO_TYPE_FILE (2|0x0400)
24.Fd #define BIO_TYPE_FD (4|0x0400|0x0100)
25.Fd #define BIO_TYPE_SOCKET (5|0x0400|0x0100)
26.Fd #define BIO_TYPE_NULL (6|0x0400)
27.Fd #define BIO_TYPE_SSL (7|0x0200)
28.Fd #define BIO_TYPE_MD (8|0x0200)
29.Fd #define BIO_TYPE_BUFFER (9|0x0200)
30.Fd #define BIO_TYPE_CIPHER (10|0x0200)
31.Fd #define BIO_TYPE_BASE64 (11|0x0200)
32.Fd #define BIO_TYPE_CONNECT (12|0x0400|0x0100)
33.Fd #define BIO_TYPE_ACCEPT (13|0x0400|0x0100)
34.Fd #define BIO_TYPE_PROXY_CLIENT (14|0x0200)
35.Fd #define BIO_TYPE_PROXY_SERVER (15|0x0200)
36.Fd #define BIO_TYPE_NBIO_TEST (16|0x0200)
37.Fd #define BIO_TYPE_NULL_FILTER (17|0x0200)
38.Fd #define BIO_TYPE_BER (18|0x0200)
39.Fd #define BIO_TYPE_BIO (19|0x0400)
40.Fd #define BIO_TYPE_DESCRIPTOR 0x0100
41.Fd #define BIO_TYPE_FILTER 0x0200
42.Fd #define BIO_TYPE_SOURCE_SINK 0x0400
43.Sh DESCRIPTION
44The function
45.Fn BIO_find_type
46searches for a BIO of a given type in a chain, starting at BIO
47.Fa b .
48If
49.Fa bio_type
50is a specific type (such as
51.Dv BIO_TYPE_MEM ) ,
52then a search is made for a BIO of that type.
53If
54.Fa bio_type
55is a general type (such as
56.Dv BIO_TYPE_SOURCE_SINK ) ,
57then the next matching BIO of the given general type is searched for.
58.Fn BIO_find_type
59returns the next matching BIO or
60.Dv NULL
61if none is found.
62.Pp
63Note: not all the
64.Dv BIO_TYPE_*
65types above have corresponding BIO implementations.
66.Pp
67.Fn BIO_next
68returns the next BIO in a chain.
69It can be used to traverse all BIOs in a chain or used in conjunction with
70.Fn BIO_find_type
71to find all BIOs of a certain type.
72.Pp
73.Fn BIO_method_type
74returns the type of a BIO.
75.Sh RETURN VALUES
76.Fn BIO_find_type
77returns a matching BIO or
78.Dv NULL
79for no match.
80.Pp
81.Fn BIO_next
82returns the next BIO in a chain.
83.Pp
84.Fn BIO_method_type
85returns the type of the BIO
86.Fa b .
87.Sh NOTES
88.Fn BIO_next
89was added to OpenSSL 0.9.6 to provide a 'clean' way to traverse a BIO
90chain or find multiple matches using
91.Fn BIO_find_type .
92Previous versions had to use:
93.Pp
94.Dl next = bio->next_bio;
95.Sh BUGS
96.Fn BIO_find_type
97in OpenSSL 0.9.5a and earlier could not be safely passed a
98.Dv NULL
99pointer for the
100.Fa b
101argument.
102.Sh EXAMPLE
103Traverse a chain looking for digest BIOs:
104.Bd -literal -offset 2n
105BIO *btmp;
106btmp = in_bio; /* in_bio is chain to search through */
107
108do {
109 btmp = BIO_find_type(btmp, BIO_TYPE_MD);
110 if (btmp == NULL)
111 break; /* Not found */
112 /* btmp is a digest BIO, do something with it ...*/
113 ...
114
115 btmp = BIO_next(btmp);
116} while(btmp);
117.Ed
diff --git a/src/lib/libcrypto/man/BIO_new.3 b/src/lib/libcrypto/man/BIO_new.3
new file mode 100644
index 0000000000..5f5030cdfa
--- /dev/null
+++ b/src/lib/libcrypto/man/BIO_new.3
@@ -0,0 +1,104 @@
1.Dd July 17, 2014
2.Dt BIO_NEW 3
3.Os
4.Sh NAME
5.Nm BIO_new ,
6.Nm BIO_set ,
7.Nm BIO_free ,
8.Nm BIO_vfree ,
9.Nm BIO_free_all
10.Nd BIO allocation and freeing functions
11.Sh SYNOPSIS
12.In openssl/bio.h
13.Ft BIO *
14.Fo BIO_new
15.Fa "BIO_METHOD *type"
16.Fc
17.Ft int
18.Fo BIO_set
19.Fa "BIO *a"
20.Fa "BIO_METHOD *type"
21.Fc
22.Ft int
23.Fo BIO_free
24.Fa "BIO *a"
25.Fc
26.Ft void
27.Fo BIO_vfree
28.Fa "BIO *a"
29.Fc
30.Ft void
31.Fo BIO_free_all
32.Fa "BIO *a"
33.Fc
34.Sh DESCRIPTION
35The
36.Fn BIO_new
37function returns a new BIO using method
38.Fa type .
39.Pp
40.Fn BIO_set
41sets the method of an already existing BIO.
42.Pp
43.Fn BIO_free
44frees up a single BIO,
45.Fn BIO_vfree
46also frees up a single BIO, but it does not return a value.
47Calling
48.Fn BIO_free
49may also have some effect on the underlying I/O structure,
50for example it may close the file being
51referred to under certain circumstances.
52For more details see the individual
53.Vt BIO_METHOD
54descriptions.
55.Pp
56.Fn BIO_free_all
57frees up an entire BIO chain.
58It does not halt if an error occurs
59freeing up an individual BIO in the chain.
60.Sh RETURN VALUES
61.Fn BIO_new
62returns a newly created BIO or
63.Dv NULL
64if the call fails.
65.Pp
66.Fn BIO_set
67and
68.Fn BIO_free
69return 1 for success and 0 for failure.
70.Pp
71.Fn BIO_free_all
72and
73.Fn BIO_vfree
74do not return values.
75.Sh NOTES
76Some BIOs (such as memory BIOs) can be used immediately after calling
77.Fn BIO_new .
78Others (such as file BIOs) need some additional initialization, and
79frequently a utility function exists to create and initialize such BIOs.
80.Pp
81If
82.Fn BIO_free
83is called on a BIO chain, it will only free one BIO,
84resulting in a memory leak.
85.Pp
86Calling
87.Fn BIO_free_all
88on a single BIO has the same effect as calling
89.Fn BIO_free
90on it other than the discarded return value.
91.Pp
92Normally the
93.Fa type
94argument is supplied by a function which returns a pointer to a
95.Vt BIO_METHOD .
96There is a naming convention for such functions:
97a source/sink BIO is normally called
98.Fn BIO_s_*
99and a filter BIO
100.Fn BIO_f_* .
101.Sh EXAMPLES
102Create a memory BIO:
103.Pp
104.Dl BIO *mem = BIO_new(BIO_s_mem());
diff --git a/src/lib/libcrypto/man/BIO_new_CMS.3 b/src/lib/libcrypto/man/BIO_new_CMS.3
new file mode 100644
index 0000000000..59c20347e5
--- /dev/null
+++ b/src/lib/libcrypto/man/BIO_new_CMS.3
@@ -0,0 +1,83 @@
1.Dd October 2, 2010
2.Dt BIO_NEW_CMS 3
3.Os
4.Sh NAME
5.Nm BIO_new_CMS
6.Nd CMS streaming filter BIO
7.Sh SYNOPSIS
8.In openssl/cms.h
9.Ft BIO *
10.Fo BIO_new_CMS
11.Fa "BIO *out"
12.Fa "CMS_ContentInfo *cms"
13.Fc
14.Sh DESCRIPTION
15.Fn BIO_new_CMS
16returns a streaming filter BIO chain based on
17.Fa cms .
18The output of the filter is written to
19.Fa out .
20Any data written to the chain is automatically translated
21to a BER format CMS structure of the appropriate type.
22.Sh RETURN VALUES
23.Fn BIO_new_CMS
24returns a BIO chain when successful or
25.Dv NULL
26if an error occurred.
27The error can be obtained from
28.Xr ERR_get_error 3 .
29.Sh NOTES
30The chain returned by this function behaves like a standard filter BIO.
31It supports non blocking I/O.
32Content is processed and streamed on the fly and not all held in memory
33at once: so it is possible to encode very large structures.
34After all content has been written through the chain
35.Xr BIO_flush 3
36must be called to finalise the structure.
37.Pp
38The
39.Dv CMS_STREAM
40flag must be included in the corresponding
41.Fa flags
42parameter of the
43.Fa cms
44creation function.
45.Pp
46If an application wishes to write additional data to
47.Fa out ,
48BIOs should be removed from the chain using
49.Xr BIO_pop 3
50and freed with
51.Xr BIO_free 3
52until
53.Fa out
54is reached.
55If no additional data needs to be written,
56.Xr BIO_free_all 3
57can be called to free up the whole chain.
58.Pp
59Any content written through the filter is used verbatim:
60no canonical translation is performed.
61.Pp
62It is possible to chain multiple BIOs to, for example,
63create a triple wrapped signed, enveloped, signed structure.
64In this case it is the application's responsibility
65to set the inner content type of any outer
66.Vt CMS_ContentInfo
67structures.
68.Pp
69Large numbers of small writes through the chain should be avoided as this
70will produce an output consisting of lots of OCTET STRING structures.
71Prepending a
72.Xr BIO_f_buffer 3
73buffering BIO will prevent this.
74.Sh SEE ALSO
75.Xr CMS_encrypt 3 ,
76.Xr CMS_sign 3 ,
77.Xr ERR_get_error 3
78.Sh HISTORY
79.Fn BIO_new_CMS
80was added to OpenSSL 1.0.0.
81.Sh BUGS
82There is currently no corresponding inverse BIO
83which can decode a CMS structure on the fly.
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile
index 5edbf7e394..fcf9416248 100644
--- a/src/lib/libcrypto/man/Makefile
+++ b/src/lib/libcrypto/man/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.16 2015/02/14 13:54:59 schwarze Exp $ 1# $OpenBSD: Makefile,v 1.17 2015/02/14 14:09:01 schwarze Exp $
2 2
3.include <bsd.own.mk> # for NOMAN 3.include <bsd.own.mk> # for NOMAN
4 4
@@ -10,9 +10,7 @@ MAN= \
10 ASN1_STRING_length.3 \ 10 ASN1_STRING_length.3 \
11 ASN1_STRING_new.3 \ 11 ASN1_STRING_new.3 \
12 ASN1_STRING_print_ex.3 \ 12 ASN1_STRING_print_ex.3 \
13 ASN1_generate_nconf.3 13 ASN1_generate_nconf.3 \
14
15GENMAN= \
16 BF_set_key.3 \ 14 BF_set_key.3 \
17 BIO.3 \ 15 BIO.3 \
18 BIO_ctrl.3 \ 16 BIO_ctrl.3 \
@@ -23,6 +21,8 @@ GENMAN= \
23 BIO_f_null.3 \ 21 BIO_f_null.3 \
24 BIO_find_type.3 \ 22 BIO_find_type.3 \
25 BIO_new.3 \ 23 BIO_new.3 \
24
25GENMAN= \
26 BIO_push.3 \ 26 BIO_push.3 \
27 BIO_read.3 \ 27 BIO_read.3 \
28 BIO_s_accept.3 \ 28 BIO_s_accept.3 \
diff --git a/src/lib/libssl/src/doc/crypto/BF_set_key.pod b/src/lib/libssl/src/doc/crypto/BF_set_key.pod
deleted file mode 100644
index 7d2d96fc45..0000000000
--- a/src/lib/libssl/src/doc/crypto/BF_set_key.pod
+++ /dev/null
@@ -1,107 +0,0 @@
1=pod
2
3=head1 NAME
4
5BF_set_key, BF_encrypt, BF_decrypt, BF_ecb_encrypt, BF_cbc_encrypt,
6BF_cfb64_encrypt, BF_ofb64_encrypt, BF_options - Blowfish encryption
7
8=head1 SYNOPSIS
9
10 #include <openssl/blowfish.h>
11
12 void BF_set_key(BF_KEY *key, int len, const unsigned char *data);
13
14 void BF_ecb_encrypt(const unsigned char *in, unsigned char *out,
15 BF_KEY *key, int enc);
16 void BF_cbc_encrypt(const unsigned char *in, unsigned char *out,
17 long length, BF_KEY *schedule, unsigned char *ivec, int enc);
18 void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out,
19 long length, BF_KEY *schedule, unsigned char *ivec, int *num,
20 int enc);
21 void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out,
22 long length, BF_KEY *schedule, unsigned char *ivec, int *num);
23 const char *BF_options(void);
24
25 void BF_encrypt(BF_LONG *data,const BF_KEY *key);
26 void BF_decrypt(BF_LONG *data,const BF_KEY *key);
27
28=head1 DESCRIPTION
29
30This library implements the Blowfish cipher, which was invented and described
31by Counterpane (see http://www.counterpane.com/blowfish.html ).
32
33Blowfish is a block cipher that operates on 64 bit (8 byte) blocks of data.
34It uses a variable size key, but typically, 128 bit (16 byte) keys are
35considered good for strong encryption. Blowfish can be used in the same
36modes as DES (see L<des_modes(7)|des_modes(7)>). Blowfish is currently one
37of the faster block ciphers. It is quite a bit faster than DES, and much
38faster than IDEA or RC2.
39
40Blowfish consists of a key setup phase and the actual encryption or decryption
41phase.
42
43BF_set_key() sets up the B<BF_KEY> B<key> using the B<len> bytes long key
44at B<data>.
45
46BF_ecb_encrypt() is the basic Blowfish encryption and decryption function.
47It encrypts or decrypts the first 64 bits of B<in> using the key B<key>,
48putting the result in B<out>. B<enc> decides if encryption (B<BF_ENCRYPT>)
49or decryption (B<BF_DECRYPT>) shall be performed. The vector pointed at by
50B<in> and B<out> must be 64 bits in length, no less. If they are larger,
51everything after the first 64 bits is ignored.
52
53The mode functions BF_cbc_encrypt(), BF_cfb64_encrypt() and BF_ofb64_encrypt()
54all operate on variable length data. They all take an initialization vector
55B<ivec> which needs to be passed along into the next call of the same function
56for the same message. B<ivec> may be initialized with anything, but the
57recipient needs to know what it was initialized with, or it won't be able
58to decrypt. Some programs and protocols simplify this, like SSH, where
59B<ivec> is simply initialized to zero.
60BF_cbc_encrypt() operates on data that is a multiple of 8 bytes long, while
61BF_cfb64_encrypt() and BF_ofb64_encrypt() are used to encrypt an variable
62number of bytes (the amount does not have to be an exact multiple of 8). The
63purpose of the latter two is to simulate stream ciphers, and therefore, they
64need the parameter B<num>, which is a pointer to an integer where the current
65offset in B<ivec> is stored between calls. This integer must be initialized
66to zero when B<ivec> is initialized.
67
68BF_cbc_encrypt() is the Cipher Block Chaining function for Blowfish. It
69encrypts or decrypts the 64 bits chunks of B<in> using the key B<schedule>,
70putting the result in B<out>. B<enc> decides if encryption (BF_ENCRYPT) or
71decryption (BF_DECRYPT) shall be performed. B<ivec> must point at an 8 byte
72long initialization vector.
73
74BF_cfb64_encrypt() is the CFB mode for Blowfish with 64 bit feedback.
75It encrypts or decrypts the bytes in B<in> using the key B<schedule>,
76putting the result in B<out>. B<enc> decides if encryption (B<BF_ENCRYPT>)
77or decryption (B<BF_DECRYPT>) shall be performed. B<ivec> must point at an
788 byte long initialization vector. B<num> must point at an integer which must
79be initially zero.
80
81BF_ofb64_encrypt() is the OFB mode for Blowfish with 64 bit feedback.
82It uses the same parameters as BF_cfb64_encrypt(), which must be initialized
83the same way.
84
85BF_encrypt() and BF_decrypt() are the lowest level functions for Blowfish
86encryption. They encrypt/decrypt the first 64 bits of the vector pointed by
87B<data>, using the key B<key>. These functions should not be used unless you
88implement 'modes' of Blowfish. The alternative is to use BF_ecb_encrypt().
89If you still want to use these functions, you should be aware that they take
90each 32-bit chunk in host-byte order, which is little-endian on little-endian
91platforms and big-endian on big-endian ones.
92
93=head1 RETURN VALUES
94
95None of the functions presented here return any value.
96
97=head1 NOTE
98
99Applications should use the higher level functions
100L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> etc. instead of calling the
101blowfish functions directly.
102
103=head1 HISTORY
104
105The Blowfish functions are available in all versions of SSLeay and OpenSSL.
106
107=cut
diff --git a/src/lib/libssl/src/doc/crypto/BIO.pod b/src/lib/libssl/src/doc/crypto/BIO.pod
deleted file mode 100644
index f01ced7d8e..0000000000
--- a/src/lib/libssl/src/doc/crypto/BIO.pod
+++ /dev/null
@@ -1,54 +0,0 @@
1=pod
2
3=head1 NAME
4
5bio - I/O abstraction
6
7=head1 SYNOPSIS
8
9 #include <openssl/bio.h>
10
11
12=head1 DESCRIPTION
13
14A BIO is an I/O abstraction, it hides many of the underlying I/O
15details from an application. If an application uses a BIO for its
16I/O it can transparently handle SSL connections, unencrypted network
17connections and file I/O.
18
19There are two type of BIO, a source/sink BIO and a filter BIO.
20
21As its name implies a source/sink BIO is a source and/or sink of data,
22examples include a socket BIO and a file BIO.
23
24A filter BIO takes data from one BIO and passes it through to
25another, or the application. The data may be left unmodified (for
26example a message digest BIO) or translated (for example an
27encryption BIO). The effect of a filter BIO may change according
28to the I/O operation it is performing: for example an encryption
29BIO will encrypt data if it is being written to and decrypt data
30if it is being read from.
31
32BIOs can be joined together to form a chain (a single BIO is a chain
33with one component). A chain normally consist of one source/sink
34BIO and one or more filter BIOs. Data read from or written to the
35first BIO then traverses the chain to the end (normally a source/sink
36BIO).
37
38=head1 SEE ALSO
39
40L<BIO_ctrl(3)|BIO_ctrl(3)>,
41L<BIO_f_base64(3)|BIO_f_base64(3)>, L<BIO_f_buffer(3)|BIO_f_buffer(3)>,
42L<BIO_f_cipher(3)|BIO_f_cipher(3)>, L<BIO_f_md(3)|BIO_f_md(3)>,
43L<BIO_f_null(3)|BIO_f_null(3)>, L<BIO_f_ssl(3)|BIO_f_ssl(3)>,
44L<BIO_find_type(3)|BIO_find_type(3)>, L<BIO_new(3)|BIO_new(3)>,
45L<BIO_new_bio_pair(3)|BIO_new_bio_pair(3)>,
46L<BIO_push(3)|BIO_push(3)>, L<BIO_read(3)|BIO_read(3)>,
47L<BIO_s_accept(3)|BIO_s_accept(3)>, L<BIO_s_bio(3)|BIO_s_bio(3)>,
48L<BIO_s_connect(3)|BIO_s_connect(3)>, L<BIO_s_fd(3)|BIO_s_fd(3)>,
49L<BIO_s_file(3)|BIO_s_file(3)>, L<BIO_s_mem(3)|BIO_s_mem(3)>,
50L<BIO_s_null(3)|BIO_s_null(3)>, L<BIO_s_socket(3)|BIO_s_socket(3)>,
51L<BIO_set_callback(3)|BIO_set_callback(3)>,
52L<BIO_should_retry(3)|BIO_should_retry(3)>
53
54=cut
diff --git a/src/lib/libssl/src/doc/crypto/BIO_ctrl.pod b/src/lib/libssl/src/doc/crypto/BIO_ctrl.pod
deleted file mode 100644
index 2271e52c9e..0000000000
--- a/src/lib/libssl/src/doc/crypto/BIO_ctrl.pod
+++ /dev/null
@@ -1,128 +0,0 @@
1=pod
2
3=head1 NAME
4
5BIO_ctrl, BIO_callback_ctrl, BIO_ptr_ctrl, BIO_int_ctrl, BIO_reset,
6BIO_seek, BIO_tell, BIO_flush, BIO_eof, BIO_set_close, BIO_get_close,
7BIO_pending, BIO_wpending, BIO_ctrl_pending, BIO_ctrl_wpending,
8BIO_get_info_callback, BIO_set_info_callback - BIO control operations
9
10=head1 SYNOPSIS
11
12 #include <openssl/bio.h>
13
14 long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg);
15 long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int,
16 const char *, int, long, long));
17 char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg);
18 long BIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg);
19
20 int BIO_reset(BIO *b);
21 int BIO_seek(BIO *b, int ofs);
22 int BIO_tell(BIO *b);
23 int BIO_flush(BIO *b);
24 int BIO_eof(BIO *b);
25 int BIO_set_close(BIO *b,long flag);
26 int BIO_get_close(BIO *b);
27 int BIO_pending(BIO *b);
28 int BIO_wpending(BIO *b);
29 size_t BIO_ctrl_pending(BIO *b);
30 size_t BIO_ctrl_wpending(BIO *b);
31
32 int BIO_get_info_callback(BIO *b,bio_info_cb **cbp);
33 int BIO_set_info_callback(BIO *b,bio_info_cb *cb);
34
35 typedef void bio_info_cb(BIO *b, int oper, const char *ptr, int arg1,
36 long arg2, long arg3);
37
38=head1 DESCRIPTION
39
40BIO_ctrl(), BIO_callback_ctrl(), BIO_ptr_ctrl() and BIO_int_ctrl()
41are BIO "control" operations taking arguments of various types.
42These functions are not normally called directly, various macros
43are used instead. The standard macros are described below, macros
44specific to a particular type of BIO are described in the specific
45BIOs manual page as well as any special features of the standard
46calls.
47
48BIO_reset() typically resets a BIO to some initial state, in the case
49of file related BIOs for example it rewinds the file pointer to the
50start of the file.
51
52BIO_seek() resets a file related BIO's (that is file descriptor and
53FILE BIOs) file position pointer to B<ofs> bytes from start of file.
54
55BIO_tell() returns the current file position of a file related BIO.
56
57BIO_flush() normally writes out any internally buffered data, in some
58cases it is used to signal EOF and that no more data will be written.
59
60BIO_eof() returns 1 if the BIO has read EOF, the precise meaning of
61"EOF" varies according to the BIO type.
62
63BIO_set_close() sets the BIO B<b> close flag to B<flag>. B<flag> can
64take the value BIO_CLOSE or BIO_NOCLOSE. Typically BIO_CLOSE is used
65in a source/sink BIO to indicate that the underlying I/O stream should
66be closed when the BIO is freed.
67
68BIO_get_close() returns the BIOs close flag.
69
70BIO_pending(), BIO_ctrl_pending(), BIO_wpending() and BIO_ctrl_wpending()
71return the number of pending characters in the BIOs read and write buffers.
72Not all BIOs support these calls. BIO_ctrl_pending() and BIO_ctrl_wpending()
73return a size_t type and are functions, BIO_pending() and BIO_wpending() are
74macros which call BIO_ctrl().
75
76=head1 RETURN VALUES
77
78BIO_reset() normally returns 1 for success and 0 or -1 for failure. File
79BIOs are an exception, they return 0 for success and -1 for failure.
80
81BIO_seek() and BIO_tell() both return the current file position on success
82and -1 for failure, except file BIOs which for BIO_seek() always return 0
83for success and -1 for failure.
84
85BIO_flush() returns 1 for success and 0 or -1 for failure.
86
87BIO_eof() returns 1 if EOF has been reached 0 otherwise.
88
89BIO_set_close() always returns 1.
90
91BIO_get_close() returns the close flag value: BIO_CLOSE or BIO_NOCLOSE.
92
93BIO_pending(), BIO_ctrl_pending(), BIO_wpending() and BIO_ctrl_wpending()
94return the amount of pending data.
95
96=head1 NOTES
97
98BIO_flush(), because it can write data may return 0 or -1 indicating
99that the call should be retried later in a similar manner to BIO_write().
100The BIO_should_retry() call should be used and appropriate action taken
101is the call fails.
102
103The return values of BIO_pending() and BIO_wpending() may not reliably
104determine the amount of pending data in all cases. For example in the
105case of a file BIO some data may be available in the FILE structures
106internal buffers but it is not possible to determine this in a
107portably way. For other types of BIO they may not be supported.
108
109Filter BIOs if they do not internally handle a particular BIO_ctrl()
110operation usually pass the operation to the next BIO in the chain.
111This often means there is no need to locate the required BIO for
112a particular operation, it can be called on a chain and it will
113be automatically passed to the relevant BIO. However this can cause
114unexpected results: for example no current filter BIOs implement
115BIO_seek(), but this may still succeed if the chain ends in a FILE
116or file descriptor BIO.
117
118Source/sink BIOs return an 0 if they do not recognize the BIO_ctrl()
119operation.
120
121=head1 BUGS
122
123Some of the return values are ambiguous and care should be taken. In
124particular a return value of 0 can be returned if an operation is not
125supported, if an error occurred, if EOF has not been reached and in
126the case of BIO_seek() on a file BIO for a successful operation.
127
128=cut
diff --git a/src/lib/libssl/src/doc/crypto/BIO_f_base64.pod b/src/lib/libssl/src/doc/crypto/BIO_f_base64.pod
deleted file mode 100644
index c1c3137d5e..0000000000
--- a/src/lib/libssl/src/doc/crypto/BIO_f_base64.pod
+++ /dev/null
@@ -1,80 +0,0 @@
1=pod
2
3=head1 NAME
4
5BIO_f_base64 - base64 BIO filter
6
7=head1 SYNOPSIS
8
9 #include <openssl/bio.h>
10 #include <openssl/evp.h>
11
12 BIO_METHOD * BIO_f_base64(void);
13
14=head1 DESCRIPTION
15
16BIO_f_base64() returns the base64 BIO method. This is a filter
17BIO that base64 encodes any data written through it and decodes
18any data read through it.
19
20Base64 BIOs do not support BIO_gets() or BIO_puts().
21
22BIO_flush() on a base64 BIO that is being written through is
23used to signal that no more data is to be encoded: this is used
24to flush the final block through the BIO.
25
26The flag BIO_FLAGS_BASE64_NO_NL can be set with BIO_set_flags()
27to encode the data all on one line or expect the data to be all
28on one line.
29
30=head1 NOTES
31
32Because of the format of base64 encoding the end of the encoded
33block cannot always be reliably determined.
34
35=head1 RETURN VALUES
36
37BIO_f_base64() returns the base64 BIO method.
38
39=head1 EXAMPLES
40
41Base64 encode the string "Hello World\n" and write the result
42to standard output:
43
44 BIO *bio, *b64;
45 char message[] = "Hello World \n";
46
47 b64 = BIO_new(BIO_f_base64());
48 bio = BIO_new_fp(stdout, BIO_NOCLOSE);
49 BIO_push(b64, bio);
50 BIO_write(b64, message, strlen(message));
51 BIO_flush(b64);
52
53 BIO_free_all(b64);
54
55Read Base64 encoded data from standard input and write the decoded
56data to standard output:
57
58 BIO *bio, *b64, *bio_out;
59 char inbuf[512];
60 int inlen;
61
62 b64 = BIO_new(BIO_f_base64());
63 bio = BIO_new_fp(stdin, BIO_NOCLOSE);
64 bio_out = BIO_new_fp(stdout, BIO_NOCLOSE);
65 BIO_push(b64, bio);
66 while((inlen = BIO_read(b64, inbuf, 512)) > 0)
67 BIO_write(bio_out, inbuf, inlen);
68
69 BIO_flush(bio_out);
70 BIO_free_all(b64);
71
72=head1 BUGS
73
74The ambiguity of EOF in base64 encoded data can cause additional
75data following the base64 encoded block to be misinterpreted.
76
77There should be some way of specifying a test that the BIO can perform
78to reliably determine EOF (for example a MIME boundary).
79
80=cut
diff --git a/src/lib/libssl/src/doc/crypto/BIO_f_buffer.pod b/src/lib/libssl/src/doc/crypto/BIO_f_buffer.pod
deleted file mode 100644
index f4ddd3a2cf..0000000000
--- a/src/lib/libssl/src/doc/crypto/BIO_f_buffer.pod
+++ /dev/null
@@ -1,77 +0,0 @@
1=pod
2
3=head1 NAME
4
5BIO_f_buffer - buffering BIO
6
7=head1 SYNOPSIS
8
9 #include <openssl/bio.h>
10
11 BIO_METHOD * BIO_f_buffer(void);
12
13 #define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL)
14 #define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0)
15 #define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1)
16 #define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL)
17 #define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf)
18
19=head1 DESCRIPTION
20
21BIO_f_buffer() returns the buffering BIO method.
22
23Data written to a buffering BIO is buffered and periodically written
24to the next BIO in the chain. Data read from a buffering BIO comes from
25an internal buffer which is filled from the next BIO in the chain.
26Both BIO_gets() and BIO_puts() are supported.
27
28Calling BIO_reset() on a buffering BIO clears any buffered data.
29
30BIO_get_buffer_num_lines() returns the number of lines currently buffered.
31
32BIO_set_read_buffer_size(), BIO_set_write_buffer_size() and
33BIO_set_buffer_size() set the read, write or both read and write buffer sizes
34to B<size>. The initial buffer size is DEFAULT_BUFFER_SIZE, currently 4096. Any
35attempt to reduce the buffer size below DEFAULT_BUFFER_SIZE is ignored. Any
36buffered data is cleared when the buffer is resized.
37
38BIO_set_buffer_read_data() clears the read buffer and fills it with B<num>
39bytes of B<buf>. If B<num> is larger than the current buffer size the buffer
40is expanded.
41
42=head1 NOTES
43
44Buffering BIOs implement BIO_gets() by using BIO_read() operations on the
45next BIO in the chain. By prepending a buffering BIO to a chain it is therefore
46possible to provide BIO_gets() functionality if the following BIOs do not
47support it (for example SSL BIOs).
48
49Data is only written to the next BIO in the chain when the write buffer fills
50or when BIO_flush() is called. It is therefore important to call BIO_flush()
51whenever any pending data should be written such as when removing a buffering
52BIO using BIO_pop(). BIO_flush() may need to be retried if the ultimate
53source/sink BIO is non blocking.
54
55=head1 RETURN VALUES
56
57BIO_f_buffer() returns the buffering BIO method.
58
59BIO_get_buffer_num_lines() returns the number of lines buffered (may be 0).
60
61BIO_set_read_buffer_size(), BIO_set_write_buffer_size() and
62BIO_set_buffer_size() return 1 if the buffer was successfully resized or 0 for
63failure.
64
65BIO_set_buffer_read_data() returns 1 if the data was set correctly or 0 if
66there was an error.
67
68=head1 SEE ALSO
69
70L<BIO(3)|BIO(3)>,
71L<BIO_reset(3)|BIO_reset(3)>,
72L<BIO_flush(3)|BIO_flush(3)>,
73L<BIO_pop(3)|BIO_pop(3)>,
74L<BIO_ctrl(3)|BIO_ctrl(3)>,
75L<BIO_int_ctrl(3)|BIO_ctrl(3)>
76
77=cut
diff --git a/src/lib/libssl/src/doc/crypto/BIO_f_cipher.pod b/src/lib/libssl/src/doc/crypto/BIO_f_cipher.pod
deleted file mode 100644
index 0afd30fb2a..0000000000
--- a/src/lib/libssl/src/doc/crypto/BIO_f_cipher.pod
+++ /dev/null
@@ -1,71 +0,0 @@
1=pod
2
3=head1 NAME
4
5BIO_f_cipher, BIO_set_cipher, BIO_get_cipher_status, BIO_get_cipher_ctx -
6cipher BIO filter
7
8=head1 SYNOPSIS
9
10 #include <openssl/bio.h>
11 #include <openssl/evp.h>
12
13 BIO_METHOD * BIO_f_cipher(void);
14 void BIO_set_cipher(BIO *b,const EVP_CIPHER *cipher,
15 unsigned char *key, unsigned char *iv, int enc);
16 int BIO_get_cipher_status(BIO *b)
17 int BIO_get_cipher_ctx(BIO *b, EVP_CIPHER_CTX **pctx)
18
19=head1 DESCRIPTION
20
21BIO_f_cipher() returns the cipher BIO method. This is a filter
22BIO that encrypts any data written through it, and decrypts any data
23read from it. It is a BIO wrapper for the cipher routines
24EVP_CipherInit(), EVP_CipherUpdate() and EVP_CipherFinal().
25
26Cipher BIOs do not support BIO_gets() or BIO_puts().
27
28BIO_flush() on an encryption BIO that is being written through is
29used to signal that no more data is to be encrypted: this is used
30to flush and possibly pad the final block through the BIO.
31
32BIO_set_cipher() sets the cipher of BIO B<b> to B<cipher> using key B<key>
33and IV B<iv>. B<enc> should be set to 1 for encryption and zero for
34decryption.
35
36When reading from an encryption BIO the final block is automatically
37decrypted and checked when EOF is detected. BIO_get_cipher_status()
38is a BIO_ctrl() macro which can be called to determine whether the
39decryption operation was successful.
40
41BIO_get_cipher_ctx() is a BIO_ctrl() macro which retrieves the internal
42BIO cipher context. The retrieved context can be used in conjunction
43with the standard cipher routines to set it up. This is useful when
44BIO_set_cipher() is not flexible enough for the applications needs.
45
46=head1 NOTES
47
48When encrypting BIO_flush() B<must> be called to flush the final block
49through the BIO. If it is not then the final block will fail a subsequent
50decrypt.
51
52When decrypting an error on the final block is signalled by a zero
53return value from the read operation. A successful decrypt followed
54by EOF will also return zero for the final read. BIO_get_cipher_status()
55should be called to determine if the decrypt was successful.
56
57As always, if BIO_gets() or BIO_puts() support is needed then it can
58be achieved by preceding the cipher BIO with a buffering BIO.
59
60=head1 RETURN VALUES
61
62BIO_f_cipher() returns the cipher BIO method.
63
64BIO_set_cipher() does not return a value.
65
66BIO_get_cipher_status() returns 1 for a successful decrypt and 0
67for failure.
68
69BIO_get_cipher_ctx() currently always returns 1.
70
71=cut
diff --git a/src/lib/libssl/src/doc/crypto/BIO_f_md.pod b/src/lib/libssl/src/doc/crypto/BIO_f_md.pod
deleted file mode 100644
index 37041d9206..0000000000
--- a/src/lib/libssl/src/doc/crypto/BIO_f_md.pod
+++ /dev/null
@@ -1,146 +0,0 @@
1=pod
2
3=head1 NAME
4
5BIO_f_md, BIO_set_md, BIO_get_md, BIO_get_md_ctx - message digest BIO filter
6
7=head1 SYNOPSIS
8
9 #include <openssl/bio.h>
10 #include <openssl/evp.h>
11
12 BIO_METHOD * BIO_f_md(void);
13 int BIO_set_md(BIO *b,EVP_MD *md);
14 int BIO_get_md(BIO *b,EVP_MD **mdp);
15 int BIO_get_md_ctx(BIO *b,EVP_MD_CTX **mdcp);
16
17=head1 DESCRIPTION
18
19BIO_f_md() returns the message digest BIO method. This is a filter
20BIO that digests any data passed through it, it is a BIO wrapper
21for the digest routines EVP_DigestInit(), EVP_DigestUpdate()
22and EVP_DigestFinal().
23
24Any data written or read through a digest BIO using BIO_read() and
25BIO_write() is digested.
26
27BIO_gets(), if its B<size> parameter is large enough finishes the
28digest calculation and returns the digest value. BIO_puts() is
29not supported.
30
31BIO_reset() reinitialises a digest BIO.
32
33BIO_set_md() sets the message digest of BIO B<b> to B<md>: this
34must be called to initialize a digest BIO before any data is
35passed through it. It is a BIO_ctrl() macro.
36
37BIO_get_md() places the a pointer to the digest BIOs digest method
38in B<mdp>, it is a BIO_ctrl() macro.
39
40BIO_get_md_ctx() returns the digest BIOs context into B<mdcp>.
41
42=head1 NOTES
43
44The context returned by BIO_get_md_ctx() can be used in calls
45to EVP_DigestFinal() and also the signature routines EVP_SignFinal()
46and EVP_VerifyFinal().
47
48The context returned by BIO_get_md_ctx() is an internal context
49structure. Changes made to this context will affect the digest
50BIO itself and the context pointer will become invalid when the digest
51BIO is freed.
52
53After the digest has been retrieved from a digest BIO it must be
54reinitialized by calling BIO_reset(), or BIO_set_md() before any more
55data is passed through it.
56
57If an application needs to call BIO_gets() or BIO_puts() through
58a chain containing digest BIOs then this can be done by prepending
59a buffering BIO.
60
61Before OpenSSL 1.0.0 the call to BIO_get_md_ctx() would only work if the BIO
62had been initialized for example by calling BIO_set_md() ). In OpenSSL
631.0.0 and later the context is always returned and the BIO is state is set
64to initialized. This allows applications to initialize the context externally
65if the standard calls such as BIO_set_md() are not sufficiently flexible.
66
67=head1 RETURN VALUES
68
69BIO_f_md() returns the digest BIO method.
70
71BIO_set_md(), BIO_get_md() and BIO_md_ctx() return 1 for success and
720 for failure.
73
74=head1 EXAMPLES
75
76The following example creates a BIO chain containing an SHA1 and MD5
77digest BIO and passes the string "Hello World" through it. Error
78checking has been omitted for clarity.
79
80 BIO *bio, *mdtmp;
81 const char message[] = "Hello World";
82 bio = BIO_new(BIO_s_null());
83 mdtmp = BIO_new(BIO_f_md());
84 BIO_set_md(mdtmp, EVP_sha1());
85 /*
86 * For BIO_push() we want to append the sink BIO and keep a note of
87 * the start of the chain.
88 */
89 bio = BIO_push(mdtmp, bio);
90 mdtmp = BIO_new(BIO_f_md());
91 BIO_set_md(mdtmp, EVP_md5());
92 bio = BIO_push(mdtmp, bio);
93 /* Note: mdtmp can now be discarded */
94 BIO_write(bio, message, strlen(message));
95
96The next example digests data by reading through a chain instead:
97
98 BIO *bio, *mdtmp;
99 char buf[1024];
100 int rdlen;
101
102 bio = BIO_new_file(file, "rb");
103 mdtmp = BIO_new(BIO_f_md());
104 BIO_set_md(mdtmp, EVP_sha1());
105 bio = BIO_push(mdtmp, bio);
106 mdtmp = BIO_new(BIO_f_md());
107 BIO_set_md(mdtmp, EVP_md5());
108 bio = BIO_push(mdtmp, bio);
109 do {
110 rdlen = BIO_read(bio, buf, sizeof(buf));
111 /* Might want to do something with the data here */
112 } while (rdlen > 0);
113
114This next example retrieves the message digests from a BIO chain and
115outputs them. This could be used with the examples above.
116
117 BIO *mdtmp;
118 unsigned char mdbuf[EVP_MAX_MD_SIZE];
119 int mdlen;
120 int i;
121
122 mdtmp = bio; /* Assume bio has previously been set up */
123 do {
124 EVP_MD *md;
125 mdtmp = BIO_find_type(mdtmp, BIO_TYPE_MD);
126 if (!mdtmp)
127 break;
128 BIO_get_md(mdtmp, &md);
129 printf("%s digest", OBJ_nid2sn(EVP_MD_type(md)));
130 mdlen = BIO_gets(mdtmp, mdbuf, EVP_MAX_MD_SIZE);
131 for(i = 0; i < mdlen; i++)
132 printf(":%02X", mdbuf[i]);
133 printf("\n");
134 mdtmp = BIO_next(mdtmp);
135 } while(mdtmp);
136 BIO_free_all(bio);
137
138=head1 BUGS
139
140The lack of support for BIO_puts() and the non standard behaviour of
141BIO_gets() could be regarded as anomalous. It could be argued that BIO_gets()
142and BIO_puts() should be passed to the next BIO in the chain and digest
143the data passed through and that digests should be retrieved using a
144separate BIO_ctrl() call.
145
146=cut
diff --git a/src/lib/libssl/src/doc/crypto/BIO_f_null.pod b/src/lib/libssl/src/doc/crypto/BIO_f_null.pod
deleted file mode 100644
index 5ef19968f6..0000000000
--- a/src/lib/libssl/src/doc/crypto/BIO_f_null.pod
+++ /dev/null
@@ -1,30 +0,0 @@
1=pod
2
3=head1 NAME
4
5BIO_f_null - null filter
6
7=head1 SYNOPSIS
8
9 #include <openssl/bio.h>
10
11 BIO_METHOD * BIO_f_null(void);
12
13=head1 DESCRIPTION
14
15BIO_f_null() returns the null filter BIO method. This is a filter BIO
16that does nothing.
17
18All requests to a null filter BIO are passed through to the next BIO in
19the chain: this means that a BIO chain containing a null filter BIO
20behaves just as though the BIO was not there.
21
22=head1 NOTES
23
24As may be apparent a null filter BIO is not particularly useful.
25
26=head1 RETURN VALUES
27
28BIO_f_null() returns the null filter BIO method.
29
30=cut
diff --git a/src/lib/libssl/src/doc/crypto/BIO_find_type.pod b/src/lib/libssl/src/doc/crypto/BIO_find_type.pod
deleted file mode 100644
index a57d42f526..0000000000
--- a/src/lib/libssl/src/doc/crypto/BIO_find_type.pod
+++ /dev/null
@@ -1,97 +0,0 @@
1=pod
2
3=head1 NAME
4
5BIO_find_type, BIO_next, BIO_method_type - BIO chain traversal
6
7=head1 SYNOPSIS
8
9 #include <openssl/bio.h>
10
11 BIO * BIO_find_type(BIO *b,int bio_type);
12 BIO * BIO_next(BIO *b);
13
14 #define BIO_method_type(b) ((b)->method->type)
15
16 #define BIO_TYPE_NONE 0
17 #define BIO_TYPE_MEM (1|0x0400)
18 #define BIO_TYPE_FILE (2|0x0400)
19
20 #define BIO_TYPE_FD (4|0x0400|0x0100)
21 #define BIO_TYPE_SOCKET (5|0x0400|0x0100)
22 #define BIO_TYPE_NULL (6|0x0400)
23 #define BIO_TYPE_SSL (7|0x0200)
24 #define BIO_TYPE_MD (8|0x0200)
25 #define BIO_TYPE_BUFFER (9|0x0200)
26 #define BIO_TYPE_CIPHER (10|0x0200)
27 #define BIO_TYPE_BASE64 (11|0x0200)
28 #define BIO_TYPE_CONNECT (12|0x0400|0x0100)
29 #define BIO_TYPE_ACCEPT (13|0x0400|0x0100)
30 #define BIO_TYPE_PROXY_CLIENT (14|0x0200)
31 #define BIO_TYPE_PROXY_SERVER (15|0x0200)
32 #define BIO_TYPE_NBIO_TEST (16|0x0200)
33 #define BIO_TYPE_NULL_FILTER (17|0x0200)
34 #define BIO_TYPE_BER (18|0x0200)
35 #define BIO_TYPE_BIO (19|0x0400)
36
37 #define BIO_TYPE_DESCRIPTOR 0x0100
38 #define BIO_TYPE_FILTER 0x0200
39 #define BIO_TYPE_SOURCE_SINK 0x0400
40
41=head1 DESCRIPTION
42
43The BIO_find_type() searches for a BIO of a given type in a chain, starting
44at BIO B<b>. If B<type> is a specific type (such as BIO_TYPE_MEM) then a search
45is made for a BIO of that type. If B<type> is a general type (such as
46B<BIO_TYPE_SOURCE_SINK>) then the next matching BIO of the given general type is
47searched for. BIO_find_type() returns the next matching BIO or NULL if none is
48found.
49
50Note: not all the B<BIO_TYPE_*> types above have corresponding BIO
51implementations.
52
53BIO_next() returns the next BIO in a chain. It can be used to traverse all BIOs
54in a chain or used in conjunction with BIO_find_type() to find all BIOs of a
55certain type.
56
57BIO_method_type() returns the type of a BIO.
58
59=head1 RETURN VALUES
60
61BIO_find_type() returns a matching BIO or NULL for no match.
62
63BIO_next() returns the next BIO in a chain.
64
65BIO_method_type() returns the type of the BIO B<b>.
66
67=head1 NOTES
68
69BIO_next() was added to OpenSSL 0.9.6 to provide a 'clean' way to traverse a BIO
70chain or find multiple matches using BIO_find_type(). Previous versions had to
71use:
72
73 next = bio->next_bio;
74
75=head1 BUGS
76
77BIO_find_type() in OpenSSL 0.9.5a and earlier could not be safely passed a
78NULL pointer for the B<b> argument.
79
80=head1 EXAMPLE
81
82Traverse a chain looking for digest BIOs:
83
84 BIO *btmp;
85 btmp = in_bio; /* in_bio is chain to search through */
86
87 do {
88 btmp = BIO_find_type(btmp, BIO_TYPE_MD);
89 if (btmp == NULL)
90 break; /* Not found */
91 /* btmp is a digest BIO, do something with it ...*/
92 ...
93
94 btmp = BIO_next(btmp);
95 } while(btmp);
96
97=cut
diff --git a/src/lib/libssl/src/doc/crypto/BIO_new.pod b/src/lib/libssl/src/doc/crypto/BIO_new.pod
deleted file mode 100644
index bd7b7381f3..0000000000
--- a/src/lib/libssl/src/doc/crypto/BIO_new.pod
+++ /dev/null
@@ -1,64 +0,0 @@
1=pod
2
3=head1 NAME
4
5BIO_new, BIO_set, BIO_free, BIO_vfree, BIO_free_all - BIO allocation and
6freeing functions
7
8=head1 SYNOPSIS
9
10 #include <openssl/bio.h>
11
12 BIO * BIO_new(BIO_METHOD *type);
13 int BIO_set(BIO *a,BIO_METHOD *type);
14 int BIO_free(BIO *a);
15 void BIO_vfree(BIO *a);
16 void BIO_free_all(BIO *a);
17
18=head1 DESCRIPTION
19
20The BIO_new() function returns a new BIO using method B<type>.
21
22BIO_set() sets the method of an already existing BIO.
23
24BIO_free() frees up a single BIO, BIO_vfree() also frees up a single BIO
25but it does not return a value. Calling BIO_free() may also have some effect
26on the underlying I/O structure, for example it may close the file being
27referred to under certain circumstances. For more details see the individual
28BIO_METHOD descriptions.
29
30BIO_free_all() frees up an entire BIO chain, it does not halt if an error
31occurs freeing up an individual BIO in the chain.
32
33=head1 RETURN VALUES
34
35BIO_new() returns a newly created BIO or NULL if the call fails.
36
37BIO_set(), BIO_free() return 1 for success and 0 for failure.
38
39BIO_free_all() and BIO_vfree() do not return values.
40
41=head1 NOTES
42
43Some BIOs (such as memory BIOs) can be used immediately after calling
44BIO_new(). Others (such as file BIOs) need some additional initialization,
45and frequently a utility function exists to create and initialize such BIOs.
46
47If BIO_free() is called on a BIO chain it will only free one BIO resulting
48in a memory leak.
49
50Calling BIO_free_all() a single BIO has the same effect as calling BIO_free()
51on it other than the discarded return value.
52
53Normally the B<type> argument is supplied by a function which returns a
54pointer to a BIO_METHOD. There is a naming convention for such functions:
55a source/sink BIO is normally called BIO_s_*() and a filter BIO
56BIO_f_*();
57
58=head1 EXAMPLE
59
60Create a memory BIO:
61
62 BIO *mem = BIO_new(BIO_s_mem());
63
64=cut
diff --git a/src/lib/libssl/src/doc/crypto/BIO_new_CMS.pod b/src/lib/libssl/src/doc/crypto/BIO_new_CMS.pod
deleted file mode 100644
index 9e3a4b7f89..0000000000
--- a/src/lib/libssl/src/doc/crypto/BIO_new_CMS.pod
+++ /dev/null
@@ -1,66 +0,0 @@
1=pod
2
3=head1 NAME
4
5 BIO_new_CMS - CMS streaming filter BIO
6
7=head1 SYNOPSIS
8
9 #include <openssl/cms.h>
10
11 BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms);
12
13=head1 DESCRIPTION
14
15BIO_new_CMS() returns a streaming filter BIO chain based on B<cms>. The output
16of the filter is written to B<out>. Any data written to the chain is
17automatically translated to a BER format CMS structure of the appropriate type.
18
19=head1 NOTES
20
21The chain returned by this function behaves like a standard filter BIO. It
22supports non blocking I/O. Content is processed and streamed on the fly and not
23all held in memory at once: so it is possible to encode very large structures.
24After all content has been written through the chain BIO_flush() must be called
25to finalise the structure.
26
27The B<CMS_STREAM> flag must be included in the corresponding B<flags>
28parameter of the B<cms> creation function.
29
30If an application wishes to write additional data to B<out> BIOs should be
31removed from the chain using BIO_pop() and freed with BIO_free() until B<out>
32is reached. If no additional data needs to be written BIO_free_all() can be
33called to free up the whole chain.
34
35Any content written through the filter is used verbatim: no canonical
36translation is performed.
37
38It is possible to chain multiple BIOs to, for example, create a triple wrapped
39signed, enveloped, signed structure. In this case it is the applications
40responsibility to set the inner content type of any outer CMS_ContentInfo
41structures.
42
43Large numbers of small writes through the chain should be avoided as this will
44produce an output consisting of lots of OCTET STRING structures. Prepending
45a BIO_f_buffer() buffering BIO will prevent this.
46
47=head1 BUGS
48
49There is currently no corresponding inverse BIO: i.e. one which can decode
50a CMS structure on the fly.
51
52=head1 RETURN VALUES
53
54BIO_new_CMS() returns a BIO chain when successful or NULL if an error
55occurred. The error can be obtained from ERR_get_error(3).
56
57=head1 SEE ALSO
58
59L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>,
60L<CMS_encrypt(3)|CMS_encrypt(3)>
61
62=head1 HISTORY
63
64BIO_new_CMS() was added to OpenSSL 1.0.0
65
66=cut