Main Page Modules Data Structures File List Data Fields Globals Related Pages

# beecrypt/blowfish.h

Go to the documentation of this file.

    00001
    00007 /*
    00008  * Copyright (c) 1999, 2000 Virtual Unlimited B.V.
    00009  *
    00010  * Author: Bob Deblier <bob@virtualunlimited.com>
    00011  *
    00012  * This library is free software; you can redistribute it and/or
    00013  * modify it under the terms of the GNU Lesser General Public
    00014  * License as published by the Free Software Foundation; either
    00015  * version 2.1 of the License, or (at your option) any later version.
    00016  *
    00017  * This library is distributed in the hope that it will be useful,
    00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00020  * Lesser General Public License for more details.
    00021  *
    00022  * You should have received a copy of the GNU Lesser General Public
    00023  * License along with this library; if not, write to the Free Software
    00024  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00025  *
    00026  */
    00027
    00028 #ifndef _BLOWFISH_H
    00029 #define _BLOWFISH_H
    00030
    00031 #include "beecrypt.h"
    00032 #include "blowfishopt.h"
    00033
    00034 #define BLOWFISHROUNDS  16
    00035 #define BLOWFISHPSIZE   (BLOWFISHROUNDS+2)
    00036
    00039 typedef struct
    00040 {
    00041         uint32 p[BLOWFISHPSIZE];
    00042         uint32 s[1024];
    00043         uint32 fdback[2];
    00044 } blowfishParam;
    00045
    00046 #ifdef __cplusplus
    00047 extern "C" {
    00048 #endif
    00049
    00052 /*@observer@*/ /*@checked@*/
    00053 extern const BEECRYPTAPI blockCipher blowfish;
    00054
    00057 /*@-exportlocal@*/
    00058 BEECRYPTAPI
    00059 int blowfishSetup  (blowfishParam* bp, const uint32* key, int keybits, cipherOperation op)
    00060         /*@modifies bp */;
    00061 /*@=exportlocal@*/
    00062
    00065 /*@-exportlocal@*/
    00066 BEECRYPTAPI
    00067 int blowfishSetIV  (blowfishParam* bp, const uint32* iv)
    00068         /*@modifies bp */;
    00069 /*@=exportlocal@*/
    00070
    00073 /*@-exportlocal@*/
    00074 BEECRYPTAPI
    00075 int blowfishEncrypt(blowfishParam* bp, uint32* dst, const uint32* src)
    00076         /*@modifies bp, dst */;
    00077 /*@=exportlocal@*/
    00078
    00081 /*@-exportlocal@*/
    00082 BEECRYPTAPI
    00083 int blowfishDecrypt(blowfishParam* bp, uint32* dst, const uint32* src)
    00084         /*@modifies bp, dst */;
    00085 /*@=exportlocal@*/
    00086
    00089 /*@-exportlocal@*/
    00090 BEECRYPTAPI
    00091 int blowfishECBEncrypt(blowfishParam* bp, int count, uint32* dst, const uint32* src)
    00092         /*@modifies bp, dst */;
    00093 /*@=exportlocal@*/
    00094
    00097 /*@-exportlocal@*/
    00098 BEECRYPTAPI
    00099 int blowfishECBDecrypt(blowfishParam* bp, int count, uint32* dst, const uint32* src)
    00100         /*@modifies bp, dst */;
    00101 /*@=exportlocal@*/
    00102
    00105 /*@-exportlocal@*/
    00106 BEECRYPTAPI
    00107 int blowfishCBCEncrypt(blowfishParam* bp, int count, uint32* dst, const uint32* src)
    00108         /*@modifies bp, dst */;
    00109 /*@=exportlocal@*/
    00110
    00113 /*@-exportlocal@*/
    00114 BEECRYPTAPI
    00115 int blowfishCBCDecrypt(blowfishParam* bp, int count, uint32* dst, const uint32* src)
    00116         /*@modifies bp, dst */;
    00117 /*@=exportlocal@*/
    00118
    00119 #ifdef __cplusplus
    00120 }
    00121 #endif
    00122
    00123 #endif