/* * Cryptographic API. * * Blowfish Cipher Algorithm, by Bruce Schneier. * http://www.counterpane.com/blowfish.html * * Adapated from Kerneli implementation. * * Copyright (c) Herbert Valerio Riedel * Copyright (c) Kyle McMartin * Copyright (c) 2002 James Morris * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * */ #ifndef _BLOWFISH_ #define _BLOWFISH_ #include "uint.h" #define BF_BLOCK_SIZE 8 /* key length from 32 to 448 bits, but no checks are made */ #define BF_MIN_KEY_SIZE 4 #define BF_MAX_KEY_SIZE 56 struct blowfish_ctx { u32 p[18]; u32 s[1024]; }; /* * Calculates the blowfish S and P boxes for encryption and decryption. */ int blowfish_setkey(void *ctx, const u8 *key, unsigned int keylen, u32 *flags); void blowfish_encrypt(void *cx, u8 *dst, const u8 *src); void blowfish_decrypt(void *cx, u8 *dst, const u8 *src); /* memcpy */ /* void blowfish_encrypt_fake(void *cx, u8 *dst, const u8 *src); void blowfish_decrypt_fake(void *cx, u8 *dst, const u8 *src); */ #endif