* encoding for MAC: do CBC and prepend last ciphertext block
*/
-#include "mech.h"
+#include "forwarder.h"
#include "blowfish.h"
struct mechdata {
unsigned char iv[BLOWFISH_BLOCKBYTES];
unsigned char key[BLOWFISH_MAXKEYBYTES];
- md= xmalloc(sizeof(md));
+ XMALLOC(md);
keysize= getarg_ulong();
arg_assert(!(keysize & 7));
#define MSGSIZE_OUT \
msgsize= buf->size; \
- arg_assert(!(msgsize & ~BLOWFISH_BLOCKBYTES));
+ arg_assert(!(msgsize & (BLOWFISH_BLOCKBYTES-1)));
#define MSGSIZE_IN \
msgsize= buf->size; \
- if (msgsize & ~BLOWFISH_BLOCKBYTES) return "not multiple of block size"
+ if (msgsize & (BLOWFISH_BLOCKBYTES-1)) return "not multiple of block size"
#define FOREACH_BLOCK(func,inptr,outptr) \
{ \
unsigned char *ptr; \
- ptr= buf->start; \
- while (ptr < buf->start + msgsize) \
+ for (ptr= buf->start; \
+ ptr < buf->start + msgsize; \
+ ptr += BLOWFISH_BLOCKBYTES) { \
func(&md->cbc,inptr,outptr); \
+ } \
}
static void menc_blowfish(struct mechdata *md, struct buffer *buf) {