summaryrefslogtreecommitdiff
path: root/sm
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-02-09 16:00:16 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-02-09 16:00:16 +0900
commit10fb3b7f1c67c9367ab0b15e2d8e4b5ec6abbae0 (patch)
tree09ec1445374083df61971982e5f1a51bb3ca2c4c /sm
parent0253adc833bb041c8a88b4d610aded01ce4e75f4 (diff)
downloadgpg2-10fb3b7f1c67c9367ab0b15e2d8e4b5ec6abbae0.tar.gz
gpg2-10fb3b7f1c67c9367ab0b15e2d8e4b5ec6abbae0.tar.bz2
gpg2-10fb3b7f1c67c9367ab0b15e2d8e4b5ec6abbae0.zip
Imported Upstream version 2.1.17upstream/2.1.17
Diffstat (limited to 'sm')
-rw-r--r--sm/call-agent.c3
-rw-r--r--sm/decrypt.c8
-rw-r--r--sm/gpgsm.c54
3 files changed, 23 insertions, 42 deletions
diff --git a/sm/call-agent.c b/sm/call-agent.c
index 11e6ae7..16a2497 100644
--- a/sm/call-agent.c
+++ b/sm/call-agent.c
@@ -234,6 +234,7 @@ gpgsm_agent_pksign (ctrl_t ctrl, const char *keygrip, const char *desc,
rc = start_agent (ctrl);
if (rc)
return rc;
+ inq_parm.ctrl = ctrl;
inq_parm.ctx = agent_ctx;
if (digestlen*2 + 50 > DIM(line))
@@ -319,6 +320,7 @@ gpgsm_scd_pksign (ctrl_t ctrl, const char *keyid, const char *desc,
rc = start_agent (ctrl);
if (rc)
return rc;
+ inq_parm.ctrl = ctrl;
inq_parm.ctx = agent_ctx;
if (digestlen*2 + 50 > DIM(line))
@@ -583,6 +585,7 @@ gpgsm_agent_readkey (ctrl_t ctrl, int fromcard, const char *hexkeygrip,
rc = start_agent (ctrl);
if (rc)
return rc;
+ inq_parm.ctrl = ctrl;
inq_parm.ctx = agent_ctx;
rc = assuan_transact (agent_ctx, "RESET",NULL, NULL, NULL, NULL, NULL, NULL);
diff --git a/sm/decrypt.c b/sm/decrypt.c
index 11c1cf8..a2907f6 100644
--- a/sm/decrypt.c
+++ b/sm/decrypt.c
@@ -74,10 +74,12 @@ prepare_decryption (ctrl_t ctrl, const char *hexkeygrip, const char *desc,
log_printhex ("pkcs1 encoded session key:", seskey, seskeylen);
n=0;
- if (seskeylen == 24)
+ if (seskeylen == 24 || seskeylen == 16)
{
- /* Smells like a 3-des key. This might happen because a SC has
- already done the unpacking. */
+ /* Smells like a 3-DES or AES-128 key. This might happen
+ * because a SC has already done the unpacking. A better
+ * solution would be to test for this only after we triggered
+ * the GPG_ERR_INV_SESSION_KEY. */
}
else
{
diff --git a/sm/gpgsm.c b/sm/gpgsm.c
index c4fd1c2..34a9b96 100644
--- a/sm/gpgsm.c
+++ b/sm/gpgsm.c
@@ -210,7 +210,8 @@ static ARGPARSE_OPTS opts[] = {
ARGPARSE_c (aListSecretKeys, "list-secret-keys", N_("list secret keys")),
ARGPARSE_c (aListChain, "list-chain", N_("list certificate chain")),
ARGPARSE_c (aFingerprint, "fingerprint", N_("list keys and fingerprints")),
- ARGPARSE_c (aKeygen, "gen-key", N_("generate a new key pair")),
+ ARGPARSE_c (aKeygen, "generate-key", N_("generate a new key pair")),
+ ARGPARSE_c (aKeygen, "gen-key", "@"),
ARGPARSE_c (aDeleteKey, "delete-keys",
N_("remove keys from the public keyring")),
/*ARGPARSE_c (aSendKeys, "send-keys", N_("export keys to a keyserver")),*/
@@ -230,7 +231,8 @@ static ARGPARSE_OPTS opts[] = {
N_("pass a command to the dirmngr")),
ARGPARSE_c (aCallProtectTool, "call-protect-tool",
N_("invoke gpg-protect-tool")),
- ARGPARSE_c (aPasswd, "passwd", N_("change a passphrase")),
+ ARGPARSE_c (aPasswd, "change-passphrase", N_("change a passphrase")),
+ ARGPARSE_c (aPasswd, "passwd", "@"),
ARGPARSE_c (aGPGConfList, "gpgconf-list", "@"),
ARGPARSE_c (aGPGConfTest, "gpgconf-test", "@"),
@@ -355,12 +357,6 @@ static ARGPARSE_OPTS opts[] = {
"@\n(See the man page for a complete listing of all commands and options)\n"
)),
- ARGPARSE_group (303, N_("@\nExamples:\n\n"
- " -se -r Bob [file] sign and encrypt for user Bob\n"
- " --clearsign [file] make a clear text signature\n"
- " --detach-sign [file] make a detached signature\n"
- " --list-keys [names] show keys\n"
- " --fingerprint [names] show fingerprints\n" )),
/* Hidden options. */
ARGPARSE_s_s (oCompliance, "compliance", "@"),
@@ -404,9 +400,9 @@ static ARGPARSE_OPTS opts[] = {
/* Command aliases. */
ARGPARSE_c (aListKeys, "list-key", "@"),
- ARGPARSE_c (aListChain, "list-sig", "@"),
+ ARGPARSE_c (aListChain, "list-signatures", "@"),
ARGPARSE_c (aListChain, "list-sigs", "@"),
- ARGPARSE_c (aListChain, "check-sig", "@"),
+ ARGPARSE_c (aListChain, "check-signatures", "@"),
ARGPARSE_c (aListChain, "check-sigs", "@"),
ARGPARSE_c (aDeleteKey, "delete-key", "@"),
@@ -439,9 +435,6 @@ static int maybe_setuid = 1;
static const char *debug_level;
static unsigned int debug_value;
-/* Option --enable-special-filenames */
-static int allow_special_filenames;
-
/* Default value for include-certs. We need an extra macro for
gpgconf-list because the variable will be changed by the command
line option.
@@ -468,7 +461,6 @@ static void set_cmd (enum cmd_and_opt_values *ret_cmd,
enum cmd_and_opt_values new_cmd );
static void emergency_cleanup (void);
-static int check_special_filename (const char *fname, int for_write);
static int open_read (const char *filename);
static estream_t open_es_fread (const char *filename, const char *mode);
static estream_t open_es_fwrite (const char *filename);
@@ -1420,7 +1412,9 @@ main ( int argc, char **argv)
case oNoRandomSeedFile: use_random_seed = 0; break;
case oNoCommonCertsImport: no_common_certs_import = 1; break;
- case oEnableSpecialFilenames: allow_special_filenames =1; break;
+ case oEnableSpecialFilenames:
+ enable_special_filenames ();
+ break;
case oValidationModel: parse_validation_model (pargs.r.ret_str); break;
@@ -1719,6 +1713,7 @@ main ( int argc, char **argv)
es_printf ("debug-level:%lu:\"none:\n", GC_OPT_FLAG_DEFAULT);
es_printf ("log-file:%lu:\n", GC_OPT_FLAG_NONE);
es_printf ("disable-crl-checks:%lu:\n", GC_OPT_FLAG_NONE);
+ es_printf ("enable-crl-checks:%lu:\n", GC_OPT_FLAG_NONE);
es_printf ("disable-trusted-cert-crl-check:%lu:\n", GC_OPT_FLAG_NONE);
es_printf ("enable-ocsp:%lu:\n", GC_OPT_FLAG_NONE);
es_printf ("include-certs:%lu:%d:\n", GC_OPT_FLAG_DEFAULT,
@@ -1906,7 +1901,7 @@ main ( int argc, char **argv)
else if (argc == 1) /* From file. */
fpin = open_es_fread (*argv, "r");
else
- wrong_args ("--gen-key --batch [parmfile]");
+ wrong_args ("--generate-key --batch [parmfile]");
}
fpout = open_es_fwrite (opt.outfile?opt.outfile:"-");
@@ -1996,7 +1991,7 @@ main ( int argc, char **argv)
case aPasswd:
if (argc != 1)
- wrong_args ("--passwd <key-Id>");
+ wrong_args ("--change-passphrase <key-Id>");
else
{
int rc;
@@ -2107,25 +2102,6 @@ gpgsm_parse_validation_model (const char *model)
}
-/* Check whether the filename has the form "-&nnnn", where n is a
- non-zero number. Returns this number or -1 if it is not the case. */
-static int
-check_special_filename (const char *fname, int for_write)
-{
- if (allow_special_filenames
- && fname && *fname == '-' && fname[1] == '&' ) {
- int i;
-
- fname += 2;
- for (i=0; isdigit (fname[i]); i++ )
- ;
- if ( !fname[i] )
- return translate_sys2libc_fd_int (atoi (fname), for_write);
- }
- return -1;
-}
-
-
/* Open the FILENAME for read and return the file descriptor. Stop
with an error message in case of problems. "-" denotes stdin and
@@ -2140,7 +2116,7 @@ open_read (const char *filename)
set_binary (stdin);
return 0; /* stdin */
}
- fd = check_special_filename (filename, 0);
+ fd = check_special_filename (filename, 0, 0);
if (fd != -1)
return fd;
fd = open (filename, O_RDONLY | O_BINARY);
@@ -2162,7 +2138,7 @@ open_es_fread (const char *filename, const char *mode)
if (filename[0] == '-' && !filename[1])
fd = fileno (stdin);
else
- fd = check_special_filename (filename, 0);
+ fd = check_special_filename (filename, 0, 0);
if (fd != -1)
{
fp = es_fdopen_nc (fd, mode);
@@ -2200,7 +2176,7 @@ open_es_fwrite (const char *filename)
return fp;
}
- fd = check_special_filename (filename, 1);
+ fd = check_special_filename (filename, 1, 0);
if (fd != -1)
{
fp = es_fdopen_nc (fd, "wb");