Fix copyright date.
[become] / src / blowfish.h
1 /* -*-c-*-
2 *
3 * $Id: blowfish.h,v 1.5 1998/01/12 16:45:45 mdw Exp $
4 *
5 * Blowfish encryption routines
6 *
7 * (c) 1998 Mark Wooding
8 */
9
10 /*----- Licensing notice --------------------------------------------------*
11 *
12 * This file is part of `become'
13 *
14 * `Become' is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * `Become' is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with `become'; if not, write to the Free Software Foundation,
26 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 */
28
29 /*----- Revision history --------------------------------------------------*
30 *
31 * $Log: blowfish.h,v $
32 * Revision 1.5 1998/01/12 16:45:45 mdw
33 * Fix copyright date.
34 *
35 * Revision 1.4 1997/09/26 09:14:57 mdw
36 * Merged blowfish branch into trunk.
37 *
38 * Revision 1.3.2.1 1997/09/26 09:07:59 mdw
39 * Use the Blowfish encryption algorithm instead of IDEA. This is partly
40 * because I prefer Blowfish (without any particularly strong evidence) but
41 * mainly because IDEA is patented and Blowfish isn't.
42 *
43 * Revision 1.3 1997/08/07 09:43:20 mdw
44 * Fix address of the FSF.
45 *
46 * Revision 1.2 1997/08/04 10:24:20 mdw
47 * Sources placed under CVS control.
48 *
49 * Revision 1.1 1997/07/21 13:47:53 mdw
50 * Initial revision
51 *
52 */
53
54 #ifndef BLOWFISH_H
55 #define BLOWFISH_H
56
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60
61 /*----- Required headers --------------------------------------------------*/
62
63 #ifndef CONFIG_H
64 # include "config.h"
65 #endif
66
67 /*----- Type definitions --------------------------------------------------*/
68
69 /* --- A blowfish expanded key --- */
70
71 typedef struct blowfish_key {
72 uint_32 p[18];
73 uint_32 s0[256];
74 uint_32 s1[256];
75 uint_32 s2[256];
76 uint_32 s3[256];
77 } blowfish_key;
78
79 /* --- Size of a blowfish block --- */
80
81 #define BLOWFISH_BLKSIZE (8u)
82
83 /*----- Functions provided ------------------------------------------------*/
84
85 /* --- @blowfish_encrypt@ --- *
86 *
87 * Arguments: @const blowfish_key *k@ = pointer to key block
88 * @const voic *from@ = block to encrypt from
89 * @void *to@ = block to encrypt to
90 *
91 * Returns: ---
92 *
93 * Use: Encrypts a block using the Blowfish algorithm.
94 */
95
96 extern void blowfish_encrypt(const blowfish_key */*k*/,
97 const void */*from*/, void */*to*/);
98
99
100 /* --- @blowfish_decrypt@ --- *
101 *
102 * Arguments: @const blowfish_key *k@ = pointer to key block
103 * @const void *from@ = block to decrypt from
104 * @void *to@ = block to decrypt to
105 *
106 * Returns: ---
107 *
108 * Use: Decrypts a block using the Blowfish algorithm.
109 */
110
111 extern void blowfish_decrypt(const blowfish_key */*k*/,
112 const void */*from*/, void */*to*/);
113
114 /* --- @blowfish_setKey@ --- *
115 *
116 * Arguments: @blowfish_key *kb@ = pointer to key block to fill
117 * @void *k@ = pointer to key data
118 * @size_t sz@ = length of data in bytes
119 *
120 * Returns: ---
121 *
122 * Use: Expands a key which isn't represented as a number of whole
123 * words. This is a nonstandard extension, although it can be
124 * used to support 40-bit keys, which some governments might
125 * find more palatable than 160-bit (or 448-bit!) keys.
126 */
127
128 extern void blowfish_setKey(blowfish_key */*kb*/,
129 const void */*k*/, size_t /*sz*/);
130
131 /*----- That's all, folks -------------------------------------------------*/
132
133 #ifdef __cplusplus
134 }
135 #endif
136
137 #endif