00001 /* contrib/pgcrypto/blf.h */ 00002 /* 00003 * PuTTY is copyright 1997-2007 Simon Tatham. 00004 * 00005 * Portions copyright Robert de Bath, Joris van Rantwijk, Delian 00006 * Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry, 00007 * Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, Markus 00008 * Kuhn, and CORE SDI S.A. 00009 * 00010 * Permission is hereby granted, free of charge, to any person 00011 * obtaining a copy of this software and associated documentation files 00012 * (the "Software"), to deal in the Software without restriction, 00013 * including without limitation the rights to use, copy, modify, merge, 00014 * publish, distribute, sublicense, and/or sell copies of the Software, 00015 * and to permit persons to whom the Software is furnished to do so, 00016 * subject to the following conditions: 00017 * 00018 * The above copyright notice and this permission notice shall be 00019 * included in all copies or substantial portions of the Software. 00020 * 00021 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00022 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00023 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00024 * NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE 00025 * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 00026 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 00027 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00028 */ 00029 00030 typedef struct 00031 { 00032 uint32 S0[256], 00033 S1[256], 00034 S2[256], 00035 S3[256], 00036 P[18]; 00037 uint32 iv0, 00038 iv1; /* for CBC mode */ 00039 } BlowfishContext; 00040 00041 void blowfish_setkey(BlowfishContext *ctx, const uint8 *key, short keybytes); 00042 void blowfish_setiv(BlowfishContext *ctx, const uint8 *iv); 00043 void blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx); 00044 void blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx); 00045 void blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx); 00046 void blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx);