00001 /* 00002 * Copyright (c) 1999, 2000, 2002 Virtual Unlimited B.V. 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 */ 00019 00034 #ifndef _BLOWFISH_H 00035 #define _BLOWFISH_H 00036 00037 #include "beecrypt.h" 00038 #include "blowfishopt.h" 00039 00040 #define BLOWFISHROUNDS 16 00041 #define BLOWFISHPSIZE (BLOWFISHROUNDS+2) 00042 00046 typedef struct 00047 { 00051 uint32_t p[BLOWFISHPSIZE]; 00055 uint32_t s[1024]; 00059 uint32_t fdback[2]; 00060 } blowfishParam; 00061 00062 #ifdef __cplusplus 00063 extern "C" { 00064 #endif 00065 00069 extern const BEECRYPTAPI blockCipher blowfish; 00070 00082 BEECRYPTAPI 00083 int blowfishSetup (blowfishParam*, const byte*, size_t, cipherOperation); 00084 00092 BEECRYPTAPI 00093 int blowfishSetIV (blowfishParam*, const byte*); 00094 00103 BEECRYPTAPI 00104 int blowfishEncrypt (blowfishParam*, uint32_t*, const uint32_t*); 00105 00114 BEECRYPTAPI 00115 int blowfishDecrypt (blowfishParam*, uint32_t*, const uint32_t*); 00116 00117 BEECRYPTAPI 00118 uint32_t* blowfishFeedback(blowfishParam*); 00119 00120 #ifdef __cplusplus 00121 } 00122 #endif 00123 00124 #endif