Commit 16dfe6c2 authored by J.H.M. Dassen's avatar J.H.M. Dassen Committed by Niels Möller

GPG blowfish implementation integrated by jdassen@wi.leidenuniv.nl.

Rev: src/symmetric/blowfish.c:1.1
Rev: src/symmetric/include/blowfish.h:1.1
Rev: src/symmetric/include/types.h:1.1
Rev: src/symmetric/util.c:1.1
Rev: src/symmetric/util.h:1.1
parent 05c0b475
This diff is collapsed.
/* blowfish.h
* Copyright (C) 1998 Free Software Foundation, Inc.
*
* This file is part of GNUPG.
*
* GNUPG 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.
*
* GNUPG is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
/*
* Modifications for lsh by Ray Dassen
*/
#ifndef G10_BLOWFISH_H
#define G10_BLOWFISH_H
#include "types.h"
#define CIPHER_ALGO_BLOWFISH 4 /* blowfish 128 bit key */
#define BLOWFISH_ROUNDS 16
typedef struct {
u32 s0[256];
u32 s1[256];
u32 s2[256];
u32 s3[256];
u32 p[BLOWFISH_ROUNDS+2];
} BLOWFISH_context;
const char *
blowfish_get_info( int algo, size_t *keylen,
size_t *blocksize, size_t *contextsize,
int (**setkey)( void *c, const byte *key, unsigned keylen ),
void (**encrypt)( void *c, byte *outbuf, const byte *inbuf ),
void (**decrypt)( void *c, byte *outbuf, const byte *inbuf )
);
#endif /*G10_BLOWFISH_H*/
#ifndef _TYPES_H
#define _TYPES_H
/* Define types for GPG code */
#include "lsh_types.h"
typedef UINT8 byte;
typedef UINT32 u32;
#endif /* _TYPES_H */
#include "util.h"
#include <stdarg.h> /* For the va_* stuff */
#include <stdlib.h> /* For EXIT_FAILURE */
#include "../werror.h"
void log_bug(const char *format, ... ) {
va_list args;
va_start(args, format);
werror(format, args);
va_end(args);
}
void log_error(const char *format, ... ) {
va_list args;
va_start(args, format);
werror(format, args);
va_end(args);
}
void log_fatal(const char *format, ... ) {
va_list args;
va_start(args, format);
log_error(format, args);
va_end(args);
exit(EXIT_FAILURE);
}
#ifndef _UTIL_H
#define _UTIL_H
/* Bridge from GPG style to lsh style */
#include "lsh_types.h"
/* Report a bug (TODO: do what afterwards? ) */
void log_bug(const char *fmt, ... ) PRINTF_STYLE(1,2);
/* Report an error */
void log_error(const char *fmt, ... ) PRINTF_STYLE(1,2);
/* Report a fatal error and die */
void log_fatal(const char *fmt, ... ) PRINTF_STYLE(1,2) NORETURN;
#ifndef G10ERR_WEAK_KEY
#define G10ERR_WEAK_KEY 43
#elif G10ERR_WEAK_KEY != 43
#error G10ERR_WEAK_KEY is defined to a wrong value.
#endif
#endif /* _UTIL_H */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment