mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
Renamed to GNUPG
This commit is contained in:
parent
9119f2bf59
commit
5a05af2bca
144 changed files with 1279 additions and 1035 deletions
|
@ -1,3 +1,24 @@
|
|||
Tue Feb 24 15:51:55 1998 Werner Koch (wk@isil.d.shuttle.de)
|
||||
|
||||
* parse-packet.c (parse_certificate): Support for S2K.
|
||||
* build-packet.c (do_secret_cert): Ditto.
|
||||
* keygen.c (gen_elg): Ditto.
|
||||
* seckey-cert.c (check_elg): Ditto
|
||||
(protect_elg): Ditto.
|
||||
* sign.c (chnage_passphrase): Ditto.
|
||||
* passphrase.c (get_passphrase_hash): Support for a salt and
|
||||
changed all callers.
|
||||
(make_dek_from_passphrase): Ditto.
|
||||
|
||||
Tue Feb 24 12:30:56 1998 Werner Koch (wk@isil.d.shuttle.de)
|
||||
|
||||
* build-packet.c (hash_public_cert): Disabled debug output.
|
||||
|
||||
Fri Feb 20 17:22:28 1998 Werner Koch (wk@isil.d.shuttle.de)
|
||||
|
||||
* trustdb.c (init_trustdb) [MINGW32]: Removed 2nd mkdir arg.
|
||||
(keyring_copy) [MINGW32]: Add a remove prior to the renames.
|
||||
|
||||
Wed Feb 18 18:39:02 1998 Werner Koch (wk@isil.d.shuttle.de)
|
||||
|
||||
* Makefile.am (OMIT_DEPENDENCIES): New.
|
||||
|
|
|
@ -5,7 +5,7 @@ EXTRA_DIST = OPTIONS pubring.asc
|
|||
OMIT_DEPENDENCIES = zlib.h zconf.h
|
||||
needed_libs = ../cipher/libcipher.a ../mpi/libmpi.a ../util/libutil.a
|
||||
|
||||
bin_PROGRAMS = g10 g10maint
|
||||
bin_PROGRAMS = gpg gpgm
|
||||
|
||||
common_source = \
|
||||
build-packet.c \
|
||||
|
@ -49,12 +49,12 @@ common_source = \
|
|||
revoke.c \
|
||||
sig-check.c
|
||||
|
||||
g10_SOURCES = g10.c \
|
||||
gpg_SOURCES = g10.c \
|
||||
$(common_source) \
|
||||
keygen.c
|
||||
|
||||
|
||||
g10maint_SOURCES = g10maint.c \
|
||||
gpgm_SOURCES = g10maint.c \
|
||||
dearmor.c \
|
||||
$(common_source)
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ EXTRA_DIST = OPTIONS pubring.asc
|
|||
OMIT_DEPENDENCIES = zlib.h zconf.h
|
||||
needed_libs = ../cipher/libcipher.a ../mpi/libmpi.a ../util/libutil.a
|
||||
|
||||
bin_PROGRAMS = g10 g10maint
|
||||
bin_PROGRAMS = gpg gpgm
|
||||
|
||||
common_source = \
|
||||
build-packet.c \
|
||||
|
@ -135,11 +135,11 @@ common_source = \
|
|||
revoke.c \
|
||||
sig-check.c
|
||||
|
||||
g10_SOURCES = g10.c \
|
||||
gpg_SOURCES = g10.c \
|
||||
$(common_source) \
|
||||
keygen.c
|
||||
|
||||
g10maint_SOURCES = g10maint.c \
|
||||
gpgm_SOURCES = g10maint.c \
|
||||
dearmor.c \
|
||||
$(common_source)
|
||||
|
||||
|
@ -154,26 +154,26 @@ DEFS = @DEFS@ -I. -I$(srcdir) -I..
|
|||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
g10_OBJECTS = g10.o build-packet.o compress.o free-packet.o getkey.o \
|
||||
gpg_OBJECTS = g10.o build-packet.o compress.o free-packet.o getkey.o \
|
||||
pkclist.o skclist.o ringedit.o kbnode.o mainproc.o armor.o mdfilter.o \
|
||||
textfilter.o cipher.o elg.o rsa.o openfile.o keyid.o trustdb.o \
|
||||
parse-packet.o passphrase.o pubkey-enc.o seckey-cert.o seskey.o \
|
||||
import.o export.o comment.o status.o sign.o plaintext.o encr-data.o \
|
||||
encode.o revoke.o sig-check.o keygen.o
|
||||
g10_LDADD = $(LDADD)
|
||||
g10_DEPENDENCIES = ../cipher/libcipher.a ../mpi/libmpi.a \
|
||||
gpg_LDADD = $(LDADD)
|
||||
gpg_DEPENDENCIES = ../cipher/libcipher.a ../mpi/libmpi.a \
|
||||
../util/libutil.a
|
||||
g10_LDFLAGS =
|
||||
g10maint_OBJECTS = g10maint.o dearmor.o build-packet.o compress.o \
|
||||
gpg_LDFLAGS =
|
||||
gpgm_OBJECTS = g10maint.o dearmor.o build-packet.o compress.o \
|
||||
free-packet.o getkey.o pkclist.o skclist.o ringedit.o kbnode.o \
|
||||
mainproc.o armor.o mdfilter.o textfilter.o cipher.o elg.o rsa.o \
|
||||
openfile.o keyid.o trustdb.o parse-packet.o passphrase.o pubkey-enc.o \
|
||||
seckey-cert.o seskey.o import.o export.o comment.o status.o sign.o \
|
||||
plaintext.o encr-data.o encode.o revoke.o sig-check.o
|
||||
g10maint_LDADD = $(LDADD)
|
||||
g10maint_DEPENDENCIES = ../cipher/libcipher.a ../mpi/libmpi.a \
|
||||
gpgm_LDADD = $(LDADD)
|
||||
gpgm_DEPENDENCIES = ../cipher/libcipher.a ../mpi/libmpi.a \
|
||||
../util/libutil.a
|
||||
g10maint_LDFLAGS =
|
||||
gpgm_LDFLAGS =
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
|
||||
LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
|
@ -194,8 +194,8 @@ DEP_FILES = .deps/armor.P .deps/build-packet.P .deps/cipher.P \
|
|||
.deps/revoke.P .deps/ringedit.P .deps/rsa.P .deps/seckey-cert.P \
|
||||
.deps/seskey.P .deps/sig-check.P .deps/sign.P .deps/skclist.P \
|
||||
.deps/status.P .deps/textfilter.P .deps/trustdb.P
|
||||
SOURCES = $(g10_SOURCES) $(g10maint_SOURCES)
|
||||
OBJECTS = $(g10_OBJECTS) $(g10maint_OBJECTS)
|
||||
SOURCES = $(gpg_SOURCES) $(gpgm_SOURCES)
|
||||
OBJECTS = $(gpg_OBJECTS) $(gpgm_OBJECTS)
|
||||
|
||||
default: all
|
||||
|
||||
|
@ -253,13 +253,13 @@ distclean-compile:
|
|||
|
||||
maintainer-clean-compile:
|
||||
|
||||
g10: $(g10_OBJECTS) $(g10_DEPENDENCIES)
|
||||
@rm -f g10
|
||||
$(LINK) $(g10_LDFLAGS) $(g10_OBJECTS) $(g10_LDADD) $(LIBS)
|
||||
gpg: $(gpg_OBJECTS) $(gpg_DEPENDENCIES)
|
||||
@rm -f gpg
|
||||
$(LINK) $(gpg_LDFLAGS) $(gpg_OBJECTS) $(gpg_LDADD) $(LIBS)
|
||||
|
||||
g10maint: $(g10maint_OBJECTS) $(g10maint_DEPENDENCIES)
|
||||
@rm -f g10maint
|
||||
$(LINK) $(g10maint_LDFLAGS) $(g10maint_OBJECTS) $(g10maint_LDADD) $(LIBS)
|
||||
gpgm: $(gpgm_OBJECTS) $(gpgm_DEPENDENCIES)
|
||||
@rm -f gpgm
|
||||
$(LINK) $(gpgm_LDFLAGS) $(gpgm_OBJECTS) $(gpgm_LDADD) $(LIBS)
|
||||
|
||||
tags: TAGS
|
||||
|
||||
|
|
10
g10/armor.c
10
g10/armor.c
|
@ -1,14 +1,14 @@
|
|||
/* armor.c - Armor filter
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
@ -942,7 +942,7 @@ armor_filter( void *opaque, int control,
|
|||
iobuf_writestr(a, "-----");
|
||||
iobuf_writestr(a, head_strings[afx->what] );
|
||||
iobuf_writestr(a, "-----\n");
|
||||
iobuf_writestr(a, "Version: G10 v" VERSION " ("
|
||||
iobuf_writestr(a, "Version: GNUPG v" VERSION " ("
|
||||
PRINTABLE_OS_NAME ")\n");
|
||||
iobuf_writestr(a, "Comment: This is an alpha version!\n");
|
||||
if( afx->hdrlines )
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* build-packet.c - assemble packets and write them
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
@ -211,7 +211,7 @@ hash_public_cert( MD_HANDLE md, PKT_public_cert *pkc )
|
|||
int rc = 0;
|
||||
int c;
|
||||
IOBUF a = iobuf_temp();
|
||||
#if 1
|
||||
#if 0
|
||||
FILE *fp = fopen("dump.pkc", "a");
|
||||
int i=0;
|
||||
|
||||
|
@ -225,7 +225,7 @@ hash_public_cert( MD_HANDLE md, PKT_public_cert *pkc )
|
|||
if( (rc = build_packet( a, &pkt )) )
|
||||
log_fatal("build public_cert for hashing failed: %s\n", g10_errstr(rc));
|
||||
while( (c=iobuf_get(a)) != -1 ) {
|
||||
#if 1
|
||||
#if 0
|
||||
fprintf( fp," %02x", c );
|
||||
if( (++i == 24) ) {
|
||||
putc('\n', fp);
|
||||
|
@ -234,7 +234,7 @@ hash_public_cert( MD_HANDLE md, PKT_public_cert *pkc )
|
|||
#endif
|
||||
md_putc( md, c );
|
||||
}
|
||||
#if 1
|
||||
#if 0
|
||||
putc('\n', fp);
|
||||
fclose(fp);
|
||||
#endif
|
||||
|
@ -260,9 +260,16 @@ do_secret_cert( IOBUF out, int ctb, PKT_secret_cert *skc )
|
|||
mpi_write(a, skc->d.elg.g );
|
||||
mpi_write(a, skc->d.elg.y );
|
||||
if( skc->d.elg.is_protected ) {
|
||||
assert( skc->d.elg.protect_algo == CIPHER_ALGO_BLOWFISH );
|
||||
iobuf_put(a, skc->d.elg.protect_algo );
|
||||
iobuf_write(a, skc->d.elg.protect.blowfish.iv, 8 );
|
||||
iobuf_put(a, 0xff );
|
||||
iobuf_put(a, skc->d.elg.protect.algo );
|
||||
iobuf_put(a, skc->d.elg.protect.s2k );
|
||||
iobuf_put(a, skc->d.elg.protect.hash );
|
||||
if( skc->d.elg.protect.s2k == 1
|
||||
|| skc->d.elg.protect.s2k == 3 )
|
||||
iobuf_write(a, skc->d.elg.protect.salt, 8 );
|
||||
if( skc->d.elg.protect.s2k == 3 )
|
||||
iobuf_put(a, skc->d.elg.protect.count );
|
||||
iobuf_write(a, skc->d.elg.protect.iv, 8 );
|
||||
}
|
||||
else
|
||||
iobuf_put(a, 0 );
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* cipher.c - En-/De-ciphering filter
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* comment.c - write comment stuff
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* compress.c - compress filter
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* elg.c
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
14
g10/encode.c
14
g10/encode.c
|
@ -1,14 +1,14 @@
|
|||
/* encode.c - encode data
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
@ -89,7 +89,7 @@ encode_simple( const char *filename, int mode )
|
|||
if( mode ) {
|
||||
cfx.dek = m_alloc_secure( sizeof *cfx.dek );
|
||||
cfx.dek->algo = opt.def_cipher_algo;
|
||||
if( (rc = make_dek_from_passphrase( cfx.dek , 2 )) ) {
|
||||
if( (rc = make_dek_from_passphrase( cfx.dek , 2, NULL )) ) {
|
||||
m_free(cfx.dek);
|
||||
iobuf_close(inp);
|
||||
log_error("error creating passphrase: %s\n", g10_errstr(rc) );
|
||||
|
@ -106,7 +106,7 @@ encode_simple( const char *filename, int mode )
|
|||
if( opt.armor )
|
||||
iobuf_push_filter( out, armor_filter, &afx );
|
||||
|
||||
write_comment( out, "#created by G10 v" VERSION " ("
|
||||
write_comment( out, "#created by GNUPG v" VERSION " ("
|
||||
PRINTABLE_OS_NAME ")");
|
||||
|
||||
if( opt.compress )
|
||||
|
@ -193,7 +193,7 @@ encode_crypt( const char *filename, STRLIST remusr )
|
|||
if( opt.armor )
|
||||
iobuf_push_filter( out, armor_filter, &afx );
|
||||
|
||||
write_comment( out, "#created by G10 v" VERSION " ("
|
||||
write_comment( out, "#created by GNUPG v" VERSION " ("
|
||||
PRINTABLE_OS_NAME ")");
|
||||
|
||||
if( opt.compress )
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* encr-data.c - process an encrypted data packet
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* export.c
|
||||
* Copyright (c) 1998 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* filter.h
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* free-packet.c - cleanup stuff for packets
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
30
g10/g10.c
30
g10/g10.c
|
@ -1,14 +1,14 @@
|
|||
/* g10.c - The G10 utility
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
/* g10.c - The GNUPG utility (main for gpg)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
@ -110,7 +110,7 @@ static ARGPARSE_OPTS opts[] = {
|
|||
{ 523, "passphrase-fd",1, "\r" },
|
||||
{ 541, "no-operation", 0, "\r" }, /* used by regression tests */
|
||||
{ 543, "no-options", 0, "\r" }, /* shortcut for --options /dev/null */
|
||||
{ 544, "homedir", 2, "\r" }, /* defaults to "~/.g10" */
|
||||
{ 544, "homedir", 2, "\r" }, /* defaults to "~/.gnupg" */
|
||||
{ 545, "no-batch", 0, "\r" },
|
||||
|
||||
{0} };
|
||||
|
@ -137,18 +137,18 @@ strusage( int level )
|
|||
static char *digests, *pubkeys, *ciphers;
|
||||
const char *p;
|
||||
switch( level ) {
|
||||
case 11: p = "g10"; break;
|
||||
case 11: p = "GNUPG"; break;
|
||||
case 13: p = VERSION; break;
|
||||
case 17: p = PRINTABLE_OS_NAME; break;
|
||||
case 19: p = _(
|
||||
"Please report bugs to <g10-bugs@isil.d.shuttle.de>."
|
||||
"Please report bugs to <gnupg-bugs@isil.d.shuttle.de>.\n"
|
||||
); break;
|
||||
case 1:
|
||||
case 40: p = _(
|
||||
"Usage: g10 [options] [files] (-h for help)"
|
||||
"Usage: gpg [options] [files] (-h for help)"
|
||||
); break;
|
||||
case 41: p = _(
|
||||
"Syntax: g10 [options] [files]\n"
|
||||
"Syntax: gpg [options] [files]\n"
|
||||
"sign, check, encrypt or decrypt\n"
|
||||
"default operation depends on the input data\n"
|
||||
); break;
|
||||
|
@ -223,7 +223,7 @@ i18n_init(void)
|
|||
static void
|
||||
wrong_args( const char *text)
|
||||
{
|
||||
fputs(_("usage: g10 [options] "),stderr);
|
||||
fputs(_("usage: gpg [options] "),stderr);
|
||||
fputs(text,stderr);
|
||||
putc('\n',stderr);
|
||||
g10_exit(2);
|
||||
|
@ -318,7 +318,7 @@ main( int argc, char **argv )
|
|||
* secmem_init() somewhere after the option parsing
|
||||
*/
|
||||
|
||||
log_set_name("g10");
|
||||
log_set_name("gpg");
|
||||
i18n_init();
|
||||
opt.compress = -1; /* defaults to standard compress level */
|
||||
opt.def_cipher_algo = CIPHER_ALGO_BLOWFISH;
|
||||
|
@ -326,7 +326,7 @@ main( int argc, char **argv )
|
|||
opt.def_digest_algo = DIGEST_ALGO_RMD160;
|
||||
opt.completes_needed = 1;
|
||||
opt.marginals_needed = 3;
|
||||
opt.homedir = "~/.g10";
|
||||
opt.homedir = "~/.gnupg";
|
||||
|
||||
/* check wether we have a config file on the commandline */
|
||||
orig_argc = argc;
|
||||
|
@ -501,9 +501,9 @@ main( int argc, char **argv )
|
|||
set_packet_list_mode(1);
|
||||
|
||||
if( !sec_nrings || default_keyring ) /* add default secret rings */
|
||||
add_secret_keyring("secring.g10");
|
||||
add_secret_keyring("secring.gpg");
|
||||
if( !nrings || default_keyring ) /* add default ring */
|
||||
add_keyring("pubring.g10");
|
||||
add_keyring("pubring.gpg");
|
||||
|
||||
if( argc ) {
|
||||
fname_print = fname = *argv;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* g10maint.c - The G10 maintenance utility
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
/* g10maint.c - The GNUPG maintenance utility
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
@ -62,19 +62,19 @@ strusage( int level )
|
|||
static char *digests, *pubkeys, *ciphers;
|
||||
const char *p;
|
||||
switch( level ) {
|
||||
case 11: p = "g10maint"; break;
|
||||
case 11: p = "gpgm (GNUPG)"; break;
|
||||
case 13: p = VERSION; break;
|
||||
case 17: p = PRINTABLE_OS_NAME; break;
|
||||
case 19: p = _(
|
||||
"Please report bugs to <g10-bugs@isil.d.shuttle.de>."
|
||||
"Please report bugs to <gnupg-bugs@isil.d.shuttle.de>.\n"
|
||||
); break;
|
||||
case 1:
|
||||
case 40: p = _(
|
||||
"Usage: g10maint [options] [files] (-h for help)"
|
||||
"Usage: gpgm [options] [files] (-h for help)"
|
||||
); break;
|
||||
case 41: p = _(
|
||||
"Syntax: g10maint [options] [files]\n"
|
||||
"G10 maintenance utility\n"
|
||||
"Syntax: gpgm [options] [files]\n"
|
||||
"GNUPG maintenance utility\n"
|
||||
); break;
|
||||
|
||||
case 31: p = "\n"; break;
|
||||
|
@ -146,7 +146,7 @@ i18n_init(void)
|
|||
static void
|
||||
wrong_args( const char *text)
|
||||
{
|
||||
fputs(_("Usage: g10maint [options] "),stderr);
|
||||
fputs(_("Usage: gpgm [options] "),stderr);
|
||||
fputs(text,stderr);
|
||||
putc('\n',stderr);
|
||||
g10_exit(2);
|
||||
|
@ -221,7 +221,7 @@ main( int argc, char **argv )
|
|||
{ 538, "trustdb-name", 2, "\r" },
|
||||
{ 540, "no-secmem-warning", 0, "\r" }, /* dummy */
|
||||
{ 543, "no-options", 0, "\r" }, /* shortcut for --options /dev/null */
|
||||
{ 544, "homedir", 2, "\r" }, /* defaults to "~/.g10" */
|
||||
{ 544, "homedir", 2, "\r" }, /* defaults to "~/.gpg" */
|
||||
{ 545, "no-batch", 0, "\r" },
|
||||
{ 546, "dearmor", 0, N_("De-Armor a file or stdin") },
|
||||
{ 547, "enarmor", 0, N_("En-Armor a file or stdin") },
|
||||
|
@ -250,7 +250,7 @@ main( int argc, char **argv )
|
|||
|
||||
secmem_init( 0 ); /* disable use of secmem */
|
||||
|
||||
log_set_name("g10maint");
|
||||
log_set_name("gpgm");
|
||||
i18n_init();
|
||||
opt.compress = -1; /* defaults to standard compress level */
|
||||
opt.def_cipher_algo = CIPHER_ALGO_BLOWFISH;
|
||||
|
@ -258,7 +258,7 @@ main( int argc, char **argv )
|
|||
opt.def_digest_algo = DIGEST_ALGO_RMD160;
|
||||
opt.completes_needed = 1;
|
||||
opt.marginals_needed = 3;
|
||||
opt.homedir = "~/.g10";
|
||||
opt.homedir = "~/.gnupg";
|
||||
|
||||
/* check wether we have a config file on the commandline */
|
||||
orig_argc = argc;
|
||||
|
@ -424,12 +424,12 @@ main( int argc, char **argv )
|
|||
|
||||
if( cmd != aDeArmor && cmd != aEnArmor ) {
|
||||
if( !sec_nrings || default_keyring ) { /* add default secret rings */
|
||||
char *p = make_filename(opt.homedir, "secring.g10", NULL );
|
||||
char *p = make_filename(opt.homedir, "secring.gpg", NULL );
|
||||
add_secret_keyring(p);
|
||||
m_free(p);
|
||||
}
|
||||
if( !nrings || default_keyring ) { /* add default ring */
|
||||
char *p = make_filename(opt.homedir, "pubring.g10", NULL );
|
||||
char *p = make_filename(opt.homedir, "pubring.gpg", NULL );
|
||||
add_keyring(p);
|
||||
m_free(p);
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* getkey.c - Get a key from the database
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* import.c
|
||||
* Copyright (c) 1998 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* kbnode.c - keyblock node utility functions
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
12
g10/keydb.h
12
g10/keydb.h
|
@ -1,14 +1,14 @@
|
|||
/* keydb.h - Key database
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
@ -95,8 +95,8 @@ int build_skc_list( STRLIST locusr, SKC_LIST *ret_skc_list, int unlock );
|
|||
/*-- passphrase.h --*/
|
||||
void set_passphrase_fd( int fd );
|
||||
int get_passphrase_fd(void);
|
||||
DEK *get_passphrase_hash( u32 *keyid, char *text );
|
||||
int make_dek_from_passphrase( DEK *dek, int mode );
|
||||
DEK *get_passphrase_hash( u32 *keyid, char *text, byte *salt );
|
||||
int make_dek_from_passphrase( DEK *dek, int mode, byte *salt );
|
||||
|
||||
/*-- getkey.c --*/
|
||||
void add_keyring( const char *name );
|
||||
|
|
42
g10/keygen.c
42
g10/keygen.c
|
@ -1,14 +1,14 @@
|
|||
/* keygen.c - generate a key pair
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
@ -136,7 +136,7 @@ write_selfsig( KBNODE root, KBNODE pub_root, PKT_secret_cert *skc )
|
|||
|
||||
static int
|
||||
gen_elg(unsigned nbits, KBNODE pub_root, KBNODE sec_root, DEK *dek,
|
||||
PKT_secret_cert **ret_skc )
|
||||
byte *salt, PKT_secret_cert **ret_skc )
|
||||
{
|
||||
int rc;
|
||||
int i;
|
||||
|
@ -162,15 +162,18 @@ gen_elg(unsigned nbits, KBNODE pub_root, KBNODE sec_root, DEK *dek,
|
|||
skc->d.elg.y = sk.y;
|
||||
skc->d.elg.x = sk.x;
|
||||
skc->d.elg.is_protected = 0;
|
||||
skc->d.elg.protect_algo = 0;
|
||||
skc->d.elg.protect.algo = 0;
|
||||
|
||||
skc->d.elg.csum = checksum_mpi( skc->d.elg.x );
|
||||
/* return an unprotected version of the skc */
|
||||
*ret_skc = copy_secret_cert( NULL, skc );
|
||||
|
||||
if( dek ) {
|
||||
skc->d.elg.protect_algo = CIPHER_ALGO_BLOWFISH;
|
||||
randomize_buffer(skc->d.elg.protect.blowfish.iv, 8, 1);
|
||||
skc->d.elg.protect.algo = CIPHER_ALGO_BLOWFISH;
|
||||
skc->d.elg.protect.s2k = 1;
|
||||
skc->d.elg.protect.hash = DIGEST_ALGO_RMD160;
|
||||
memcpy(skc->d.elg.protect.salt, salt, 8);
|
||||
randomize_buffer(skc->d.elg.protect.iv, 8, 1);
|
||||
rc = protect_secret_key( skc, dek );
|
||||
if( rc ) {
|
||||
log_error("protect_secret_key failed: %s\n", g10_errstr(rc) );
|
||||
|
@ -203,7 +206,7 @@ gen_elg(unsigned nbits, KBNODE pub_root, KBNODE sec_root, DEK *dek,
|
|||
#ifdef ENABLE_RSA_KEYGEN
|
||||
static int
|
||||
gen_rsa(unsigned nbits, KBNODE pub_root, KBNODE sec_root, DEK *dek,
|
||||
PKT_secret_cert **ret_skc )
|
||||
byte *salt, PKT_secret_cert **ret_skc )
|
||||
{
|
||||
int rc;
|
||||
PACKET *pkt;
|
||||
|
@ -267,7 +270,7 @@ gen_rsa(unsigned nbits, KBNODE pub_root, KBNODE sec_root, DEK *dek,
|
|||
|
||||
static int
|
||||
gen_dsa(unsigned nbits, KBNODE pub_root, KBNODE sec_root, DEK *dek,
|
||||
PKT_secret_cert **ret_skc )
|
||||
byte *salt, PKT_secret_cert **ret_skc )
|
||||
{
|
||||
return G10ERR_GENERAL;
|
||||
}
|
||||
|
@ -289,6 +292,7 @@ generate_keypair()
|
|||
KBNODE sec_root = NULL;
|
||||
PKT_secret_cert *skc = NULL;
|
||||
DEK *dek = NULL;
|
||||
byte *salt;
|
||||
int rc;
|
||||
int algo;
|
||||
const char *algo_name;
|
||||
|
@ -499,9 +503,11 @@ generate_keypair()
|
|||
tty_printf(_("You need a Passphrase to protect your secret key.\n\n") );
|
||||
|
||||
dek = m_alloc_secure( sizeof *dek );
|
||||
salt = (byte*)dek + sizeof *dek;
|
||||
for(;;) {
|
||||
dek->algo = CIPHER_ALGO_BLOWFISH;
|
||||
rc = make_dek_from_passphrase( dek , 2 );
|
||||
randomize_buffer(salt, 8, 1);
|
||||
rc = make_dek_from_passphrase( dek , 2, salt );
|
||||
if( rc == -1 ) {
|
||||
m_free(dek); dek = NULL;
|
||||
tty_printf(_(
|
||||
|
@ -525,8 +531,8 @@ generate_keypair()
|
|||
|
||||
|
||||
/* now check wether we a are allowed to write to the keyrings */
|
||||
pub_fname = make_filename(opt.homedir, "pubring.g10", NULL );
|
||||
sec_fname = make_filename(opt.homedir, "secring.g10", NULL );
|
||||
pub_fname = make_filename(opt.homedir, "pubring.gpg", NULL );
|
||||
sec_fname = make_filename(opt.homedir, "secring.gpg", NULL );
|
||||
if( opt.verbose ) {
|
||||
tty_printf(_("writing public certificate to '%s'\n"), pub_fname );
|
||||
tty_printf(_("writing secret certificate to '%s'\n"), sec_fname );
|
||||
|
@ -547,21 +553,21 @@ generate_keypair()
|
|||
"number generator a better chance to gain enough entropy.\n") );
|
||||
|
||||
if( algo == PUBKEY_ALGO_ELGAMAL )
|
||||
rc = gen_elg(nbits, pub_root, sec_root, dek, &skc );
|
||||
rc = gen_elg(nbits, pub_root, sec_root, dek, salt, &skc );
|
||||
#ifdef ENABLE_RSA_KEYGEN
|
||||
else if( algo == PUBKEY_ALGO_RSA )
|
||||
rc = gen_rsa(nbits, pub_root, sec_root, dek, &skc );
|
||||
rc = gen_rsa(nbits, pub_root, sec_root, dek, salt, &skc );
|
||||
#endif
|
||||
else if( algo == PUBKEY_ALGO_DSA )
|
||||
rc = gen_dsa(nbits, pub_root, sec_root, dek, &skc );
|
||||
rc = gen_dsa(nbits, pub_root, sec_root, dek, salt, &skc );
|
||||
else
|
||||
BUG();
|
||||
if( !rc ) {
|
||||
add_kbnode( pub_root,
|
||||
make_comment_node("#created by G10 v" VERSION " ("
|
||||
make_comment_node("#created by GNUPG v" VERSION " ("
|
||||
PRINTABLE_OS_NAME ")"));
|
||||
add_kbnode( sec_root,
|
||||
make_comment_node("#created by G10 v" VERSION " ("
|
||||
make_comment_node("#created by GNUPG v" VERSION " ("
|
||||
PRINTABLE_OS_NAME ")"));
|
||||
}
|
||||
if( !rc )
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* keyid.c - jeyid and fingerprint handling
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* main.h
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* mainproc.c - handle packets
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
@ -189,7 +189,7 @@ proc_encrypted( CTX c, PACKET *pkt )
|
|||
/* assume this is conventional encrypted data */
|
||||
c->dek = m_alloc_secure( sizeof *c->dek );
|
||||
c->dek->algo = opt.def_cipher_algo;
|
||||
result = make_dek_from_passphrase( c->dek, 0 );
|
||||
result = make_dek_from_passphrase( c->dek, 0, NULL );
|
||||
}
|
||||
else if( !c->dek )
|
||||
result = G10ERR_NO_SECKEY;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* mdfilter.c - filter data and calculate a message digest
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* openfile.c
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
@ -81,7 +81,7 @@ overwrite_filep( const char *fname )
|
|||
/****************
|
||||
* Make an output filename for the inputfile INAME.
|
||||
* Returns an IOBUF
|
||||
* Mode 0 = use ".g10"
|
||||
* Mode 0 = use ".gpg"
|
||||
* 1 = use ".asc"
|
||||
* 2 = use ".sig"
|
||||
*/
|
||||
|
@ -106,7 +106,7 @@ open_outfile( const char *iname, int mode )
|
|||
else {
|
||||
buf = m_alloc(strlen(iname)+4+1);
|
||||
strcpy(stpcpy(buf,iname), mode==1 ? ".asc" :
|
||||
mode==2 ? ".sig" : ".g10");
|
||||
mode==2 ? ".sig" : ".gpg");
|
||||
name = buf;
|
||||
}
|
||||
if( !(rc=overwrite_filep( name )) ) {
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* options.h
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
25
g10/packet.h
25
g10/packet.h
|
@ -1,14 +1,14 @@
|
|||
/* packet.h - packet read/write stuff
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
@ -127,15 +127,16 @@ typedef struct {
|
|||
MPI x; /* secret exponent */
|
||||
u16 csum; /* checksum */
|
||||
byte is_protected; /* The above infos are protected and must */
|
||||
/* be decrypteded before use */
|
||||
byte protect_algo; /* cipher used to protect the secret informations*/
|
||||
union { /* information for the protection */
|
||||
struct {
|
||||
byte iv[8]; /* initialization vector for CFB mode */
|
||||
/* when protected, the MPIs above are pointers
|
||||
/* be decrypteded before use. */
|
||||
struct {
|
||||
byte algo; /* cipher used to protect the secret informations*/
|
||||
byte s2k;
|
||||
byte hash;
|
||||
byte salt[8];
|
||||
byte count;
|
||||
byte iv[8]; /* initialization vector for CFB mode */
|
||||
} protect; /* when protected, the MPIs above are pointers
|
||||
* to plain storage */
|
||||
} blowfish;
|
||||
} protect;
|
||||
} elg;
|
||||
struct {
|
||||
MPI rsa_n; /* public modulus */
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* parse-packet.c - read packets
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
@ -591,6 +591,7 @@ parse_certificate( IOBUF inp, int pkttype, unsigned long pktlen,
|
|||
unsigned long timestamp;
|
||||
unsigned short valid_period;
|
||||
int is_v4=0;
|
||||
int rc=0;
|
||||
|
||||
|
||||
if( pktlen < 12 ) {
|
||||
|
@ -658,11 +659,79 @@ parse_certificate( IOBUF inp, int pkttype, unsigned long pktlen,
|
|||
pkt->pkt.secret_cert->d.elg.p = elg_p;
|
||||
pkt->pkt.secret_cert->d.elg.g = elg_g;
|
||||
pkt->pkt.secret_cert->d.elg.y = elg_y;
|
||||
cert->d.elg.protect_algo = iobuf_get_noeof(inp); pktlen--;
|
||||
if( list_mode )
|
||||
printf( "\tprotect algo: %d\n", cert->d.elg.protect_algo);
|
||||
if( cert->d.elg.protect_algo ) {
|
||||
cert->d.elg.protect.algo = iobuf_get_noeof(inp); pktlen--;
|
||||
if( cert->d.elg.protect.algo ) {
|
||||
cert->d.elg.is_protected = 1;
|
||||
cert->d.elg.protect.count = 0;
|
||||
if( cert->d.elg.protect.algo == 255 ) {
|
||||
if( pktlen < 3 ) {
|
||||
rc = G10ERR_INVALID_PACKET;
|
||||
goto leave;
|
||||
}
|
||||
cert->d.elg.protect.algo = iobuf_get_noeof(inp); pktlen--;
|
||||
cert->d.elg.protect.s2k = iobuf_get_noeof(inp); pktlen--;
|
||||
cert->d.elg.protect.hash = iobuf_get_noeof(inp); pktlen--;
|
||||
switch( cert->d.elg.protect.s2k ) {
|
||||
case 1:
|
||||
case 3:
|
||||
for(i=0; i < 8 && pktlen; i++, pktlen-- )
|
||||
temp[i] = iobuf_get_noeof(inp);
|
||||
memcpy(cert->d.elg.protect.salt, temp, 8 );
|
||||
break;
|
||||
}
|
||||
switch( cert->d.elg.protect.s2k ) {
|
||||
case 0: if( list_mode ) printf( "\tsimple S2K" );
|
||||
break;
|
||||
case 1: if( list_mode ) printf( "\tsalted S2K" );
|
||||
break;
|
||||
case 3: if( list_mode ) printf( "\titer+salt S2K" );
|
||||
break;
|
||||
default:
|
||||
if( list_mode )
|
||||
printf( "\tunknown S2K %d\n",
|
||||
cert->d.elg.protect.s2k );
|
||||
rc = G10ERR_INVALID_PACKET;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
if( list_mode ) {
|
||||
printf(", algo: %d, hash: %d",
|
||||
cert->d.elg.protect.algo,
|
||||
cert->d.elg.protect.hash );
|
||||
if( cert->d.elg.protect.s2k == 1
|
||||
|| cert->d.elg.protect.s2k == 3 ) {
|
||||
printf(", salt: ");
|
||||
for(i=0; i < 8; i++ )
|
||||
printf("%02x", cert->d.elg.protect.salt[i]);
|
||||
}
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
if( cert->d.elg.protect.s2k == 3 ) {
|
||||
if( !pktlen ) {
|
||||
rc = G10ERR_INVALID_PACKET;
|
||||
goto leave;
|
||||
}
|
||||
cert->d.elg.protect.count = iobuf_get_noeof(inp);
|
||||
pktlen--;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
if( list_mode )
|
||||
printf( "\tprotect algo: %d\n",
|
||||
cert->d.elg.protect.algo);
|
||||
/* old version, we don't have a S2K, so we fake one */
|
||||
cert->d.elg.protect.s2k = 0;
|
||||
/* We need this kludge to cope with old GNUPG versions */
|
||||
cert->d.elg.protect.hash =
|
||||
cert->d.elg.protect.algo == CIPHER_ALGO_BLOWFISH?
|
||||
DIGEST_ALGO_RMD160 : DIGEST_ALGO_MD5;
|
||||
}
|
||||
if( pktlen < 8 ) {
|
||||
rc = G10ERR_INVALID_PACKET;
|
||||
goto leave;
|
||||
}
|
||||
for(i=0; i < 8 && pktlen; i++, pktlen-- )
|
||||
temp[i] = iobuf_get_noeof(inp);
|
||||
if( list_mode ) {
|
||||
|
@ -671,8 +740,7 @@ parse_certificate( IOBUF inp, int pkttype, unsigned long pktlen,
|
|||
printf(" %02x", temp[i] );
|
||||
putchar('\n');
|
||||
}
|
||||
if( cert->d.elg.protect_algo == CIPHER_ALGO_BLOWFISH )
|
||||
memcpy(cert->d.elg.protect.blowfish.iv, temp, 8 );
|
||||
memcpy(cert->d.elg.protect.iv, temp, 8 );
|
||||
}
|
||||
else
|
||||
cert->d.elg.is_protected = 0;
|
||||
|
@ -758,7 +826,7 @@ parse_certificate( IOBUF inp, int pkttype, unsigned long pktlen,
|
|||
|
||||
leave:
|
||||
skip_rest(inp, pktlen);
|
||||
return 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* passphrase.c - Get a passphrase
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
@ -33,7 +33,7 @@
|
|||
|
||||
static int pwfd = -1;
|
||||
|
||||
static int hash_passphrase( DEK *dek, char *pw );
|
||||
static int hash_passphrase( DEK *dek, char *pw, byte *salt );
|
||||
|
||||
void
|
||||
set_passphrase_fd( int fd )
|
||||
|
@ -54,7 +54,7 @@ get_passphrase_fd()
|
|||
* Returns: m_alloced md5 passphrase hash; caller must free
|
||||
*/
|
||||
DEK *
|
||||
get_passphrase_hash( u32 *keyid, char *text )
|
||||
get_passphrase_hash( u32 *keyid, char *text, byte *salt )
|
||||
{
|
||||
char *pw;
|
||||
DEK *dek;
|
||||
|
@ -97,8 +97,8 @@ get_passphrase_hash( u32 *keyid, char *text )
|
|||
tty_kill_prompt();
|
||||
}
|
||||
dek = m_alloc_secure( sizeof *dek );
|
||||
dek->algo = CIPHER_ALGO_BLOWFISH;
|
||||
if( hash_passphrase( dek, pw ) )
|
||||
dek->algo = CIPHER_ALGO_BLOWFISH; /* fixme: allow others ciphers */
|
||||
if( hash_passphrase( dek, pw, salt ) )
|
||||
log_bug("get_passphrase_hash\n");
|
||||
m_free(pw); /* is allocated in secure memory, so it will be burned */
|
||||
return dek;
|
||||
|
@ -107,11 +107,12 @@ get_passphrase_hash( u32 *keyid, char *text )
|
|||
|
||||
/****************
|
||||
* This function is used to construct a DEK from a user input.
|
||||
* It uses the default CIPHER
|
||||
* It uses the default CIPHER. If salt is != NULL, include these
|
||||
* 8 bytes in the hash.
|
||||
* Returns: 0 = okay, -1 No passphrase entered, > 0 error
|
||||
*/
|
||||
int
|
||||
make_dek_from_passphrase( DEK *dek, int mode )
|
||||
make_dek_from_passphrase( DEK *dek, int mode, byte *salt )
|
||||
{
|
||||
char *pw, *pw2;
|
||||
int rc=0;
|
||||
|
@ -131,14 +132,14 @@ make_dek_from_passphrase( DEK *dek, int mode )
|
|||
if( !*pw )
|
||||
rc = -1;
|
||||
else
|
||||
rc = hash_passphrase( dek, pw );
|
||||
rc = hash_passphrase( dek, pw, salt );
|
||||
m_free(pw);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
hash_passphrase( DEK *dek, char *pw )
|
||||
hash_passphrase( DEK *dek, char *pw, byte *salt )
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
|
@ -147,6 +148,8 @@ hash_passphrase( DEK *dek, char *pw )
|
|||
MD_HANDLE md;
|
||||
|
||||
md = md_open(DIGEST_ALGO_RMD160, 1);
|
||||
if( salt )
|
||||
md_write( md, salt, 8 );
|
||||
md_write( md, pw, strlen(pw) );
|
||||
md_final( md );
|
||||
dek->keylen = 20;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* pkclist.c
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* plaintext.c - process an plaintext packet
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* pubkey-enc.c - public key encoded packet handling
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* revoke.c
|
||||
* Copyright (c) 1998 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* ringedit.c - Function for key ring editing
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
@ -888,12 +888,18 @@ keyring_copy( KBPOS *kbpos, int mode, KBNODE root )
|
|||
}
|
||||
}
|
||||
/* rename and make backup file */
|
||||
#if __MINGW32__
|
||||
remove( bakfname );
|
||||
#endif
|
||||
if( rename( rentry->fname, bakfname ) ) {
|
||||
log_error("%s: rename to %s failed: %s\n",
|
||||
rentry->fname, bakfname, strerror(errno) );
|
||||
rc = G10ERR_RENAME_FILE;
|
||||
goto leave;
|
||||
}
|
||||
#if __MINGW32__
|
||||
remove( rentry->fname );
|
||||
#endif
|
||||
if( rename( tmpfname, rentry->fname ) ) {
|
||||
log_error("%s: rename to %s failed: %s\n",
|
||||
tmpfname, rentry->fname,strerror(errno) );
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* rsa.c
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* seckey-cert.c - secret key certifucate packet handling
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
@ -72,21 +72,27 @@ check_elg( PKT_secret_cert *cert )
|
|||
MPI test_x;
|
||||
BLOWFISH_context *blowfish_ctx=NULL;
|
||||
|
||||
switch( cert->d.elg.protect_algo ) {
|
||||
switch( cert->d.elg.protect.algo ) {
|
||||
case CIPHER_ALGO_NONE: BUG(); break;
|
||||
case CIPHER_ALGO_BLOWFISH:
|
||||
keyid_from_skc( cert, keyid );
|
||||
dek = get_passphrase_hash( keyid, NULL );
|
||||
if( cert->d.elg.protect.s2k == 1
|
||||
|| cert->d.elg.protect.s2k == 3 )
|
||||
dek = get_passphrase_hash( keyid, NULL,
|
||||
cert->d.elg.protect.salt );
|
||||
else
|
||||
dek = get_passphrase_hash( keyid, NULL, NULL );
|
||||
|
||||
blowfish_ctx = m_alloc_secure( sizeof *blowfish_ctx );
|
||||
blowfish_setkey( blowfish_ctx, dek->key, dek->keylen );
|
||||
m_free(dek); /* pw is in secure memory, so m_free() burns it */
|
||||
blowfish_setiv( blowfish_ctx, NULL );
|
||||
memcpy(save_iv, cert->d.elg.protect.blowfish.iv, 8 );
|
||||
memcpy(save_iv, cert->d.elg.protect.iv, 8 );
|
||||
blowfish_decode_cfb( blowfish_ctx,
|
||||
cert->d.elg.protect.blowfish.iv,
|
||||
cert->d.elg.protect.blowfish.iv, 8 );
|
||||
cert->d.elg.protect.iv,
|
||||
cert->d.elg.protect.iv, 8 );
|
||||
mpi_set_secure(cert->d.elg.x );
|
||||
/*fixme: maybe it is better to set the buger secure with a
|
||||
/*fixme: maybe it is better to set the buffer secure with a
|
||||
* new get_buffer_secure() function */
|
||||
buffer = mpi_get_buffer( cert->d.elg.x, &nbytes, NULL );
|
||||
csum = checksum_u16( nbytes*8 );
|
||||
|
@ -99,7 +105,7 @@ check_elg( PKT_secret_cert *cert )
|
|||
/* now let's see wether we have used the right passphrase */
|
||||
if( csum != cert->d.elg.csum ) {
|
||||
mpi_free(test_x);
|
||||
memcpy( cert->d.elg.protect.blowfish.iv, save_iv, 8 );
|
||||
memcpy( cert->d.elg.protect.iv, save_iv, 8 );
|
||||
return G10ERR_BAD_PASS;
|
||||
}
|
||||
|
||||
|
@ -111,7 +117,7 @@ check_elg( PKT_secret_cert *cert )
|
|||
memset( &skey, 0, sizeof skey );
|
||||
if( !res ) {
|
||||
mpi_free(test_x);
|
||||
memcpy( cert->d.elg.protect.blowfish.iv, save_iv, 8 );
|
||||
memcpy( cert->d.elg.protect.iv, save_iv, 8 );
|
||||
return G10ERR_BAD_PASS;
|
||||
}
|
||||
mpi_set(cert->d.elg.x, test_x);
|
||||
|
@ -144,15 +150,15 @@ protect_elg( PKT_secret_cert *cert, DEK *dek )
|
|||
if( !cert->d.elg.is_protected ) { /* add the protection */
|
||||
BLOWFISH_context *blowfish_ctx=NULL;
|
||||
|
||||
switch( cert->d.elg.protect_algo ) {
|
||||
switch( cert->d.elg.protect.algo ) {
|
||||
case CIPHER_ALGO_NONE: BUG(); break;
|
||||
case CIPHER_ALGO_BLOWFISH:
|
||||
blowfish_ctx = m_alloc_secure( sizeof *blowfish_ctx );
|
||||
blowfish_setkey( blowfish_ctx, dek->key, dek->keylen );
|
||||
blowfish_setiv( blowfish_ctx, NULL );
|
||||
blowfish_encode_cfb( blowfish_ctx,
|
||||
cert->d.elg.protect.blowfish.iv,
|
||||
cert->d.elg.protect.blowfish.iv, 8 );
|
||||
cert->d.elg.protect.iv,
|
||||
cert->d.elg.protect.iv, 8 );
|
||||
buffer = mpi_get_buffer( cert->d.elg.x, &nbytes, NULL );
|
||||
blowfish_encode_cfb( blowfish_ctx, buffer, buffer, nbytes );
|
||||
mpi_set_buffer( cert->d.elg.x, buffer, nbytes, 0 );
|
||||
|
@ -296,7 +302,7 @@ int
|
|||
is_secret_key_protected( PKT_secret_cert *cert )
|
||||
{
|
||||
if( cert->pubkey_algo == PUBKEY_ALGO_ELGAMAL )
|
||||
return cert->d.elg.is_protected? cert->d.elg.protect_algo : 0;
|
||||
return cert->d.elg.is_protected? cert->d.elg.protect.algo : 0;
|
||||
#ifdef HAVE_RSA_CIPHER
|
||||
else if( cert->pubkey_algo == PUBKEY_ALGO_RSA )
|
||||
return cert->d.rsa.is_protected? cert->d.rsa.protect_algo : 0;
|
||||
|
@ -317,10 +323,6 @@ protect_secret_key( PKT_secret_cert *cert, DEK *dek )
|
|||
|
||||
if( cert->pubkey_algo == PUBKEY_ALGO_ELGAMAL )
|
||||
return protect_elg( cert, dek );
|
||||
#if 0 /* noy yet implemented */
|
||||
else if( cert->pubkey_algo == PUBKEY_ALGO_RSA )
|
||||
return protect_rsa( cert, dek );
|
||||
#endif
|
||||
else
|
||||
return G10ERR_PUBKEY_ALGO;
|
||||
}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* seskey.c - make sesssion keys etc.
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* sig-check.c - Check a signature
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
23
g10/sign.c
23
g10/sign.c
|
@ -1,14 +1,14 @@
|
|||
/* sign.c - sign data
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
@ -152,7 +152,7 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
|||
|
||||
if( opt.armor && !outfile )
|
||||
iobuf_push_filter( out, armor_filter, &afx );
|
||||
write_comment( out, "#created by G10 v" VERSION " ("
|
||||
write_comment( out, "#created by GNUPG v" VERSION " ("
|
||||
PRINTABLE_OS_NAME ")");
|
||||
if( opt.compress && !outfile )
|
||||
iobuf_push_filter( out, compress_filter, &zfx );
|
||||
|
@ -916,13 +916,15 @@ change_passphrase( const char *username )
|
|||
if( rc )
|
||||
tty_printf("Can't edit this key: %s\n", g10_errstr(rc));
|
||||
else {
|
||||
DEK *dek = m_alloc_secure( sizeof *dek );
|
||||
DEK *dek = m_alloc_secure( sizeof *dek + 8 );
|
||||
byte *salt = (byte*)dek + sizeof( *dek );
|
||||
|
||||
tty_printf( "Enter the new passphrase for this secret key.\n\n" );
|
||||
|
||||
for(;;) {
|
||||
dek->algo = CIPHER_ALGO_BLOWFISH;
|
||||
rc = make_dek_from_passphrase( dek , 2 );
|
||||
randomize_buffer(salt, 8, 1);
|
||||
rc = make_dek_from_passphrase( dek , 2, salt );
|
||||
if( rc == -1 ) {
|
||||
rc = 0;
|
||||
tty_printf( "You don't want a passphrase -"
|
||||
|
@ -943,8 +945,11 @@ change_passphrase( const char *username )
|
|||
break;
|
||||
}
|
||||
else { /* okay */
|
||||
skc->d.elg.protect_algo = CIPHER_ALGO_BLOWFISH;
|
||||
randomize_buffer(skc->d.elg.protect.blowfish.iv, 8, 1);
|
||||
skc->d.elg.protect.algo = CIPHER_ALGO_BLOWFISH;
|
||||
skc->d.elg.protect.s2k = 1;
|
||||
skc->d.elg.protect.hash = DIGEST_ALGO_RMD160;
|
||||
memcpy(skc->d.elg.protect.salt, salt, 8);
|
||||
randomize_buffer(skc->d.elg.protect.iv, 8, 1);
|
||||
rc = protect_secret_key( skc, dek );
|
||||
if( rc )
|
||||
log_error("protect_secret_key failed: %s\n", g10_errstr(rc) );
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* skclist.c
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* status.c
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* status.h
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* textfilter.c
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* trustdb.c
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
@ -329,8 +329,8 @@ create_db( const char *fname )
|
|||
log_fatal("can't create %s: %s\n", fname, strerror(errno) );
|
||||
fwrite_8( fp, 1 );
|
||||
fwrite_8( fp, 'g' );
|
||||
fwrite_8( fp, '1' );
|
||||
fwrite_8( fp, '0' );
|
||||
fwrite_8( fp, 'p' );
|
||||
fwrite_8( fp, 'g' );
|
||||
fwrite_8( fp, 1 ); /* version */
|
||||
fwrite_zeros( fp, 3 ); /* reserved */
|
||||
fwrite_32( fp, 0 ); /* not locked */
|
||||
|
@ -451,7 +451,8 @@ read_record( ulong recnum, TRUSTREC *rec, int expected )
|
|||
case 0: /* unused record */
|
||||
break;
|
||||
case RECTYPE_VER: /* version record */
|
||||
if( memcmp(buf+1, "g10", 3 ) ) {
|
||||
/* g10 was the original name */
|
||||
if( memcmp(buf+1, "gpg", 3 ) && memcmp(buf+1, "g10", 3 ) ) {
|
||||
log_error("%s: not a trustdb file\n", db_name );
|
||||
rc = G10ERR_TRUSTDB;
|
||||
}
|
||||
|
@ -1510,7 +1511,7 @@ init_trustdb( int level, const char *dbname )
|
|||
|
||||
if( !level || level==1 ) {
|
||||
char *fname = dbname? m_strdup( dbname )
|
||||
: make_filename(opt.homedir, "trustdb.g10", NULL );
|
||||
: make_filename(opt.homedir, "trustdb.gpg", NULL );
|
||||
if( access( fname, R_OK ) ) {
|
||||
if( errno != ENOENT ) {
|
||||
log_error("can't access %s: %s\n", fname, strerror(errno) );
|
||||
|
@ -1522,7 +1523,11 @@ init_trustdb( int level, const char *dbname )
|
|||
assert(p);
|
||||
*p = 0;
|
||||
if( access( fname, F_OK ) ) {
|
||||
#if __MINGW32__
|
||||
if( mkdir( fname ) )
|
||||
#else
|
||||
if( mkdir( fname, S_IRUSR|S_IWUSR|S_IXUSR ) )
|
||||
#endif
|
||||
log_fatal("can't create directory '%s': %s\n",
|
||||
fname, strerror(errno) );
|
||||
}
|
||||
|
@ -1974,7 +1979,7 @@ int
|
|||
verify_private_data()
|
||||
{
|
||||
int rc = 0;
|
||||
char *sigfile = make_filename(opt.homedir, "g10.sig", NULL );
|
||||
char *sigfile = make_filename(opt.homedir, "gnupg.sig", NULL );
|
||||
|
||||
if( access( sigfile, R_OK ) ) {
|
||||
if( errno != ENOENT ) {
|
||||
|
@ -2002,8 +2007,8 @@ int
|
|||
sign_private_data()
|
||||
{
|
||||
int rc;
|
||||
char *sigfile = make_filename(opt.homedir, "g10.sig", NULL );
|
||||
char *secring = make_filename(opt.homedir, "secring.g10", NULL );
|
||||
char *sigfile = make_filename(opt.homedir, "gnupg.sig", NULL );
|
||||
char *secring = make_filename(opt.homedir, "secring.gpg", NULL );
|
||||
STRLIST list = NULL;
|
||||
|
||||
add_to_strlist( &list, db_name );
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* trustdb.h - Trust database
|
||||
* Copyright (c) 1997 by Werner Koch (dd9jn)
|
||||
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of G10.
|
||||
* This file is part of GNUPG.
|
||||
*
|
||||
* G10 is free software; you can redistribute it and/or modify
|
||||
* 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.
|
||||
*
|
||||
* G10 is distributed in the hope that it will be useful,
|
||||
* 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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue