aboutsummaryrefslogtreecommitdiffstats
path: root/common/util.h (unfollow)
Commit message (Collapse)AuthorFilesLines
2015-02-04gpg-agent: Use "pinentry-basic" as fallback.Werner Koch1-0/+1
* common/homedir.c (get_default_pinentry_name): New. (gnupg_module_name): Use that for the default pinentry. (gnupg_module_name_flush_some): New. * agent/gpg-agent.c (agent_sighup_action): Flush some module names. * agent/call-pinentry.c (start_pinentry): Do not modify opt.pinentry_program. -- The idea with this change is that under Windows we can install a simple native Windows pinentry as "pinentry-basic" and a full GUI version may then later install pinentry-gtk etc which would then automatically be used. Unfortunately installing another pinentry from a different package would clobber the GnuPG core directory which is not nice. To fix that we would need to agree on standard installation directories for GUIs to also look there. Signed-off-by: Werner Koch <[email protected]>
2015-01-22gpg: Add dedicated error code for PGP-2 keys.Werner Koch1-0/+1
* g10/parse-packet.c (parse_key): Return GPG_ERR_LEGACY_KEY for PGP2 keys. * g10/import.c (read_block): Simplify by checking GPG_ERR_LEGACY_KEY. * g10/getkey.c (lookup): Silence error message for PGP-2 keys. * common/util.h (GPG_ERR_LEGACY_KEY): Add replacement for older libgpg-error. Signed-off-by: Werner Koch <[email protected]>
2014-12-15gpg: Add sub-command "factory-reset" to --card-edit.Werner Koch1-1/+2
* common/util.h (GPG_ERR_OBJ_TERM_STATE): New. * scd/iso7816.c (map_sw): Add this error code. * scd/app-openpgp.c (do_getattr): Return the life cycle indicator. * scd/app.c (select_application): Allow a return value of GPG_ERR_OBJ_TERM_STATE. * scd/scdaemon.c (set_debug): Print the DBG_READER value. * g10/call-agent.c (start_agent): Print a status line for the termination state. (agent_scd_learn): Make arg "info" optional. (agent_scd_apdu): New. * g10/card-util.c (send_apdu): New. (factory_reset): New. (card_edit): Add command factory-reset. Signed-off-by: Werner Koch <[email protected]>
2014-11-27gpg-agent: Add restricted connection feature.Мирослав Николић1-0/+6
* agent/agent.h (opt): Add field extra_socket. (server_control_s): Add field restricted. * agent/command.c: Check restricted flag on many commands. * agent/gpg-agent.c (oExtraSocket): New. (opts): Add option --extra-socket. (socket_name_extra): New. (cleanup): Cleanup that socket name. (main): Implement oExtraSocket. (create_socket_name): Add arg homedir and change all callers. (create_server_socket): Rename arg is_ssh to primary and change callers. (start_connection_thread): Take ctrl as arg. (start_connection_thread_std): New. (start_connection_thread_extra): New. (handle_connections): Add arg listen_fd_extra and replace the connection starting code by parameterized loop. * common/asshelp.c (start_new_gpg_agent): Detect the use of the restricted mode and don't fail on sending the pinentry environment. * common/util.h (GPG_ERR_FORBIDDEN): New.
2014-08-26Switch to the libgpg-error provided estream.Werner Koch1-8/+6
* 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.
2014-04-17common: Add z-base-32 encoder.Werner Koch1-0/+2
* common/zb32.c: New. * common/t-zb32.c: New. * common/Makefile.am (common_sources): Add zb82.c (module_tests): Add t-zb32.
2014-03-14dirmngr: Default to a user socket name and enable autostart.Werner Koch1-1/+2
* common/homedir.c (dirmngr_socket_name): Rename to dirmngr_sys_socket_name. (dirmngr_user_socket_name): New. * common/asshelp.c (start_new_dirmngr): Handle sys and user dirmngr socket. * dirmngr/dirmngr.c (main): Ditto. * dirmngr/server.c (cmd_getinfo): Ditto. * sm/server.c (gpgsm_server): Ditto. * dirmngr/dirmngr-client.c (start_dirmngr): Likewise. * tools/gpgconf.c (main): Print "dirmngr-sys-socket" with --list-dirs. * configure.ac (USE_DIRMNGR_AUTO_START): Set by default.
2014-01-30gpg: Use only OpenPGP public key algo ids and add the EdDSA algo id.Werner Koch1-1/+1
* common/sexputil.c (get_pk_algo_from_canon_sexp): Change to return a string. * g10/keygen.c (check_keygrip): Adjust for change. * sm/certreqgen-ui.c (check_keygrip): Likewise. * agent/pksign.c (do_encode_dsa): Remove bogus map_pk_openpgp_to_gcry. * g10/misc.c (map_pk_openpgp_to_gcry): Remove. (openpgp_pk_test_algo): Change to a wrapper for openpgp_pk_test_algo2. (openpgp_pk_test_algo2): Rewrite. (openpgp_pk_algo_usage, pubkey_nbits): Add support for EdDSA. (openpgp_pk_algo_name): Rewrite to remove need for gcry calls. (pubkey_get_npkey, pubkey_get_nskey): Ditto. (pubkey_get_nsig, pubkey_get_nenc): Ditto. * g10/keygen.c(do_create_from_keygrip): Support EdDSA. (common_gen, gen_ecc, ask_keysize, generate_keypair): Ditto. * g10/build-packet.c (do_key): Ditto. * g10/export.c (transfer_format_to_openpgp): Ditto. * g10/getkey.c (cache_public_key): Ditto. * g10/import.c (transfer_secret_keys): Ditto. * g10/keylist.c (list_keyblock_print, list_keyblock_colon): Ditto. * g10/mainproc.c (proc_pubkey_enc): Ditto. * g10/parse-packet.c (parse_key): Ditto, * g10/sign.c (hash_for, sign_file, make_keysig_packet): Ditto. * g10/keyserver.c (print_keyrec): Use openpgp_pk_algo_name. * g10/pkglue.c (pk_verify, pk_encrypt, pk_check_secret_key): Use only OpenPGP algo ids and support EdDSA. * g10/pubkey-enc.c (get_it): Use only OpenPGP algo ids. * g10/seskey.c (encode_md_value): Ditto. -- This patch separates Libgcrypt and OpenPGP public key algorithms ids and in most cases completely removes the Libgcrypt ones. This is useful because for Libgcrypt we specify the algorithm in the S-expressions and the public key ids are not anymore needed. This patch also adds some support for PUBKEY_ALGO_EDDSA which will eventually be used instead of merging EdDSA with ECDSA. As of now an experimental algorithm id is used but the plan is to write an I-D so that we can get a new id from the IETF. Note that EdDSA (Ed25519) does not yet work and that more changes are required. The ECC support is still broken right now. Needs to be fixed. Signed-off-by: Werner Koch <[email protected]>
2013-11-15gpg: Rework ECC support and add experimental support for Ed25519.Werner Koch1-0/+3
* agent/findkey.c (key_parms_from_sexp): Add algo name "ecc". (agent_is_dsa_key): Ditto. (agent_is_eddsa_key): New. Not finished, though. * agent/pksign.c (do_encode_eddsa): New. (agent_pksign_do): Use gcry_log_debug functions. * agent/protect.c (agent_protect): Parse a flags parameter. * g10/keygen.c (gpg_curve_to_oid): Move to ... * common/openpgp-oid.c (openpgp_curve_to_oid): here and rename. (oid_ed25519): New. (openpgp_oid_is_ed25519): New. (openpgp_oid_to_curve): New. * common/t-openpgp-oid.c (test_openpgp_oid_is_ed25519): New. * g10/build-packet.c (gpg_mpi_write): Write the length header also for opaque MPIs. (gpg_mpi_write_nohdr): New. (do_key): Use gpg_mpi_write_nohdr depending on algorithm. (do_pubkey_enc): Ditto. * g10/ecdh.c (pk_ecdh_encrypt_with_shared_point): Use gpg_mpi_write_nohdr. * g10/export.c (transfer_format_to_openpgp): * g10/keygen.c (ecckey_from_sexp): Return the error. (gen_ecc): Repalce arg NBITS by CURVE. (read_parameter_file): Add keywords "Key-Curve" and "Subkey-Curve". (ask_curve): New. (generate_keypair, generate_subkeypair): Use ask_curve. (do_generate_keypair): Also pass curve name. * g10/keylist.c (list_keyblock_print, list_keyblock_colon): Print curve name. * g10/parse-packet.c (mpi_read): Remove workaround for Libcgrypt < 1.5. (parse_key): Fix ECC case. Print the curve name. * g10/pkglue.c (mpi_from_sexp): Rename to get_mpi_from_sexp. (pk_verify, pk_check_secret_key): Add special case for Ed25519. * g10/seskey.c (encode_md_value): Ditto. * g10/sign.c (do_sign, hash_for, sign_file): Ditto. -- Be warned that this code is subject to further changes and that the format will very likely change before a release. There are also known bugs and missing code. Signed-off-by: Werner Koch <[email protected]>
2013-05-22New debug functions log_printcanon and log_printsexp.Werner Koch1-0/+5
* common/sexputil.c (sexp_to_string, canon_sexp_to_string): New. (log_printcanon, log_printsexp): New. Signed-off-by: Werner Koch <[email protected]>
2013-03-05Require libgpg-error 1.11.Werner Koch1-10/+0
* configure.ac: Require libgpg-error 1.11. * common/util.h (GPG_ERR_NO_KEYSERVER, GPG_ERR_INV_CURVE) (GPG_ERR_UNKNOWN_CURVE): Remove fallback definitions.
2012-11-20Do not use a broken ttyname.Werner Koch1-3/+9
* configure.ac (HAVE_BROKEN_TTYNAME): New ac_define set for Android systems. * common/util.h (gnupg_ttyname): New macro. Change all callers of ttyname to use this macro instead. (ttyname) [W32]: Rename to _gnupg_ttyname and use also if HAVE_BROKEN_TTYNAME is defined. * common/simple-pwquery.c (agent_send_all_options): Keep on using ttyname unless HAVE_BROKEN_TTYNAME is set. This is because this file may be used standalone.
2012-02-06common: Add a global variable to for the default error source.Werner Koch1-1/+6
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.
2011-09-30Change JNLIB license to LGPLv3+ or GPLv2+.Werner Koch1-11/+22
This is to allow the use of this code with code under GPLv2(only).
2011-06-01Fix size_t vs int issues.Marcus Brinkmann1-0/+1
2011-05-20Require libgpg-error 1.10Werner Koch1-15/+0
This allows to remove some error code substitutes. Fixed a typo in gpg.text.
2011-02-02Sample ECC keys and message do now work.Werner Koch1-9/+15
Import and export of secret keys does now work. Encryption has been fixed to be compatible with the sample messages. This version tests for new Libgcrypt function and thus needs to be build with a new Libgcrypt installed.
2011-01-31Move OpenPGP OID helpers to common/.Werner Koch1-1/+5
This is needed so that the agent will be able to export and import OpenPGP secret keys. Add test case. Removed unused function.
2011-01-20All standard keyserver commands are now using dirmngr.Werner Koch1-0/+1
2011-01-10Initial code checking for backup - not yet working.Werner Koch1-0/+3
2011-01-06Integrating http://code.google.com/p/gnupg-ecc/source/detail?r=15 .Andrey Jivsov1-0/+1
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.
2010-12-02s/AES/AES128/ in diagnostics and --list-configWerner Koch1-0/+3
2010-10-13More agent support for gpg.Werner Koch1-0/+2
2010-10-01Exporting secret keys via gpg-agent is now basically supported.Werner Koch1-0/+6
A couple of forward ported changes. Doc updates.
2010-09-02Obscure the cached passphrases.Werner Koch1-0/+4
2010-07-16Some work on porting dirmngr (unfinished)Werner Koch1-0/+6
Ported gpgtar to W32.
2010-06-21Implement export of pkcs#12 objects using a direct agent connection.Werner Koch1-1/+6
2010-06-17Avoid using the protect-tool to import pkcs#12.Werner Koch1-0/+2
2010-06-09Merged Dirmngr with GnuPG.Werner Koch1-0/+2
A few code changes to support dirmngr.
2010-04-20Add a separate header for time related fucntions.Werner Koch1-41/+1
2010-04-14./autogen.sh --build-w32ce does now succeed.Werner Koch1-0/+4
2010-04-14Whole lot of changes to support CE.Werner Koch1-0/+2
2010-03-22More chnages to use estream. Add a way to replace the standardWerner Koch1-1/+0
descriptors.
2010-03-15Builds again for W32.Werner Koch1-5/+0
2010-03-15Finished the bulk of changes to use estream in most places instead ofWerner Koch1-3/+2
stdio.
2010-03-10Merged jnlib into common.Werner Koch1-13/+14
2010-03-02First steps towards the W32CE portWerner Koch1-0/+7
2009-07-23Print status of CRL checks in the audit log.Werner Koch1-0/+5
2009-07-01Alow batch ode for gpgsm --gen-key.Werner Koch1-0/+3
Allow CSR generation using an existing key with gpgsm.
2009-05-07New helper function factored out of ../scd and equipped with test code.Werner Koch1-0/+9
2009-04-01Import/export of pkcs#12 now uses the gpg-agent directly.Werner Koch1-0/+5
Removed duplicated code (percent unescaping).
2009-03-16Remove duplicated code.Werner Koch1-0/+1
2009-03-06New gpg-agent command to list key information.Werner Koch1-1/+3
Gpgsm does now print the S/N of cards. Consider ephemeral keys during listing an export.
2008-12-05Add a custom prompt for the CSR generation.Werner Koch1-0/+3
Add a new percent escape fucntion.
2008-11-04Revamped the W32 gettext implementation.Werner Koch1-0/+1
2008-10-17Use more warning options with modern GCCs.Werner Koch1-0/+7
Other minor changes.
2008-09-03Fix gpg-preset-passphrase bug.Werner Koch1-0/+3
Cleanups
2008-06-09Add Base64 decoder. Not yet used but complements out encoder.Werner Koch1-1/+12
2008-06-05As a failsafe measure use memcpy instead of strcpy in gnupg_copy_time.Werner Koch1-4/+10
Typo fix.
2008-05-27Fixed segv in gpg-agent (command marktrusted).Werner Koch1-0/+2
Replaced almost all free by xfree. Translation fixes.