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/beecrypt.h" 00038 #include "beecrypt/blowfishopt.h" 00039 00040 #define BLOWFISHROUNDS 16 00041 #define BLOWFISHPSIZE (BLOWFISHROUNDS+2) 00042 00046 #ifdef __cplusplus 00047 struct BEECRYPTAPI blowfishParam 00048 #else 00049 struct _blowfishParam 00050 #endif 00051 { 00055 uint32_t p[BLOWFISHPSIZE]; 00059 uint32_t s[1024]; 00063 uint32_t fdback[2]; 00064 }; 00065 00066 #ifndef __cplusplus 00067 typedef struct _blowfishParam blowfishParam; 00068 #endif 00069 00070 #ifdef __cplusplus 00071 extern "C" { 00072 #endif 00073 00077 extern const BEECRYPTAPI blockCipher blowfish; 00078 00090 BEECRYPTAPI 00091 int blowfishSetup (blowfishParam*, const byte*, size_t, cipherOperation); 00092 00100 BEECRYPTAPI 00101 int blowfishSetIV (blowfishParam*, const byte*); 00102 00111 BEECRYPTAPI 00112 int blowfishEncrypt (blowfishParam*, uint32_t*, const uint32_t*); 00113 00122 BEECRYPTAPI 00123 int blowfishDecrypt (blowfishParam*, uint32_t*, const uint32_t*); 00124 00125 BEECRYPTAPI 00126 uint32_t* blowfishFeedback(blowfishParam*); 00127 00128 #ifdef __cplusplus 00129 } 00130 #endif 00131 00132 #endif