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