mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
gpg: Refactor function encrypt_seskey.
* g10/encrypt.c (encrypt_seskey): Allocate the buffer for the encrypted key and returns that buffer and its length. (encrypt_simple): Adjust for above change. (write_symkey_enc): Ditto. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
7356d6ec50
commit
0131d4369a
3 changed files with 112 additions and 53 deletions
|
@ -2283,9 +2283,11 @@ sk_esk (const char *option, int argc, char *argv[], void *cookie)
|
|||
DEK *sesdekp = &sesdek;
|
||||
|
||||
/* Now encrypt the session key (or rather, the algorithm used to
|
||||
encrypt the SED plus the session key) using ENCKEY. */
|
||||
ske->seskeylen = 1 + sesdek.keylen;
|
||||
encrypt_seskey (&s2kdek, &sesdekp, ske->seskey);
|
||||
encrypt the SKESK plus the session key) using ENCKEY. */
|
||||
err = encrypt_seskey (&s2kdek, &sesdekp,
|
||||
(void**)&ske->seskey, (size_t *)&ske->seskeylen);
|
||||
if (err)
|
||||
log_fatal ("encrypt_seskey failed: %s\n", gpg_strerror (err));
|
||||
|
||||
/* Save the session key for later. */
|
||||
session_key = sesdek;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue