aboutsummaryrefslogtreecommitdiffstats
path: root/sm/decrypt.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2001-12-11 12:31:04 +0000
committerWerner Koch <[email protected]>2001-12-11 12:31:04 +0000
commit6a8c47bd29d24d160b56d782513db0187b80819d (patch)
tree1a7cbc3a98010a058913b8faa3c62132c6fa09e2 /sm/decrypt.c
parentNew searchmode and hack to allow a hex encoded serial number (diff)
downloadgnupg-6a8c47bd29d24d160b56d782513db0187b80819d.tar.gz
gnupg-6a8c47bd29d24d160b56d782513db0187b80819d.zip
Implemented encryption in server mode.
Allow to specify a recipient on the commandline There is still a default hardwired recipient if none has been set.
Diffstat (limited to 'sm/decrypt.c')
-rw-r--r--sm/decrypt.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sm/decrypt.c b/sm/decrypt.c
index 491828898..2d79b7f5d 100644
--- a/sm/decrypt.c
+++ b/sm/decrypt.c
@@ -36,6 +36,7 @@
struct decrypt_filter_parm_s {
int algo;
+ int mode;
int blklen;
GCRY_CIPHER_HD hd;
char iv[16];
@@ -110,7 +111,7 @@ prepare_decryption (const char *hexkeygrip, const char *enc_val,
if (DBG_CRYPTO)
log_printhex ("session key:", seskey+n, seskeylen-n);
- parm->hd = gcry_cipher_open (parm->algo, GCRY_CIPHER_MODE_CBC, 0);
+ parm->hd = gcry_cipher_open (parm->algo, parm->mode, 0);
if (!parm->hd)
{
rc = gcry_errno ();
@@ -311,23 +312,24 @@ gpgsm_decrypt (CTRL ctrl, int in_fd, FILE *out_fp)
rc = map_ksba_err (err);
goto leave;
}
- log_debug ("ksba_cms_parse - stop reason %d\n", stopreason);
if (stopreason == KSBA_SR_BEGIN_DATA
|| stopreason == KSBA_SR_DETACHED_DATA)
{
- int algo;
+ int algo, mode;
const char *algoid;
algoid = ksba_cms_get_content_oid (cms, 2/* encryption algo*/);
algo = gcry_cipher_map_name (algoid);
- if (!algo)
+ mode = gcry_cipher_mode_from_oid (algoid);
+ if (!algo || !mode)
{
log_error ("unsupported algorithm `%s'\n", algoid? algoid:"?");
rc = GNUPG_Unsupported_Algorithm;
goto leave;
}
dfparm.algo = algo;
+ dfparm.mode = mode;
dfparm.blklen = gcry_cipher_get_algo_blklen (algo);
if (dfparm.blklen > sizeof (dfparm.helpblock))
return GNUPG_Bug;