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 #ifndef __BLF_H 31 #define __BLF_H 32 33 typedef struct 34 { 35 uint32 S0[256], 36 S1[256], 37 S2[256], 38 S3[256], 39 P[18]; 40 uint32 iv0, 41 iv1; /* for CBC mode */ 42 } BlowfishContext; 43 44 void blowfish_setkey(BlowfishContext *ctx, const uint8 *key, short keybytes); 45 void blowfish_setiv(BlowfishContext *ctx, const uint8 *iv); 46 void blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx); 47 void blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx); 48 void blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx); 49 void blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx); 50 #endif 51