1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-02 22:38:02 +02:00
Commit Graph

6683 Commits

Author SHA1 Message Date
Justus Winter
04754ce3a7 g10: Hyphenate --clearsign.
* g10/gpg.c (opts): Hyphenate option.
* doc/gpg.texi: Update accordingly.
* po: Update translations.
* tests/openpgp: Update tests.

GnuPG-bug-id: 2700
Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-13 17:30:54 +01:00
Justus Winter
ca59815234 g10: Spell out --recv-keys.
* g10/gpg.c (opts): Spell out option.
* doc/gpg.texi: Update accordingly.

GnuPG-bug-id: 2700
Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-13 17:30:54 +01:00
Justus Winter
dd3dde07a9 g10: Create expiring keys in quick key generation mode.
* doc/gpg.texi: Document that fact.
* g10/keygen.c (quick_generate_keypair): Use a default value.
* tests/openpgp/quick-key-manipulation.scm: Test that fact.

GnuPG-bug-id: 2701
Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-13 16:35:08 +01:00
Justus Winter
429891a704 gpgscm: Print failed and skipped tests.
* tests/gpgscm/tests.scm (test-pool::report): Print failed and skipped
tests at the end.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-13 15:09:26 +01:00
Justus Winter
d43dabf460 gpgscm: Generalize the test runner.
* tests/gpgscm/tests.scm (test::scm) Add explicit name argument.
(test::binary): Likewise.  Also, add missing unquote.
* tests/openpgp/run-tests.scm: Adapt accordingly.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-13 15:09:26 +01:00
Justus Winter
1a176b92a8 gpgscm: Move the test runner to the Scheme library.
* tests/openpgp/run-tests.scm: Move most of the code...
* tests/gpgscm/tests.scm: ... here.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-13 15:09:26 +01:00
Justus Winter
fe36e63763 tests: Refactor test runner.
* tests/openpgp/run-tests.scm (locate-test): New function.
(test): Factor-out the code starting the child process.
(test::binary): New function.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-13 15:09:26 +01:00
Justus Winter
e3876f16eb gpgscm: Improve library functions.
* tests/gpgscm/tests.scm (absolute-path?): New function.
(canonical-path): Use the new function.
* tests/gpgscm/lib.scm (string-split-pln): New function.
(string-indexp, string-splitp): Likewise.
(string-splitn): Express using the above function.
(string-ltrim, string-rtrim): Fix corner case.
(list->string-reversed): New function.
(read-line): Fix performance.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-13 15:05:26 +01:00
NIIBE Yutaka
ab3cdeb441 po: Update Japanese translation.
--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2016-12-13 15:12:51 +09:00
Werner Koch
98433c7043
gpg: Fix memory leak in ecc key generation.
* g10/keygen.c (ecckey_from_sexp): Release curve.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-12-12 14:02:14 +01:00
Werner Koch
f1304ee9b2
gpg: Do not use a fixed string for --gpgconf-list:default_pubkey_algo.
* g10/keygen.c (get_default_pubkey_algo): New.
(parse_key_parameter_string): Use it.
* g10/gpg.c (gpgconf_list): Take value from new function.
--

Note that consumers of that gpgconf-list value may need to be adjusted
to that new value.  It should anyway only be used to display the
default algorithm.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-12-12 10:50:42 +01:00
Werner Koch
522e6f798d
gpg: Fix algo string parsing of --quick-addkey.
* g10/keygen.c (parse_key_parameter_string): Fix handling of PART==1.
(parse_key_parameter_part): Use default key size if only "rsa", "dsa",
or "elg" is given.
--

The first change is the actual fix.  The second change avoids the
error "Invalid Curve" when only "rsa" instead of RSA2048 is given.

Fixes-commit: ce29272e24
Signed-off-by: Werner Koch <wk@gnupg.org>
2016-12-12 10:13:06 +01:00
Justus Winter
d568a15616 g10: Create keys that expire in simple key generation mode.
* g10/keygen.c (default_expiration_interval): New variable.
(generate_keypair): Use the new default.
--
Cursory discussion on gnupg-devel@ suggested two years as a good
default expiration interval.

