BeeCrypt  4.2.1
blowfish.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1999, 2000, 2002 X-Way Rights BV
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  */
19 
34 #ifndef _BLOWFISH_H
35 #define _BLOWFISH_H
36 
37 #include "beecrypt/beecrypt.h"
38 #include "beecrypt/blowfishopt.h"
39 
40 #define BLOWFISHROUNDS 16
41 #define BLOWFISHPSIZE (BLOWFISHROUNDS+2)
42 
46 #ifdef __cplusplus
48 #else
49 struct _blowfishParam
50 #endif
51 {
55  uint32_t p[BLOWFISHPSIZE];
59  uint32_t s[1024];
63  uint32_t fdback[2];
64 };
65 
66 #ifndef __cplusplus
67 typedef struct _blowfishParam blowfishParam;
68 #endif
69 
70 #ifdef __cplusplus
71 extern "C" {
72 #endif
73 
77 extern const BEECRYPTAPI blockCipher blowfish;
78 
90 int blowfishSetup (blowfishParam*, const byte*, size_t, cipherOperation);
91 
100 int blowfishSetIV (blowfishParam*, const byte* iv);
101 
103 int blowfishSetCTR (blowfishParam*, const byte* nivz, size_t counter);
104 
114 int blowfishEncrypt (blowfishParam*, uint32_t*, const uint32_t*);
115 
125 int blowfishDecrypt (blowfishParam*, uint32_t*, const uint32_t*);
126 
128 uint32_t* blowfishFeedback(blowfishParam*);
129 
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 #endif