mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
cast5 does now work
This commit is contained in:
parent
aa713cb0f5
commit
53a578711f
22 changed files with 644 additions and 183 deletions
|
@ -1,19 +1,23 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl -I../intl
|
||||
needed_libs = ../cipher/libcipher.a ../util/libutil.a ../mpi/libmpi.a ../util/libutil.a
|
||||
needed_libs = ../cipher/libcipher.a ../util/libutil.a \
|
||||
../mpi/libmpi.a ../util/libutil.a
|
||||
|
||||
noinst_PROGRAMS = mpicalc bftest clean-sat
|
||||
noinst_PROGRAMS = mpicalc bftest cast5test clean-sat
|
||||
|
||||
mpicalc_SOURCES = mpicalc.c
|
||||
|
||||
bftest_SOURCES = bftest.c
|
||||
|
||||
cast5test_SOURCES = cast5test.c
|
||||
|
||||
clean_sat_SOURCES = clean-sat.c
|
||||
|
||||
|
||||
mpicalc_LDADD = @INTLLIBS@ $(needed_libs)
|
||||
bftest_LDADD = @INTLLIBS@ $(needed_libs)
|
||||
cast5test_LDADD = @INTLLIBS@ $(needed_libs)
|
||||
|
||||
mpicalc bftest: $(needed_libs)
|
||||
mpicalc bftest cast5test: $(needed_libs)
|
||||
|
||||
|
|
|
@ -93,18 +93,22 @@ ZLIBS = @ZLIBS@
|
|||
l = @l@
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl -I../intl
|
||||
needed_libs = ../cipher/libcipher.a ../util/libutil.a ../mpi/libmpi.a ../util/libutil.a
|
||||
needed_libs = ../cipher/libcipher.a ../util/libutil.a \
|
||||
../mpi/libmpi.a ../util/libutil.a
|
||||
|
||||
noinst_PROGRAMS = mpicalc bftest clean-sat
|
||||
noinst_PROGRAMS = mpicalc bftest cast5test clean-sat
|
||||
|
||||
mpicalc_SOURCES = mpicalc.c
|
||||
|
||||
bftest_SOURCES = bftest.c
|
||||
|
||||
cast5test_SOURCES = cast5test.c
|
||||
|
||||
clean_sat_SOURCES = clean-sat.c
|
||||
|
||||
mpicalc_LDADD = @INTLLIBS@ $(needed_libs)
|
||||
bftest_LDADD = @INTLLIBS@ $(needed_libs)
|
||||
cast5test_LDADD = @INTLLIBS@ $(needed_libs)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/scripts/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
|
@ -123,6 +127,10 @@ bftest_OBJECTS = bftest.o
|
|||
bftest_DEPENDENCIES = ../cipher/libcipher.a ../util/libutil.a \
|
||||
../mpi/libmpi.a ../util/libutil.a
|
||||
bftest_LDFLAGS =
|
||||
cast5test_OBJECTS = cast5test.o
|
||||
cast5test_DEPENDENCIES = ../cipher/libcipher.a ../util/libutil.a \
|
||||
../mpi/libmpi.a ../util/libutil.a
|
||||
cast5test_LDFLAGS =
|
||||
clean_sat_OBJECTS = clean-sat.o
|
||||
clean_sat_LDADD = $(LDADD)
|
||||
clean_sat_DEPENDENCIES =
|
||||
|
@ -137,9 +145,10 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
|||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
DEP_FILES = .deps/bftest.P .deps/clean-sat.P .deps/mpicalc.P
|
||||
SOURCES = $(mpicalc_SOURCES) $(bftest_SOURCES) $(clean_sat_SOURCES)
|
||||
OBJECTS = $(mpicalc_OBJECTS) $(bftest_OBJECTS) $(clean_sat_OBJECTS)
|
||||
DEP_FILES = .deps/bftest.P .deps/cast5test.P .deps/clean-sat.P \
|
||||
.deps/mpicalc.P
|
||||
SOURCES = $(mpicalc_SOURCES) $(bftest_SOURCES) $(cast5test_SOURCES) $(clean_sat_SOURCES)
|
||||
OBJECTS = $(mpicalc_OBJECTS) $(bftest_OBJECTS) $(cast5test_OBJECTS) $(clean_sat_OBJECTS)
|
||||
|
||||
default: all
|
||||
|
||||
|
@ -186,6 +195,10 @@ bftest: $(bftest_OBJECTS) $(bftest_DEPENDENCIES)
|
|||
@rm -f bftest
|
||||
$(LINK) $(bftest_LDFLAGS) $(bftest_OBJECTS) $(bftest_LDADD) $(LIBS)
|
||||
|
||||
cast5test: $(cast5test_OBJECTS) $(cast5test_DEPENDENCIES)
|
||||
@rm -f cast5test
|
||||
$(LINK) $(cast5test_LDFLAGS) $(cast5test_OBJECTS) $(cast5test_LDADD) $(LIBS)
|
||||
|
||||
clean-sat: $(clean_sat_OBJECTS) $(clean_sat_DEPENDENCIES)
|
||||
@rm -f clean-sat
|
||||
$(LINK) $(clean_sat_LDFLAGS) $(clean_sat_OBJECTS) $(clean_sat_LDADD) $(LIBS)
|
||||
|
@ -320,7 +333,7 @@ installdirs mostlyclean-generic distclean-generic clean-generic \
|
|||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
mpicalc bftest: $(needed_libs)
|
||||
mpicalc bftest cast5test: $(needed_libs)
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
|
108
tools/cast5test.c
Normal file
108
tools/cast5test.c
Normal file
|
@ -0,0 +1,108 @@
|
|||
/* cast5test.c - CAST5 test program
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef __MINGW32__
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#include "util.h"
|
||||
#include "cipher.h"
|
||||
#include "i18n.h"
|
||||
|
||||
static void
|
||||
my_usage(void)
|
||||
{
|
||||
fprintf(stderr, "usage: cast5test [-e][-d] key\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
const char *
|
||||
strusage( int level )
|
||||
{
|
||||
return default_strusage(level);
|
||||
}
|
||||
|
||||
static void
|
||||
i18n_init(void)
|
||||
{
|
||||
#ifdef ENABLE_NLS
|
||||
#ifdef HAVE_LC_MESSAGES
|
||||
setlocale( LC_MESSAGES, "" );
|
||||
#else
|
||||
setlocale( LC_ALL, "" );
|
||||
#endif
|
||||
bindtextdomain( PACKAGE, G10_LOCALEDIR );
|
||||
textdomain( PACKAGE );
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int encode=0;
|
||||
CAST5_context ctx;
|
||||
char buf[100];
|
||||
int n, size=100;
|
||||
|
||||
#ifdef __MINGW32__
|
||||
setmode( fileno(stdin), O_BINARY );
|
||||
setmode( fileno(stdout), O_BINARY );
|
||||
#endif
|
||||
|
||||
i18n_init();
|
||||
if( argc > 1 && !strcmp(argv[1], "-e") ) {
|
||||
encode++;
|
||||
argc--; argv++;
|
||||
}
|
||||
else if( argc > 1 && !strcmp(argv[1], "-E") ) {
|
||||
encode++;
|
||||
argc--; argv++;
|
||||
size = 10;
|
||||
}
|
||||
else if( argc > 1 && !strcmp(argv[1], "-d") ) {
|
||||
argc--; argv++;
|
||||
}
|
||||
else if( argc > 1 && !strcmp(argv[1], "-D") ) {
|
||||
argc--; argv++;
|
||||
size = 10;
|
||||
}
|
||||
if( argc != 2 )
|
||||
my_usage();
|
||||
argc--; argv++;
|
||||
|
||||
cast5_setkey( &ctx, *argv, strlen(*argv) );
|
||||
cast5_setiv( &ctx, NULL );
|
||||
while( (n = fread( buf, 1, size, stdin )) > 0 ) {
|
||||
if( encode )
|
||||
cast5_encode_cfb( &ctx, buf, buf, n );
|
||||
else
|
||||
cast5_decode_cfb( &ctx, buf, buf, n );
|
||||
if( fwrite( buf, 1, n, stdout) != n )
|
||||
log_fatal("write error\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue