BeeCrypt 4.2.1
|
00001 /* 00002 * Copyright (c) 1999, 2000, 2002 X-Way Rights BV 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 00089 BEECRYPTAPI 00090 int blowfishSetup (blowfishParam*, const byte*, size_t, cipherOperation); 00091 00099 BEECRYPTAPI 00100 int blowfishSetIV (blowfishParam*, const byte* iv); 00101 00102 BEECRYPTAPI 00103 int blowfishSetCTR (blowfishParam*, const byte* nivz, size_t counter); 00104 00113 BEECRYPTAPI 00114 int blowfishEncrypt (blowfishParam*, uint32_t*, const uint32_t*); 00115 00124 BEECRYPTAPI 00125 int blowfishDecrypt (blowfishParam*, uint32_t*, const uint32_t*); 00126 00127 BEECRYPTAPI 00128 uint32_t* blowfishFeedback(blowfishParam*); 00129 00130 #ifdef __cplusplus 00131 } 00132 #endif 00133 00134 #endif