summaryrefslogtreecommitdiffstats
path: root/kbx (follow)
Commit message (Collapse)AuthorAgeFilesLines
* gpg: Skip overlong keys and a print a warning.Werner Koch2014-10-092-3/+12
| | | | | | | | | | | | | * kbx/keybox-search.c (keybox_search): Add arg r_skipped and skip too long blobs. * sm/keydb.c (keydb_search): Call keybox_search with a dummy param. * g10/keydb.c (struct keydb_handle): Add field skipped_long_blobs. (keydb_search_reset): Reset that field. (keydb_search): Update that field. (keydb_get_skipped_counter): New. * g10/keylist.c (list_all): Print count of skipped keys. Signed-off-by: Werner Koch <wk@gnupg.org>
* kbx: Fix handling of overlong keys.Werner Koch2014-10-092-7/+41
| | | | | | | | | | | | | | | | | * kbx/keybox-file.c (IMAGELEN_LIMIT): Change limit from 10^6 to 2MiB. (_keybox_read_blob2): Skip too long record records. (_keybox_write_blob): Do not accept too long record. * kbx/keybox-dump.c (file_stats_s): Add field skipped_long_blobs. (_keybox_dump_file): Print new counter. (_keybox_dump_file): Skip too long records. ---- To test this feature you may set the limit back to 1MiB and use key F7F0E70F307D56ED which is in my local copy close to 2MiB. Without this patch it was possible to import the key but access to that key and all keys stored after it was not possible. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Take care to use pubring.kbx if it has ever been used.Werner Koch2014-10-097-27/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * kbx/keybox-defs.h (struct keybox_handle): Add field for_openpgp. * kbx/keybox-file.c (_keybox_write_header_blob): Set openpgp header flag. * kbx/keybox-blob.c (_keybox_update_header_blob): Add arg for_openpgp and set header flag. * kbx/keybox-init.c (keybox_new): Rename to do_keybox_new, make static and add arg for_openpgp. (keybox_new_openpgp, keybox_new_x509): New. Use them instead of the former keybox_new. * kbx/keybox-update.c (blob_filecopy): Add arg for_openpgp and set the openpgp header flags. * g10/keydb.c (rt_from_file): New. Factored out and extended from keydb_add_resource. (keydb_add_resource): Switch to the kbx file if it has the openpgp flag set. * kbx/keybox-dump.c (dump_header_blob): Print header flags. -- The problem was reported by dkg on gnupg-devel (2014-10-07): I just discovered a new problem, though, which will affect people on systems that have gpg and gpg2 coinstalled: 0) create a new keyring with gpg2, and use it exclusively with gpg2 for a while. 1) somehow (accidentally?) use gpg (1.4.x) again -- this creates ~/.gnupg/pubring.gpg 2) future runs of gpg2 now only look at pubring.gpg and ignore pubring.kbx -- the keys you had accumulated in the keybox are no longer listed in the output of gpg2 --list-keys Note that gpgsm has always used pubring.kbx and thus this file might already be there but without gpg ever inserted a key. The new flag in the KBX header gives us an indication whether a KBX file has ever been written by gpg >= 2.1. If that is the case we will use it instead of the default pubring.gpg. Signed-off-by: Werner Koch <wk@gnupg.org>
* Switch to the libgpg-error provided estream.Werner Koch2014-08-261-0/+1
| | | | | | | | | | * configure.ac (NEED_GPG_ERROR_VERSION): Reguire 1.14. (GPGRT_ENABLE_ES_MACROS): Define. (estream_INIT): Remove. * m4/estream.m4: Remove. * common/estream-printf.c, common/estream-printf.h: Remove. * common/estream.c, common/estream.h: Remove. * common/init.c (_init_common_subsystems): Call gpgrt initialization.
* kbx: Make user id and signature data optional for OpenPGP.Werner Koch2014-08-181-11/+16
| | | | | | | | * kbx/keybox-blob.c (_keybox_create_openpgp_blob): Remove restriction. -- Although self-signature and key binding signatures are required by OpenPGP, we should not enforce that in the storage backend.
* gpgsm: Add a way to save a found state.Werner Koch2014-06-023-7/+42
| | | | | | | | | | | * kbx/keybox-defs.h (keybox_found_s): New. (keybox_handle): Factor FOUND out to above. Add saved_found. * kbx/keybox-init.c (keybox_release): Release saved_found. (keybox_push_found_state, keybox_pop_found_state): New. * sm/keydb.c (keydb_handle): Add field saved_found. (keydb_new): Init it. (keydb_push_found_state, keydb_pop_found_state): New.
* gpg: Fix uninitialized access to search descindex with gpg keyboxes.Werner Koch2014-05-142-4/+8
| | | | | | | | | | * kbx/keybox-search.c (keybox_search): Add arg R_DESCINDEX. Chnage both callers. * g10/keydb.c (keydb_search): Always set DESCINDEX. -- This only affects the new keybox for OpenPGP keys in 2.1. The bug exhibited itself by running GPA's backup command on Windows.
* kbx: Add experimental support for EDDSA.Werner Koch2014-05-071-8/+9
| | | | | * kbx/keybox-openpgp.c (parse_key): Use algo constants and add experimental support for EdDSA.
* Two minor code cleanups and one NULL deref on error fix.Werner Koch2014-04-161-2/+2
| | | | | | | | | | * common/estream.c (es_freopen): Remove useless check for STREAM. * kbx/keybox-blob.c (_keybox_create_x509_blob): Remove useless check for BLOB. * tools/sockprox.c (run_proxy): Do not fclose(NULL). -- Found by Hans-Christoph Steiner with cppcheck.
* Make use of the *_NAME etc macros.Werner Koch2013-11-181-1/+1
| | | | | | | | | Replace hardwired strings at many places with new macros from config.h and use the new strusage macro replacement feature. * common/asshelp.c (lock_spawning) [W32]: Change the names of the spawn sentinels. * agent/command.c (cmd_import_key): Use asprintf to create the prompt.
* kbx: Implement update operation for OpenPGP keyblocks.Werner Koch2013-11-156-24/+64
| | | | | | | | | | | | | | | * kbx/keybox-update.c (keybox_update_keyblock): Implement. * kbx/keybox-search.c (get_blob_flags): Move to ... * kbx/keybox-defs.h (blob_get_type): here. * kbx/keybox-file.c (_keybox_read_blob2): Fix calling without R_BLOB. * g10/keydb.c (build_keyblock_image): Allow calling without R_SIGSTATUS. (keydb_update_keyblock): Implement for keybox. * kbx/keybox-dump.c (_keybox_dump_blob): Fix printing of the unhashed size. Print "does not expire" also on 64 bit platforms. Signed-off-by: Werner Koch <wk@gnupg.org>
* kbx: Fix possible segv in kbxdump.Werner Koch2013-11-151-1/+1
| | | | | | * kbx/keybox-dump.c (_keybox_dump_blob): Check length before get32. Signed-off-by: Werner Koch <wk@gnupg.org>
* kbx: Add a few macros for easier readability.Werner Koch2013-08-291-10/+12
| | | | | | | | * kbx/keybox-update.c (FILECOPY_INSERT) (FILECOPY_DELETE, FILECOPY_UPDATE): New macros. Replace numbers by them. Signed-off-by: Werner Koch <wk@gnupg.org>
* Prepare for newer automake versions.Werner Koch2013-06-271-5/+7
| | | | | | | | | | * configure.ac (AM_INIT_AUTOMAKE): Replace 2 argument form by the option form. Add options from the top Makefile. (AM_CONFIG_HEADER): Rename to AC_CONFIG_HEADER. * Makefile.am (AUTOMAKE_OPTIONS): Remove. * kbx/Makefile.am: Remove INCLUDES. Include cmacros.am. FActor some AM_CPPFLAGS options to AM_CFLAGS.
* kbx: Remove unused macro.Werner Koch2013-03-201-6/+0
| | | | * kbx/keybox.h (KEYBOX_WITH_OPENPGP): Remove unused macro.
* kbx: Switch from MD5 to SHA-1 for the checksum.Werner Koch2013-01-082-13/+74
| | | | | | | | | | | | | | | | * kbx/keybox-blob.c (put_membuf): Use a NULL buf to store zero bytes. (create_blob_finish): Write just the needed space. (create_blob_finish): Switch to SHA-1. * kbx/keybox-dump.c (print_checksum): New. (_keybox_dump_blob): Print the checksum and the verification status. -- The checksum was never used in the past. Due to fast SHA-1 computations in modern CPUs we now use SHA-1. Eventually we will support a First blob flag to enable the use of a secret or public HMAC-SHA1. The first may be used for authentication of keyblocks and the latter to mitigate collission attacks on SHA-1. It is not clear whether this will be useful at all.
* kbx: Update blob specificationWerner Koch2013-01-081-86/+112
| | | | | | -- Mainly formatting updates. The only actual change is the checksum which is now declared as SHA-1.
* gpg: Set the node flags while retrieving a keyblock.Werner Koch2013-01-072-22/+43
| | | | | | | | | | | | | | | | * g10/keydb.c (parse_keyblock_image): Add args PK_NO and UID_NO and set the note flags accordingly. (keydb_get_keyblock): Transfer PK_NO and UID_NO to parse_keyblock_image. * kbx/keybox-search.c (blob_cmp_fpr, blob_cmp_fpr_part) (blob_cmp_name, blob_cmp_mail): Return the key/user number. (keybox_search): Set the key and user number into the found struct. (keybox_get_keyblock): Add args R_PK_NO and R_UID_NO and set them from the found struct. -- getkey.c needs to know whether the correct subkey was found. Thus we need to set the node flags the same way we did it with the keyring storage.
* gpg: Allow searching for user ids in a keybox.Werner Koch2013-01-071-20/+37
| | | | | | | | | | * kbx/keybox-search.c (blob_cmp_name): Add arg X509 and adjust for PGP use. Change callers. (blob_cmp_mail): Add arg X509 and find the mailbox offset for PGP. Chnage callers. (has_subject_or_alt): Rename to has_username. (has_username): Allow blobtype PGP. (has_mail): Ditto.
* gpg: Add signature cache support to the keybox.Werner Koch2012-12-286-14/+55
| | | | | | | | | | | | | | | | | | | * g10/keydb.c (parse_keyblock_image): Add arg SIGSTATUS. (keydb_get_keyblock): Handle it. (build_keyblock_image): Add arg SIGSTATUS. (keydb_insert_keyblock): Handle it. * kbx/keybox-blob.c (pgp_create_sig_part): Add arg SIGSTATUS. (_keybox_create_openpgp_blob): Ditto. * kbx/kbxutil.c (import_openpgp): Adjust for above change. * kbx/keybox.h (KEYBOX_FLAG_SIG_INFO): New. * kbx/keybox-search.c (_keybox_get_flag_location): Handle new flag. (keybox_get_keyblock): Add arg R_SIGSTATUS. * kbx/keybox-update.c (keybox_insert_keyblock): Add arg SIGSTATUS. -- With this change a key listing using the keybox format is now double as fast as using a keyring. The memory use dropped as well. Measured with about 1500 keys.
* kbxutil: Improve format of the Sig-Expire lines.Werner Koch2012-12-281-2/+2
| | | | * kbx/keybox-dump.c (_keybox_dump_blob): Print the expirate timestamp.
* gpg: First working support for keyboxes.Werner Koch2012-12-287-160/+251
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * g10/getkey.c (get_pubkey_fast): Improve the assertion. * kbx/keybox.h: Include iobuf.h. * kbx/keybox-blob.c (keyboxblob_uid): Add field OFF. (KEYBOX_WITH_OPENPGP): Remove use of this macro. (pgp_create_key_part_single): New. (pgp_temp_store_kid): Change to use the keybox-openpgp parser. (pgp_create_key_part): Ditto. (pgp_create_uid_part): Ditto. (pgp_create_sig_part): Ditto. (pgp_create_blob_keyblock): Ditto. (_keybox_create_openpgp_blob): Ditto. * kbx/keybox-search.c (keybox_get_keyblock): New. * kbx/keybox-update.c (keybox_insert_keyblock): New. * g10/keydb.c (parse_keyblock_image): (keydb_get_keyblock): Support keybox. (build_keyblock_image): New. (keydb_insert_keyblock): Support keybox. * kbx/kbxutil.c (import_openpgp, main): Add option --dry-run and print a kbx file to stdout. * kbx/keybox-file.c (_keybox_read_blob2): Allow keyblocks up to 10^6 bytes. -- Import and key listing does now work with the keybox format. It is still quite slow and signature caching is completely missing. Increasing the maximum allowed length for a keyblock was required due to a 700k keyblock which inhibited kbxutil to list the file. kbxutil's option name --import-openpgp is not quite appropriate because it only creates KBX blobs from OpenPGP data.
* kbxutil: Print algo number and fold similar lines.Werner Koch2012-12-284-23/+51
| | | | | | | | * kbx/keybox-defs.h (_keybox_openpgp_key_info): Add field ALGO. * kbx/keybox-openpgp.c (parse_key): Store algo. * kbx/kbxutil.c (dump_openpgp_key): Print algo number. * kbx/keybox-dump.c (_keybox_dump_blob): Print identical Sig-Expire value lines with a range of indices.
* gpg: First patches to support a keybox storage backend.Werner Koch2012-12-273-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * kbx/keybox-defs.h (_keybox_write_header_blob): Move prototype to .. * kbx/keybox.h: here. * kbx/keybox-init.c (keybox_lock): Add dummy function * g10/keydb.c: Include keybox.h. (KeydbResourceType): Add KEYDB_RESOURCE_TYPE_KEYBOX. (struct resource_item): Add field kb. (maybe_create_keyring_or_box): Add error descriptions to diagnostics. Add arg IS_BOX. Write a header for a new keybox file. (keydb_add_resource): No more need for the force flag. Rename the local variable "force" to "create". Add URL scheme "gnupg-kbx". Add magic test to detect a keybox file. Add basic support for keybox. (keydb_new, keydb_get_resource_name, keydb_delete_keyblock) (keydb_locate_writable, keydb_search_reset, keydb_search2): Add support for keybox. (lock_all, unlock_all): Ditto. * g10/Makefile.am (needed_libs): Add libkeybox.a. (gpg2_LDADD, gpgv2_LDADD): Add KSBA_LIBS as a workaround. * g10/keydb.h (KEYDB_RESOURCE_FLAG_PRIMARY) KEYDB_RESOURCE_FLAG_DEFAULT, KEYDB_RESOURCE_FLAG_READONLY): New. * g10/gpg.c, g10/gpgv.c (main): Use new constants. -- I did most of these changes back in 2011 and only cleaned them up now. More to follow soon.
* Fix typos spotted during translationsDavid Prévot2012-08-241-1/+1
| | | | | | | | | | | | | | | * agent/genkey.c: s/to to/to/ * sm/*.c: s/failed to allocated/failed to allocate/ * sm/certlist.c, ./dirmngr/validate.c: s/should have not/should not have/ * g10/seskey.c: missing closing parenthesis * dirmngr/crlcache.c: s/may has/may have/ Consistency fix: * g10/gpg.c, kbx/kbxutil.c, sm/gpgsm.c: uppercase after Syntax * dirmngr/dirmngr_ldap: no period in Syntax * dirmngr/dirmngr-client.c: infinitive for option description: s/certificates are expected/expect certificates/
* Change all quotes in strings and comments to the new GNU standard.Werner Koch2012-06-054-15/+15
| | | | | | | | | | | | | | | | | | | The asymmetric quotes used by GNU in the past (`...') don't render nicely on modern systems. We now use two \x27 characters ('...'). The proper solution would be to use the correct Unicode symmetric quotes here. However this has the disadvantage that the system requires Unicode support. We don't want that today. If Unicode is available a generated po file can be used to output proper quotes. A simple sed script like the one used for en@quote is sufficient to change them. The changes have been done by applying sed -i "s/\`\([^'\`]*\)'/'\1'/g" to most files and fixing obvious problems by hand. The msgid strings in the po files were fixed with a similar command.
* common: Add a global variable to for the default error source.Werner Koch2012-02-062-4/+7
| | | | | | | | | | | | | | For the shared code parts it is cumbersome to pass an error sourse variable to each function. Its value is always a constant for a given binary and thus a global variable makes things a lot easier than the former macro stuff. * common/init.c (default_errsource): New global var. (init_common_subsystems): Rename to _init_common_subsystems. Set DEFAULT_ERRSOURCE. * common/init.h: Assert value of GPG_ERR_SOURCE_DEFAULT. (init_common_subsystems): New macro. * common/util.h (default_errsource): Add declaration. * kbx/keybox-defs.h: Add some GPG_ERR_SOURCE_DEFAULT trickery.
* Generate the ChangeLog from commit logs.Werner Koch2011-12-011-1/+12
| | | | | | | | | | | | | * scripts/gitlog-to-changelog: New script. Taken from gnulib. * scripts/git-log-fix: New file. * scripts/git-log-footer: New file. * doc/HACKING: Describe the ChangeLog policy * ChangeLog: New file. * Makefile.am (EXTRA_DIST): Add new files. (gen-ChangeLog): New. (dist-hook): Run gen-ChangeLog. Rename all ChangeLog files to ChangeLog-2011.
* Fixed set but unused variable bugsWerner Koch2011-08-101-8/+1
|
* Update OpenPGP parser to support ECCWerner Koch2011-04-283-63/+83
|
* Nuked almost all trailing white space.post-nuke-of-trailing-wsWerner Koch2011-02-0416-258/+248
| | | | | | | | We better do this once and for all instead of cluttering all future commits with diffs of trailing white spaces. In the majority of cases blank or single lines are affected and thus this change won't disturb a git blame too much. For future commits the pre-commit scripts checks that this won't happen again.
* Editorial changes and allow building with old libgcrypts.Werner Koch2011-01-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Changed order of some conditional to make to put the special case into the true branch. Indentation changes. Minor other changes to make the ECC code more similar to the rest of our code. It builds but many sefltests still fail. Need to fix that before using it with an ECDH enabled libgcrypt. [/] 2011-01-21 Werner Koch <wk@g10code.com> * configure.ac: Need Libgcrypt 1.4.6 due to AESWRAP. (HAVE_GCRY_PK_ECDH): Add new test. [agent/] 2011-01-21 Werner Koch <wk@g10code.com> * cvt-openpgp.c (GCRY_PK_ECDH) [!HAVE_GCRY_PK_ECDH]: New. [include/] 2011-01-21 Werner Koch <wk@g10code.com> * cipher.h (GCRY_PK_USAGE_CERT): Remove compatibility macros because we now require libgcrypt 1.4.6. (GCRY_PK_ECDH): Add replacement.
* Integrating http://code.google.com/p/gnupg-ecc/source/detail?r=15 .Andrey Jivsov2011-01-061-1/+6
| | | | | | | | | | The following works: gpg2 --gen-key (ECC) gpg2 --list-keys gpg2 --list-packets ~/.gnupg/pubring.gpg gpg2 --list-packets <private key from http://sites.google.com/site/brainhub/pgpecckeys> ECDH doesn't work yet as the code must be re-written to adjust for gpg-agent refactoring.
* fix reallocation bugWerner Koch2010-07-232-0/+5
|
* More changes on the way to remove secring.gpg.Werner Koch2010-04-212-14/+7
|
* common/Marcus Brinkmann2010-04-202-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 2010-04-20 Marcus Brinkmann <marcus@g10code.de> * logging.c (do_log_ignore_arg): New helper function. (log_string): Use it to remove ugly volatile hack that causes gcc warning. (log_flush): Likewise. * sysutils.c (gnupg_unsetenv) [!HAVE_W32CE_SYSTEM]: Return something. (gnupg_setenv) [!HAVE_W32CE_SYSTEM]: Likewise. * pka.c (get_pka_info): Solve strict aliasing rule violation. * t-exechelp.c (test_close_all_fds): Use dummy variables to silence gcc warning. kbx/ 2010-04-20 Marcus Brinkmann <marcus@g10code.de> * keybox-update.c [!HAVE_DOSISH_SYSTEM]: Include ../common/sysutils.h even then to silence gcc warning about missing declaration of gnupg_remove. tools/ 2010-04-20 Marcus Brinkmann <marcus@g10code.de> * gpgconf-comp.c (option_check_validity): Use dummy variables to silence gcc warning.
* More changes for CE. gpgsm does now build and run a keylisting.Werner Koch2010-03-243-5/+24
|
* More chnages to use estream. Add a way to replace the standardWerner Koch2010-03-221-1/+1
| | | | | descriptors.
* Merged jnlib into common.Werner Koch2010-03-107-13/+20
|
* Use macros for iobuf ioctls. Werner Koch2010-03-082-3/+7
|
* Implement --faked-systrem-time for gpg.Werner Koch2009-12-171-0/+3
| | | | | Typo and comment fixes.
* Unification of the search descriptor usage.Werner Koch2009-12-083-11/+40
|
* Make bug reporting address easier changeable.Werner Koch2009-07-211-3/+2
|
* Fixed a bunch of little bugs as reported by Fabian Keil.Werner Koch2009-06-241-0/+2
| | | | | Still one problem left; marked with a gcc #warning.
* New gpg-agent command to list key information.Werner Koch2009-03-061-1/+1
| | | | | | Gpgsm does now print the S/N of cards. Consider ephemeral keys during listing an export.
* Minor fixes.Werner Koch2008-12-092-2/+5
|
* Fixed a temporary file name collision between gpg and gpgsm under Windows.Werner Koch2008-11-203-7/+15
|
* Reorder libs in kbx. Werner Koch2008-11-112-2/+7
|
* Marked all unused args on non-W32 platforms.Werner Koch2008-10-206-3/+26
|
* Fixed bug#907.Werner Koch2008-05-065-51/+62
| | | | | Fixed a segv in keybox and made it more robust.