1 /* contrib/pgcrypto/blf.h */
2 /*
3  * PuTTY is copyright 1997-2007 Simon Tatham.
4  *
5  * Portions copyright Robert de Bath, Joris van Rantwijk, Delian
6  * Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry,
7  * Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, Markus
8  * Kuhn, and CORE SDI S.A.
9  *
10  * Permission is hereby granted, free of charge, to any person
11  * obtaining a copy of this software and associated documentation files
12  * (the "Software"), to deal in the Software without restriction,
13  * including without limitation the rights to use, copy, modify, merge,
14  * publish, distribute, sublicense, and/or sell copies of the Software,
15  * and to permit persons to whom the Software is furnished to do so,
16  * subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be
19  * included in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24  * NONINFRINGEMENT.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE
25  * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
26  * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28  */
29 
30 typedef struct
31 {
32 	uint32		S0[256],
33 				S1[256],
34 				S2[256],
35 				S3[256],
36 				P[18];
37 	uint32		iv0,
38 				iv1;			/* for CBC mode */
39 } BlowfishContext;
40 
41 void		blowfish_setkey(BlowfishContext *ctx, const uint8 *key, short keybytes);
42 void		blowfish_setiv(BlowfishContext *ctx, const uint8 *iv);
43 void		blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx);
44 void		blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx);
45 void		blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx);
46 void		blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx);
47