mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
agent: Make "PKDECRYPT --kem" with optional value work.
* agent/command.c (cmd_pkdecrypt): Fix comparison. * agent/agent.h (enum kemids): Rename type and strip trailing comma. * agent/pkdecrypt.c (agent_hybrid_pgp_kem_decrypt): Allow building with Libgcrypt < 1.11 -- Eventually we should change the libgcrypt requirement in configure.
This commit is contained in:
parent
131dd2a351
commit
ce8b25270b
@ -560,11 +560,11 @@ gpg_error_t agent_pkdecrypt (ctrl_t ctrl, const char *desc_text,
|
||||
const unsigned char *ciphertext, size_t ciphertextlen,
|
||||
membuf_t *outbuf, int *r_padding);
|
||||
|
||||
enum kemid
|
||||
enum kemids
|
||||
{
|
||||
KEM_PQC_PGP,
|
||||
KEM_PGP,
|
||||
KEM_CMS,
|
||||
KEM_CMS
|
||||
};
|
||||
|
||||
gpg_error_t agent_kem_decrypt (ctrl_t ctrl, const char *desc_text, int kemid,
|
||||
|
@ -1075,13 +1075,14 @@ cmd_pkdecrypt (assuan_context_t ctx, char *line)
|
||||
if (p)
|
||||
{
|
||||
kemid = KEM_PQC_PGP;
|
||||
if (*p++ == '=')
|
||||
if (*p == '=')
|
||||
{
|
||||
if (strcmp (p, "PQC-PGP"))
|
||||
p++;
|
||||
if (!strcmp (p, "PQC-PGP"))
|
||||
kemid = KEM_PQC_PGP;
|
||||
else if (strcmp (p, "PGP"))
|
||||
else if (!strcmp (p, "PGP"))
|
||||
kemid = KEM_PGP;
|
||||
else if (strcmp (p, "CMS"))
|
||||
else if (!strcmp (p, "CMS"))
|
||||
kemid = KEM_CMS;
|
||||
else
|
||||
return set_error (GPG_ERR_ASS_PARAMETER, "invalid KEM algorithm");
|
||||
|
@ -188,6 +188,7 @@ static gpg_error_t
|
||||
agent_hybrid_pgp_kem_decrypt (ctrl_t ctrl, const char *desc_text,
|
||||
gcry_sexp_t s_cipher, membuf_t *outbuf)
|
||||
{
|
||||
#if GCRYPT_VERSION_NUMBER >= 0x010b00
|
||||
gcry_sexp_t s_skey0 = NULL;
|
||||
gcry_sexp_t s_skey1 = NULL;
|
||||
unsigned char *shadow_info = NULL;
|
||||
@ -408,6 +409,9 @@ agent_hybrid_pgp_kem_decrypt (ctrl_t ctrl, const char *desc_text,
|
||||
gcry_sexp_release (s_skey0);
|
||||
gcry_sexp_release (s_skey1);
|
||||
return err;
|
||||
#else
|
||||
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* DECRYPT the encrypted stuff (like encrypted session key) in
|
||||
|
Loading…
x
Reference in New Issue
Block a user