GnuPG-bug-id: 2701
Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-09 14:38:31 +01:00
Justus Winter
b778d8deed tests: Add a test for '--quick-addkey'.
* tests/openpgp/quick-key-manipulation.scm: Test '--quick-addkey'.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-09 13:22:37 +01:00
Justus Winter
59f1562c25 tests: New test using all available compression algorithms.
* tests/openpgp/Makefile.am (XTESTS): Add new test.
* tests/openpgp/compression.scm: New file.
* tests/openpgp/defs.scm (all-compression-algos): New variable.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-09 13:13:45 +01:00
Justus Winter
c8100fc0fa g10: List compression algorithms using human-readable names.
* g10/gpg.c (list_config): List all enabled compression algorithms
under the key 'compressname'.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-09 13:13:45 +01:00
Justus Winter
3de9bad359 g10: Fix memory leak.
* g10/sign.c (do_sign): Release old signature data.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-09 13:13:45 +01:00
Werner Koch
5c7d582228
common: Skip the Byte Order Mark in conf files.
* common/argparse.c (optfile_parse): Detect and skip the UTF-8 BOM.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-12-08 20:25:48 +01:00
Werner Koch
cb4c7abb77
Fix 2 compiler warnings.
* dirmngr/loadswdb.c: Set ERR on malloc failure.
* g10/passphrase.c (passphrase_to_dek): Initialize all fields of
HELP_S2K.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-12-08 19:02:56 +01:00
Werner Koch
4a04277ad1
wks: New option --status-fd for gpg-wks-client.
* tools/wks-util.c: Include status.h.
(statusfp): New global var.
(wks_set_status_fd): New func.
(wks_write_status): New func.
* tools/gpg-wks-client.c: Include status.h.
(oStatusFD): New constant.
(opts): New option --status-fd.
(parse_arguments): Handle that option.
(main): Return STATUS_SUCCESS or STATUS_FAILURE.
--

