diff options
Diffstat (limited to 'src/lib/libc/crypt/blowfish.3')
-rw-r--r-- | src/lib/libc/crypt/blowfish.3 | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/src/lib/libc/crypt/blowfish.3 b/src/lib/libc/crypt/blowfish.3 new file mode 100644 index 0000000000..44f7eb2bbf --- /dev/null +++ b/src/lib/libc/crypt/blowfish.3 | |||
@@ -0,0 +1,106 @@ | |||
1 | .\" $OpenBSD: blowfish.3,v 1.12 2003/08/28 12:35:00 jmc Exp $ | ||
2 | .\" | ||
3 | .\" Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de> | ||
4 | .\" All rights reserved. | ||
5 | .\" | ||
6 | .\" Redistribution and use in source and binary forms, with or without | ||
7 | .\" modification, are permitted provided that the following conditions | ||
8 | .\" are met: | ||
9 | .\" 1. Redistributions of source code must retain the above copyright | ||
10 | .\" notice, this list of conditions and the following disclaimer. | ||
11 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
12 | .\" notice, this list of conditions and the following disclaimer in the | ||
13 | .\" documentation and/or other materials provided with the distribution. | ||
14 | .\" 3. All advertising materials mentioning features or use of this software | ||
15 | .\" must display the following acknowledgement: | ||
16 | .\" This product includes software developed by Niels Provos. | ||
17 | .\" 4. The name of the author may not be used to endorse or promote products | ||
18 | .\" derived from this software without specific prior written permission. | ||
19 | .\" | ||
20 | .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
21 | .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
22 | .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
23 | .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
24 | .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
25 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
26 | .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
27 | .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
28 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
29 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
30 | .\" | ||
31 | .\" Manual page, using -mandoc macros | ||
32 | .\" | ||
33 | .Dd February 13, 1997 | ||
34 | .Dt BLOWFISH 3 | ||
35 | .Os | ||
36 | .Sh NAME | ||
37 | .Nm blf_key , | ||
38 | .Nm blf_enc , | ||
39 | .Nm blf_dec | ||
40 | .Nd Blowfish encryption | ||
41 | .Sh SYNOPSIS | ||
42 | .Fd #include <blf.h> | ||
43 | .Ft void | ||
44 | .Fn blf_key "blf_ctx *state" "const u_int8_t *key" "u_int16_t keylen" | ||
45 | .Ft void | ||
46 | .Fn blf_enc "blf_ctx *state" "u_int32_t *data" "u_int16_t datalen" | ||
47 | .Ft void | ||
48 | .Fn blf_dec "blf_ctx *state" "u_int32_t *data" "u_int16_t datalen" | ||
49 | .Ft void | ||
50 | .Fn blf_ecb_encrypt "blf_ctx *state" "u_int8_t *data" "u_int32_t datalen" | ||
51 | .Ft void | ||
52 | .Fn blf_ecb_decrypt "blf_ctx *state" "u_int8_t *data" "u_int32_t datalen" | ||
53 | .Ft void | ||
54 | .Fn blf_cbc_encrypt "blf_ctx *state" "u_int8_t *iv" "u_int8_t *data" "u_int32_t datalen" | ||
55 | .Ft void | ||
56 | .Fn blf_cbc_decrypt "blf_ctx *state" "u_int8_t *iv" "u_int8_t *data" "u_int32_t datalen" | ||
57 | .Sh DESCRIPTION | ||
58 | .Pa Blowfish | ||
59 | is a fast unpatented block cipher designed by Bruce Schneier. | ||
60 | It basically consists of a 16 times iterated Feistel network. | ||
61 | The block size is 64 bit and the maximum key size is 448 bit. | ||
62 | .Pp | ||
63 | The | ||
64 | .Fn blf_key | ||
65 | function initializes the 4 8bit S-boxes and the 18 Subkeys with | ||
66 | the hexadecimal digits of Pi. | ||
67 | The key is used for further randomization. | ||
68 | The first argument to | ||
69 | .Fn blf_enc | ||
70 | is the initialized state derived from | ||
71 | .Fn blf_key . | ||
72 | The stream of 32-bit words is encrypted in Electronic Codebook | ||
73 | Mode (ECB) and | ||
74 | .Pa datalen | ||
75 | must be even. | ||
76 | .Fn blf_dec | ||
77 | is used for decrypting Blowfish encrypted blocks. | ||
78 | .Pp | ||
79 | The functions | ||
80 | .Fn blf_ecb_encrypt | ||
81 | and | ||
82 | .Fn blf_ecb_decrypt | ||
83 | are used for encrypting and decrypting octet streams in ECB mode. | ||
84 | The functions | ||
85 | .Fn blf_cbc_encrypt | ||
86 | and | ||
87 | .Fn blf_cbc_decrypt | ||
88 | are used for encrypting and decrypting octet streams in | ||
89 | Cipherblock Chaining Mode (CBC). | ||
90 | .Pp | ||
91 | The functions | ||
92 | .Fn Blowfish_initstate , | ||
93 | .Fn Blowfish_expand0state , | ||
94 | .Fn Blowfish_expandstate , | ||
95 | .Fn Blowfish_encipher | ||
96 | and | ||
97 | .Fn Blowfish_decipher | ||
98 | are used for customization of the | ||
99 | .Pa Blowfish | ||
100 | cipher, e.g., for the blowfish password hashing function. | ||
101 | .Sh SEE ALSO | ||
102 | .Xr passwd 1 , | ||
103 | .Xr crypt 3 , | ||
104 | .Xr passwd 5 | ||
105 | .Sh AUTHORS | ||
106 | .An Niels Provos Aq provos@physnet.uni-hamburg.de | ||