gpg: Add new program gpgcompose.

* g10/packet.h: Include "util.h".
* g10/encrypt.c (encrypt_seskey): Don't mark as static.
* g10/gpgcompose.c: New file.
* g10/Makefile.am (noinst_PROGRAMS): Add gpgcompose.
(gpg2_SOURCES): Split everything but gpg.c into...
(gpg_sources): ... this new variable.
(gpgcompose_SOURCES): New variable.
(gpgcompose_LDADD): Likewise.
(gpgcompose_LDFLAGS): Likewise.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
This commit is contained in:
Neal H. Walfield 2016-03-02 16:00:44 +01:00
parent 605276ef8c
commit d040628ddf
5 changed files with 3061 additions and 5 deletions

View File

@ -36,7 +36,7 @@ bin_PROGRAMS = gpg2
if !HAVE_W32CE_SYSTEM
bin_PROGRAMS += gpgv2
endif
noinst_PROGRAMS = $(module_tests)
noinst_PROGRAMS = gpgcompose $(module_tests)
TESTS = $(module_tests)
if ENABLE_BZIP2_SUPPORT
@ -104,8 +104,7 @@ common_source = \
pkglue.c pkglue.h \
ecdh.c
gpg2_SOURCES = gpg.c \
server.c \
gpg_sources = server.c \
$(common_source) \
pkclist.c \
skclist.c \
@ -118,7 +117,6 @@ gpg2_SOURCES = gpg.c \
sign.c \
verify.c \
revoke.c \
keyedit.c \
dearmor.c \
import.c \
export.c \
@ -135,6 +133,11 @@ gpg2_SOURCES = gpg.c \
$(card_source) \
exec.c exec.h
gpg2_SOURCES = gpg.c \
keyedit.c \
$(gpg_sources)
gpgcompose_SOURCES = gpgcompose.c $(gpg_sources)
gpgv2_SOURCES = gpgv.c \
$(common_source) \
verify.c
@ -157,6 +160,11 @@ gpgv2_LDADD = $(LDADD) $(LIBGCRYPT_LIBS) \
$(LIBICONV) $(resource_objs) $(extra_sys_libs)
gpgv2_LDFLAGS = $(extra_bin_ldflags)
gpgcompose_LDADD = $(LDADD) $(SQLITE3_LIBS) $(LIBGCRYPT_LIBS) $(LIBREADLINE) \
$(LIBASSUAN_LIBS) $(GPG_ERROR_LIBS) \
$(LIBICONV) $(resource_objs) $(extra_sys_libs)
gpgcompose_LDFLAGS = $(extra_bin_ldflags)
t_common_ldadd =
module_tests = t-rmd160 t-keydb t-keydb-get-keyblock
t_rmd160_SOURCES = t-rmd160.c rmd160.c

View File

@ -66,7 +66,15 @@ encrypt_store (const char *filename)
}
static void
/* *SESKEY contains the unencrypted session key ((*SESKEY)->KEY) and
the algorithm that will be used to encrypt the contents of the SED
packet ((*SESKEY)->ALGO). If *SESKEY is NULL, then a random
session key that is appropriate for DEK->ALGO is generated and
stored there.
Encrypt that session key using DEK and store the result in ENCKEY,
which must be large enough to hold (*SESKEY)->KEYLEN + 1 bytes. */
void
encrypt_seskey (DEK *dek, DEK **seskey, byte *enckey)
{
gcry_cipher_hd_t hd;

3038
g10/gpgcompose.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -221,6 +221,7 @@ void display_online_help( const char *keyword );
/*-- encode.c --*/
int setup_symkey (STRING2KEY **symkey_s2k,DEK **symkey_dek);
void encrypt_seskey (DEK *dek, DEK **seskey, byte *enckey);
int use_mdc (pk_list_t pk_list,int algo);
int encrypt_symmetric (const char *filename );
int encrypt_store (const char *filename );

View File

@ -29,6 +29,7 @@
#include "filter.h"
#include "../common/openpgpdefs.h"
#include "../common/userids.h"
#include "util.h"
#define DEBUG_PARSE_PACKET 1