1 .\" $OpenBSD: BF_set_key.3,v 1.5 2016/11/11 01:20:53 schwarze Exp $
2 .\" OpenSSL 99d63d46 Jul 19 09:27:53 2016 -0400
4 .\" This file was written by Richard Levitte <levitte@openssl.org>.
5 .\" Copyright (c) 2000, 2002, 2005, 2014, 2016 The OpenSSL Project.
6 .\" All rights reserved.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\" notice, this list of conditions and the following disclaimer in
17 .\" the documentation and/or other materials provided with the
20 .\" 3. All advertising materials mentioning features or use of this
21 .\" software must display the following acknowledgment:
22 .\" "This product includes software developed by the OpenSSL Project
23 .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
25 .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 .\" endorse or promote products derived from this software without
27 .\" prior written permission. For written permission, please contact
28 .\" openssl-core@openssl.org.
30 .\" 5. Products derived from this software may not be called "OpenSSL"
31 .\" nor may "OpenSSL" appear in their names without prior written
32 .\" permission of the OpenSSL Project.
34 .\" 6. Redistributions of any form whatsoever must retain the following
36 .\" "This product includes software developed by the OpenSSL Project
37 .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
39 .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 .\" OF THE POSSIBILITY OF SUCH DAMAGE.
52 .Dd $Mdocdate: November 11 2016 $
61 .Nm BF_cfb64_encrypt ,
62 .Nm BF_ofb64_encrypt ,
64 .Nd Blowfish encryption
66 .In openssl/blowfish.h
71 .Fa "const unsigned char *data"
76 .Fa "const BF_KEY *key"
81 .Fa "const BF_KEY *key"
85 .Fa "const unsigned char *in"
86 .Fa "unsigned char *out"
92 .Fa "const unsigned char *in"
93 .Fa "unsigned char *out"
95 .Fa "BF_KEY *schedule"
96 .Fa "unsigned char *ivec"
101 .Fa "const unsigned char *in"
102 .Fa "unsigned char *out"
104 .Fa "BF_KEY *schedule"
105 .Fa "unsigned char *ivec"
111 .Fa "const unsigned char *in"
112 .Fa "unsigned char *out"
114 .Fa "BF_KEY *schedule"
115 .Fa "unsigned char *ivec"
123 This library implements the Blowfish cipher,
124 which was invented and defined by
126 Note that applications should use higher level functions such as
127 .Xr EVP_EncryptInit 3
128 instead of calling the Blowfish functions directly.
130 Blowfish is a block cipher that operates on 64-bit (8 byte) blocks of data.
131 It uses a variable size key, but typically, 128-bit (16 byte) keys
132 are considered good for strong encryption.
133 Blowfish can be used in the same modes as DES
134 and is currently one of the faster block ciphers.
135 It is quite a bit faster than DES, and much faster than IDEA or RC2.
137 Blowfish consists of a key setup phase
138 and the actual encryption or decryption phase.
150 is the basic Blowfish encryption and decryption function.
151 It encrypts or decrypts the first 64 bits of
155 putting the result in
158 decides if encryption
163 The vector pointed at by
167 must be 64 bits in length, no less.
168 If they are larger, everything after the first 64 bits is ignored.
172 .Fn BF_cfb64_encrypt ,
175 all operate on variable length data.
176 They all take an initialization vector
178 which needs to be passed along into the next call of the same function
179 for the same message.
181 may be initialized with anything, but the recipient needs to know what
182 it was initialized with, or it won't be able to decrypt.
183 Some programs and protocols simplify this, like SSH, where
185 is simply initialized to zero.
187 operates on data that is a multiple of 8 bytes long, while
191 are used to encrypt an variable number of bytes (the amount
192 does not have to be an exact multiple of 8).
193 The purpose of the latter two is to simulate stream ciphers and,
194 therefore, they need the parameter
196 which is a pointer to an integer where the current offset in
198 is stored between calls.
199 This integer must be initialized to zero when
204 is the Cipher Block Chaining function for Blowfish.
205 It encrypts or decrypts the 64-bit chunks of
209 putting the result in
212 decides if encryption
218 must point at an 8-byte long initialization vector.
221 is the CFB mode for Blowfish with 64-bit feedback.
222 It encrypts or decrypts the bytes in
226 putting the result in
229 decides if encryption
236 8-byte long initialization vector.
238 must point at an integer which must be initially zero.
241 is the OFB mode for Blowfish with 64-bit feedback.
242 It uses the same parameters as
243 .Fn BF_cfb64_encrypt ,
244 which must be initialized the same way.
249 are the lowest level functions for Blowfish encryption.
250 They encrypt/decrypt the first 64 bits of the vector pointed by
254 These functions should not be used unless implementing `modes' of Blowfish.
255 The alternative is to use
257 Be aware that these functions take each 32-bit chunk in host-byte order,
258 which is little-endian on little-endian platforms
259 and big-endian on big-endian ones.
261 The Blowfish functions are available in all versions of SSLeay and OpenSSL.