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