summaryrefslogtreecommitdiffstats
path: root/g10/encrypt.c
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@g10code.com>2016-03-02 16:00:44 +0100
committerNeal H. Walfield <neal@g10code.com>2016-03-02 20:36:19 +0100
commitd040628ddf2c09ddc9581ff365680a568ad24278 (patch)
tree9f1b4596c48a96046cdbfd143ab7296d115e06d6 /g10/encrypt.c
parentgpg: More robustly detect valid non-armored OpenPGP messages. (diff)
downloadgnupg2-d040628ddf2c09ddc9581ff365680a568ad24278.tar.xz
gnupg2-d040628ddf2c09ddc9581ff365680a568ad24278.zip
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>
Diffstat (limited to 'g10/encrypt.c')
-rw-r--r--g10/encrypt.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/g10/encrypt.c b/g10/encrypt.c
index 2c8508ca0..fe18c15ad 100644
--- a/g10/encrypt.c
+++ b/g10/encrypt.c
@@ -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;