This option is useful in case gpg-wks-client is spawed using a double
fork approach which does not allow to return the exit code.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-12-08 17:56:12 +01:00
Justus Winter
e7429b1ced gpgscm: Better error reporting.
* tests/gpgscm/ffi.scm: Move the customized exception handling and
atexit logic...
* tests/gpgscm/init.scm: ... here.
(throw): Record the current history.
(throw'): New function that is history-aware.
(rethrow): New function.
(*error-hook*): Use the new throw'.
* tests/gpgscm/main.c (load): Fix error handling.
(main): Save and use the 'sc->retcode' as exit code.
* tests/gpgscm/repl.scm (repl): Print call history.
* tests/gpgscm/scheme.c (_Error_1): Make a snapshot of the history,
use it to provide a accurate location of the expression causing the
error at runtime, and hand the history trace to the '*error-hook*'.
(opexe_5): Tag all lists at parse time with the current location.
* tests/gpgscm/tests.scm: Update calls to 'throw', use 'rethrow'.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-08 17:22:50 +01:00
Justus Winter
404e8a4136 gpgscm: Keep a history of calls for error messages.
* tests/gpgscm/init.scm (vm-history-print): New function.
* tests/gpgscm/opdefines.h: New opcodes 'CALLSTACK_POP', 'APPLY_CODE',
and 'VM_HISTORY'.
* tests/gpgscm/scheme-private.h (struct history): New definition.
(struct scheme): New field 'history'.
* tests/gpgscm/scheme.c (gc): Mark objects in the history.
(history_free): New function.
(history_init): Likewise.
(history_mark): Likewise.
(add_mod): New macro.
(sub_mod): Likewise.
(tailstack_clear): New function.
(callstack_pop): Likewise.
(callstack_push): Likewise.
(tailstack_push): Likewise.
(tailstack_flatten): Likewise.
(callstack_flatten): Likewise.
(history_flatten): Likewise.
(opexe_0): New variable 'callsite', keep track of the expression if it
is a call, implement the new opcodes, record function applications in
the history.
(opexe_6): Implement new opcode.
(scheme_init_custom_alloc): Initialize history.
(scheme_deinit): Free history.
* tests/gpgscm/scheme.h (USE_HISTORY): New macro.
--

This patch makes TinySCHEME keep a history of function calls.  This
history can be used to produce helpful error messages.  The history
data structure is inspired by MIT/GNU Scheme.

Signed-off-by: Justus Winter <justus@g10code.com>

fu history
2016-12-08 17:15:20 +01:00
Justus Winter
01256694f0 gpgscm: Add flag TAIL_CONTEXT.
* tests/gpgscm/scheme.c (S_FLAG_TAIL_CONTEXT): New macro.  This flag
indicates that the interpreter is evaluating an expression in a tail
context (see R5RS, section 3.5).
(opexe_0): Clear and set the flag according to the rules layed out in
R5RS, section 3.5.
(opexe_1): Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-08 17:15:20 +01:00
Justus Winter
a4a69163d9 gpgscm: Add flags to the interpreter.
* tests/gpgscm/scheme-private.h (struct scheme): Add field 'flags'.
* tests/gpgscm/scheme.c (S_OP_MASK): New macro.
(S_FLAG_MASK, s_set_flag, s_clear_flag, s_get_flag): Likewise.
(_s_return): Unpack the encoded opcode and flags.
(s_save): Encode the flags along with the opcode.  Use normal
integers to encode the result.
(scheme_init_custom_alloc): Initialize 'op' and 'flags'.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-08 17:15:20 +01:00
Justus Winter
fcf5aea446 gpgscm: Implement tags.
* tests/gpgscm/opdefines.h: Add opcodes to create and retrieve tags.
* tests/gpgscm/scheme.c (T_TAGGED): New macro.
(mk_tagged_value): New function.
(has_tag): Likewise.
(get_tag): Likewise.
(mark): Mark tag.
(opexe_4): Implement new opcodes.
* tests/gpgscm/scheme.h (USE_TAGS): New macro.
--

Tags are similar to property lists, but property lists can only be
attached to symbols.  Tags can not be attached to an existing object,
but a tagged copy can be created.  Once done, the tag can be
manipulated in constant time.

Using this during parsing will enable us to produce meaningful error
messages.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-08 17:15:20 +01:00
Werner Koch
a75790b740
gpg: Fix the fix out-of-bounds access.
* g10/tofu.c (build_conflict_set): Revert to int* and fix calloc.
--

The original code used an int array and thus better keep that and do
not limit it to 128 entries.

Fixes-commit: c3008bffac
Fixes-commit: 3b5b94ceab
Signed-off-by: Werner Koch <wk@gnupg.org>
2016-12-08 17:03:26 +01:00
Werner Koch
d8c5e8ccfd
wks: New option --check for gpg-wks-client.
* tools/call-dirmngr.c (wkd_get_key): New.
* tools/gpg-wks-client.c (aCheck): New constant.
(opts): New option "--check".
(main): Call command_check.
(command_check): New.
--

GnuPG-bug-id: 2866
Signed-off-by: Werner Koch <wk@gnupg.org>
2016-12-08 16:59:12 +01:00
Werner Koch
c3138decd7
tools: Move a function from gpg-wks-server to wks-util.c.
* tools/gpg-wks-server.c (list_key_status_cb): Remove.
(list_key): Move to ...
* tools/wks-util.c (wks_list_key): here and rename.  Add new args
R_FPR and R_MBOXES and remove the CTX.
(list_key_status_cb): New.
* tools/wks-util.c: Include ccparray.h, exectool.h, and mbox-util.h.
* tools/gpg-wks-server.c (process_new_key): Replace list_key by
wks_list_key.
(check_and_publish): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-12-08 16:59:12 +01:00
Justus Winter
a2bedc8ac6 gpgscm: Generalize 'for-each-p'.
* tests/gpgscm/tests.scm (for-each-p): Generalize to N lists like
for-each.
(for-each-p'): Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-08 15:39:05 +01:00
Justus Winter
3b5b94ceab g10: Fix out-of-bounds access.
* g10/tofu.c (build_conflict_set): Use 'char'.

Fixes-commit: c3008bffac
Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-08 14:19:09 +01:00
Werner Koch
dd03667ab1
tools: Fix use of uninitialized var in mime-maker.
* tools/mime-maker.c (ensure_part): Make sure to set R_PARENT on
error.
(add_missing_headers): Ensure that ERR is set on success.

* tools/wks-util.c (wks_parse_policy): Fix indentation.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-12-08 13:08:02 +01:00
Werner Koch
b265969154
tools: Fix memleak in gpgconf.
* tools/gpgconf.c (main): Free SOCKETDIR.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-12-08 13:08:02 +01:00
Werner Koch
c3008bffac
gpg: Fix portability problem.
* g10/tofu.c (build_conflict_set): Replace variable dynamic array.
--

Note that clang complained that CONFLICT_SET_COUNT could be negative.
Thus I added an assert.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-12-08 13:08:02 +01:00
Justus Winter
dec2ae31a4 tests: Add test for '--quick-set-expire'.
* tests/openpgp/quick-key-manipulation.scm: Test '--quick-set-expire'.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-07 15:12:19 +01:00
Justus Winter
92df40a3a2 tests: Improve quick key manipulation test.
* tests/openpgp/quick-key-manipulation.scm: Do not update the trust
database, rather be more specific when filtering the user ids.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-07 14:49:49 +01:00
Daniel Kahn Gillmor
8636ad5023 agent: Respect --enable-large-secmem
* agent/gpg-agent.c (main): Initialize secmem to the configured buffer
size.

--

This patch is a step toward addressing
GnuPG-bug-id: 2857

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2016-12-06 11:02:47 -05:00
Justus Winter
e352ead43f tests: Add test importing a revocation certificate.
* tests/openpgp/Makefile.am (XTESTS): Add new test.
* tests/openpgp/import-revocation-certificate.scm: New file.
* tests/openpgp/samplemsgs/revoke-2D727CC768697734.asc: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-06 15:33:25 +01:00
Justus Winter
5b5d881f47 tests: Rename 'error' to 'fail'.
* tests/gpgscm/tests.scm (error): Rename to 'fail'.  'error' is a
primitive function (an opcode) of the TinySCHEME vm, and 'error' is
also defined by R6RS.  Better avoid redefining that.  Fix all call
sites.
* tests/openpgp/4gb-packet.scm: Adapt.
* tests/openpgp/decrypt-multifile.scm: Likewise.
* tests/openpgp/ecc.scm: Likewise.
* tests/openpgp/export.scm: Likewise.
* tests/openpgp/gpgtar.scm: Likewise.
* tests/openpgp/gpgv-forged-keyring.scm: Likewise.
* tests/openpgp/import.scm: Likewise.
* tests/openpgp/issue2015.scm: Likewise.
* tests/openpgp/issue2346.scm: Likewise.
* tests/openpgp/issue2419.scm: Likewise.
* tests/openpgp/key-selection.scm: Likewise.
* tests/openpgp/mds.scm: Likewise.
* tests/openpgp/multisig.scm: Likewise.
* tests/openpgp/setup.scm: Likewise.
* tests/openpgp/signencrypt.scm: Likewise.
* tests/openpgp/ssh-import.scm: Likewise.
* tests/openpgp/tofu.scm: Likewise.
* tests/openpgp/verify.scm: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-06 15:25:55 +01:00
Justus Winter
89ac071eb4 tests: Remove debugging display.
* tests/openpgp/tofu.scm: Remove debugging display.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-06 15:25:44 +01:00
Neal H. Walfield
87972fdef2 tests: Update distributed files
* tests/openpgp/Makefile.am (TEST_FILES): Remove tofu-keys.asc,
tofu-keys-secret.asc, tofu-2183839A-1.txt, tofu-BC15C85A-1.txt and
tofu-EE37CF96-1.txt.  Add tofu/conflicting/1C005AF3.gpg,
tofu/conflicting/1C005AF3-secret.gpg, tofu/conflicting/1C005AF3-1.txt,
tofu/conflicting/1C005AF3-2.txt, tofu/conflicting/1C005AF3-3.txt,
tofu/conflicting/1C005AF3-4.txt, tofu/conflicting/1C005AF3-5.txt,
tofu/conflicting/B662E42F.gpg, tofu/conflicting/B662E42F-secret.gpg,
tofu/conflicting/B662E42F-1.txt, tofu/conflicting/B662E42F-2.txt,
tofu/conflicting/B662E42F-3.txt, tofu/conflicting/B662E42F-4.txt,
tofu/conflicting/B662E42F-5.txt, tofu/conflicting/BE04EB2B.gpg,
tofu/conflicting/BE04EB2B-secret.gpg, tofu/conflicting/BE04EB2B-1.txt,
tofu/conflicting/BE04EB2B-2.txt, tofu/conflicting/BE04EB2B-3.txt,
tofu/conflicting/BE04EB2B-4.txt, tofu/conflicting/BE04EB2B-5.txt and
tofu/conflicting/README.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
Fixes-commit: d5b18d6
2016-12-06 14:26:36 +01:00
Neal H. Walfield
7572d270fc doc: Improve the text in the gpg manual
* doc/gpg.texi: Improve the text.

Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-12-06 12:16:59 +01:00
Neal H. Walfield
6102099985 g10: Avoid a memory leak.
* g10/gpg.c (main): Free KB when we're done with it.

Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-12-06 12:16:59 +01:00
Neal H. Walfield
db6d8cfdc1 tests: Change (interactive-shell) to start an interactive shell
* tests/gpgscm/tests.scm (interactive-shell): Start an interactive
shell.

Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-12-06 12:16:58 +01:00
Neal H. Walfield
17c717d7c9 tests: Check the signature count in the TOFU TFS record.
* tests/openpgp/tofu.scm: Check the signature count in the TOFU TFS
record.

Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-12-06 12:16:57 +01:00
Neal H. Walfield
d5b18d6c55 tests: Replace data used by the TOFU conflict test.
* tests/openpgp/tofu-2183839A-1.txt: Remove file.
* tests/openpgp/tofu-BC15C85A-1.txt: Remove file.
* tests/openpgp/tofu-EE37CF96-1.txt: Remove file.
* tests/openpgp/tofu-keys-secret.asc: Remove file.
* tests/openpgp/tofu-keys.asc: Remove file.
* tests/openpgp/tofu/conflicting/1C005AF3.gpg: New file.
* tests/openpgp/tofu/conflicting/1C005AF3-secret.gpg: New file.
* tests/openpgp/tofu/conflicting/1C005AF3-1.txt: New file.
* tests/openpgp/tofu/conflicting/1C005AF3-2.txt: New file.
* tests/openpgp/tofu/conflicting/1C005AF3-3.txt: New file.
* tests/openpgp/tofu/conflicting/1C005AF3-4.txt: New file.
* tests/openpgp/tofu/conflicting/1C005AF3-5.txt: New file.
* tests/openpgp/tofu/conflicting/B662E42F.gpg: New file.
* tests/openpgp/tofu/conflicting/B662E42F-secret.gpg: New file.
* tests/openpgp/tofu/conflicting/B662E42F-1.txt: New file.
* tests/openpgp/tofu/conflicting/B662E42F-2.txt: New file.
* tests/openpgp/tofu/conflicting/B662E42F-3.txt: New file.
* tests/openpgp/tofu/conflicting/B662E42F-4.txt: New file.
* tests/openpgp/tofu/conflicting/B662E42F-5.txt: New file.
* tests/openpgp/tofu/conflicting/BE04EB2B.gpg: New file.
* tests/openpgp/tofu/conflicting/BE04EB2B-secret.gpg: New file.
* tests/openpgp/tofu/conflicting/BE04EB2B-1.txt: New file.
* tests/openpgp/tofu/conflicting/BE04EB2B-2.txt: New file.
* tests/openpgp/tofu/conflicting/BE04EB2B-3.txt: New file.
* tests/openpgp/tofu/conflicting/BE04EB2B-4.txt: New file.
* tests/openpgp/tofu/conflicting/BE04EB2B-5.txt: New file.
* tests/openpgp/tofu/conflicting/README: New file.
* tests/openpgp/tofu.scm: Update accordingly.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>

There are two motivations for this change.  First, we decided that
test data should live in a subdirectory rather than in tests/openpgp.
Second, secret key material is password protected, and I don't
remember the password that I used.  (The new data is not password
protected.)  I have also added some new examples of signed messages.
2016-12-06 12:16:57 +01:00
Neal H. Walfield
bd9ebe1404 g10: Remove dead code.
* g10/tofu.c (tofu_set_policy_by_keyid): Remove function.

Signed-off-by: Neal H. Walfield <neal@g10code.com>
2016-12-06 12:16:56 +01:00
Werner Koch
41b3d0975d
gpg: New option --quick-set-expire.
* g10/gpg.c (aQuickSetExpire): New.
(opts): New option --quick-set-expire.
(main): Implement option.
* g10/keyedit.c (menu_expire): Add args FORCE_MAINKEY and
NEWEXPIRATION.  Change semantics of the return value.  Change caller.
(keyedit_quick_set_expire): New.
--

This patch partly solves
GnuPG-bug-id: 2701
2016-12-05 11:00:11 +01:00
Justus Winter
fae4d06b0c tests: New test for '--enarmor' and '--dearmor'.
* tests/openpgp/Makefile.am (XTESTS): Add new test.
* tests/openpgp/enarmor.scm: New file.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-12-05 10:42:23 +01:00
Werner Koch
ef10c348bf
gpg: Fix error code arg in ERRSIG status line.
* g10/mainproc.c (check_sig_and_print): Use gpg_err_code to return an
error code in ERRSIG.
--

Debian-bug-id: 846834
Signed-off-by: Werner Koch <wk@gnupg.org>
2016-12-03 21:36:14 +01:00
Werner Koch
ce29272e24
gpg: New option --default-new-key-algo.
* common/openpgp-oid.c (openpgp_is_curve_supported): Add optional arg
R_ALGO and change all callers.
* common/util.h (GPG_ERR_UNKNOWN_FLAG): New error code.
* g10/options.h (struct opt): Add field DEF_NEW_KEY_ALGO.
* g10/gpg.c (oDefaultNewKeyAlgo): New enum.
(opts): New option "--default-new-key-algo".
(main): Set the option.
* g10/keygen.c: Remove DEFAULT_STD_ FUTURE_STD_ constants and replace
them by ...
(DEFAULT_STD_KEY_PARAM, FUTURE_STD_KEY_PARAM): new string constants.
(get_keysize_range): Remove arg R_DEF and return that value instead.
Change all callers.
(gen_rsa): Use get_keysize_range instead of the removed
DEFAULT_STD_KEYSIZE.
(parse_key_parameter_part): New function.
(parse_key_parameter_string): New function.
(quick_generate_keypair): Refactor using parse_key_parameter_string.
(generate_keypair): Ditto.
(parse_algo_usage_expire): Ditto.
--

This new option is intended to be used in the forthcoming
--set-profile command of gpgconf.  It allows to provide a gpg
configuration with custom defaults for a new key using the simple
commands which use the default algorithm set.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-12-02 19:47:40 +01:00