aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* gpgv: Improve documentation for keyring choicesdkg/gpgv-doc-improvementDaniel Kahn Gillmor2019-03-031-7/+8
| | | | | | | | | | | | | * doc/gpgv.texi: Improve documentation for keyring choices -- From the existing documentation, it's not clear whether the default keyring will always be mixed into the set of keyrings, or whether it will be skipped if a --keyring is present. The updated text here attempts to describe the keyring selection logic more completely. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* sm: Print Yubikey attestation extensions with --dump-cert.Werner Koch2019-03-011-3/+37
| | | | | | | | | * sm/keylist.c (oidtranstbl): Add Yubikey OIDs. (OID_FLAG_HEX): New. (print_hex_extn): New. (list_cert_raw): Make use of that flag. Signed-off-by: Werner Koch <[email protected]>
* scd:piv: Add feature to read Yubikey attestation certificates.Werner Koch2019-03-011-2/+28
| | | | | | | | | | | * scd/app-piv.c (do_readcert): Add hack to read Yubikey attestaions. -- Use gpg-card 'readcert PIV.ATST.9A >x.crt' to store the attestation certificate for 9A into X.CRT. Signed-off-by: Werner Koch <[email protected]>
* scd:piv: Allow writecert to only write matching certs.Werner Koch2019-03-011-22/+55
| | | | | | | | | * scd/app-piv.c (do_readkey): Read the key from the cert here instead of letting the upper layer do this. (do_writecert): Check that the cert matches the key and that a key has already been generated. Signed-off-by: Werner Koch <[email protected]>
* card: Remove the "admin" command.Werner Koch2019-03-011-114/+67
| | | | | | | | | | | | | | * tools/gpg-card.c (cmd_passwd): Remove arg allow_admin. (enum cmdids): Rename cmdAUTHENTICATE to cmdAUTH and cmdFACTORYRESET to cmdFACTRST. (cmds): Remove column 'admin_only'. (interactive_loop): Remove admin_only stuff. -- That command has always been an annoyance. Symbols have been renamed for source cosmetics. Signed-off-by: Werner Koch <[email protected]>
* sm: Don't mark a cert as de-vs compliant if it leads to SHA-1 sigs.Werner Koch2019-02-281-4/+9
| | | | | | | | | | | | | | | | | | * sm/keylist.c (print_compliance_flags): Also check the diges_also. -- A certificate with algorithm sha1WithRSAEncryption can be de-vs compliant (e.g. if the next in the chain used sha256WithRSAEncryption to sign it and RSA is long enough) but flagging it as such is useless because that certificate can't be used because it will create signatures using the non-compliant SHA-1 algorithm. Well, it could be used for encryption. But also evaluating the key-usage flags here would make it harder for the user to understand why certain certificates are listed as de-vs compliant and others are not. Signed-off-by: Werner Koch <[email protected]>
* agent: PKSIGN should return signature in same format for card.NIIBE Yutaka2019-02-271-46/+36
| | | | | | | | | | | | | | * agent/pksign.c (agent_pksign_do): -- It's best to keep same data format by libgcrypt. For card (due to historical reasons), gpg-agent or scdaemon used to prefix 0x00 when it starts 0x80, so that it can be parsed signed MPI as well as unsigned MPI. It used to do nothing for preceding zeros. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Simplify the app_readkey parameters.Werner Koch2019-02-267-117/+93
| | | | | | | | | | | | | | * scd/app-help.c (app_help_pubkey_from_cert): New. * scd/command.c (cmd_readkey): Refactor to use that new function and handle the --advanced flag only here. * scd/app.c (app_readkey): Remove parm advanced. * scd/app-common.h (struct app_ctx_s): Remove parm advanced from the readkey member. * scd/app-nks.c (do_readkey): Adjust for removed parm. * scd/app-piv.c (do_readkey): Ditto. * scd/app-openpgp.c (do_readkey): Ditto. Signed-off-by: Werner Koch <[email protected]>
* conf: New option --show-socket.Werner Koch2019-02-263-29/+48
| | | | | | | | | | | | | | | | | | | | | | * tools/gpgconf-comp.c (gc_component_t): Move this enum to ... * tools/gpgconf.h: here. * tools/gpgconf.c (oShowSocket): New. (opts): Add new option. (main): Implement new option. -- This is a convenience options for software which directly connects to gpg-agent and thus needs to new the socket. By using --show-socket along with --launch that software can also autostart the agent or the dirmngr. Without this two calls to gpgconf would be required. Actually the same behaviour can be achieved by running gpg-connect-agent to query the running gpg-agent's socket via GETINFO. The gpg-connect also makes sure that the agent is started. This is not anymore suggested because gpgconf shall in future be used for all such things. Signed-off-by: Werner Koch <[email protected]>
* libdns: Avoid using compound literals (8).NIIBE Yutaka2019-02-261-20/+0
| | | | | | | | | | | | | * dirmngr/dns.h (dns_quietinit): Remove. (dns_hints_i_new): Remove. -- Even before our change, dns_quietinit was questionable macro; There was no place in dns.c which requires overrides in initializer list. Only redundant zero were. Signed-off-by: NIIBE Yutaka <[email protected]>
* libdns: Avoid using compound literals (7).NIIBE Yutaka2019-02-263-12/+16
| | | | | | | | | | | | | | | | * dirmngr/dns.h (DNS_OPTS_INIT, dns_opts): Remove. * dirmngr/dns-stuff.c (libdns_res_open): Use zero-ed, and initialized automatic variable for opts. * dirmngr/dns.c (send_query, resolve_query, resolve_addrinfo): Likewise. -- In fact, DNS_OPTS_INIT was only needed when args are none. With partially specified initialization, C99 guarantees zero-ed other members just like static object. Signed-off-by: NIIBE Yutaka <[email protected]>
* libdns: Avoid using compound literals (6).NIIBE Yutaka2019-02-263-33/+51
| | | | | | | | | | | | | * dirmngr/dns.h (dns_rr_i_new): Remove. (dns_rr_i_init): Remove unused second argument. * dirmngr/dns.c (dns_p_dump, dns_hints_query, print_packet) (parse_packet): Use automatic variable for struct dns_rr_i. (dns_d_cname): No need to call dns_rr_i_init after memset 0. (dns_rr_i_init): Remove unused second argument. Return nothing. * dirmngr/dns-stuff.c (resolve_addr_libdns, get_dns_cert_libdns) (getsrv_libdns): Follow the change of dns_rr_i_init. Signed-off-by: NIIBE Yutaka <[email protected]>
* libdns: Avoid using compound literals (5).NIIBE Yutaka2019-02-262-2/+3
| | | | | | | | | | | | | | | * dirmngr/dns.h (dns_rr_foreach): Don't use dns_rr_i_new. Call dns_rr_grep with NULL. * dirmngr/dns.c (dns_rr_grep): Support NULL for error_. -- Here we still use C99 feature of struct member initialization in dns_rr_foreach, for struct dns_rr_i. Note that in C99, it guarantees non-specified member fields are initialized by zero. So, there's no need to use dns_rr_i_new at all. Signed-off-by: NIIBE Yutaka <[email protected]>
* libdns: Avoid using compound literals (4).NIIBE Yutaka2019-02-262-7/+6
| | | | | | | | | * dirmngr/dns.h (dns_d_new*): Remove. * dirmngr/dns.c (parse_packet): Use dns_d_init with automatic variable. (parse_domain): Likewise. Signed-off-by: NIIBE Yutaka <[email protected]>
* libdns: Avoid using compound literals (3).NIIBE Yutaka2019-02-262-12/+18
| | | | | | | | | | | | | | | * dirmngr/dns.h (dns_p_new): Remove. * dirmngr/dns.c (dns_hosts_query): Use dns_p_init with automatic variable. (dns_hints_query, dns_res_glue, parse_packet, query_hosts) (send_query, show_hints, echo_port): Likewise. -- Implicit automatic allocation by compound literals is confusing for C90 code. Signed-off-by: NIIBE Yutaka <[email protected]>
* libdns: Avoid using compound literals (2).NIIBE Yutaka2019-02-262-19/+12
| | | | | | | | | | | | * dirmngr/dns.h (dns_strsection1, dns_strsection3): Remove. (dns_strclass1, dns_strclass3): Remove. (dns_strtype1, dns_strtype3): Remove. (dns_strsection, dns_strclass, dns_strtype): Directly use the function. * dirmngr/dns.c (dns_strsection): Use automatic variable. (dns_strclass, dns_strtype): Likewise. Signed-off-by: NIIBE Yutaka <[email protected]>
* libdns: Avoid using compound literals.NIIBE Yutaka2019-02-261-5/+10
| | | | | | | | | | | | | | | * dirmngr/dns.c (dns_inet_pton, dns_so_tcp_keep): Use automatic variables. (dns_poll, dns_send_nopipe): Likewise, adding const qualifier. -- Compound literals is a feature of C99. Because we only use C90 plus some limited features, in the project, it's better to avoid it. Besides, we make sure when it's read-only. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: PIV: Always require a PIN for signing with 9C.Werner Koch2019-02-251-8/+20
| | | | | | | * scd/app-piv.c (verify_chv): Add arg 'force'. (do_sign): Use force for 0x9c. Signed-off-by: Werner Koch <[email protected]>
* card: Rename gpg-card-tool to gpg-card.Werner Koch2019-02-2512-55/+62
| | | | | | | | | | | * tools/card-tool-keys.c: Rename to card-keys.c. * tools/card-tool-misc.c: Rename to card-misc.c. * tools/card-tool-yubikey.c: Rename to card-yubikey.c. * tools/card-tool.h: Rename to gpg-card.h. * tools/gpg-card-tool-w32info.rc: Rename to gpg-card-w32info.rc * doc/card-tool.texi: Rename top gpg-card.texi Signed-off-by: Werner Koch <[email protected]>
* agent: Fix for suggested Libgcrypt use.Werner Koch2019-02-251-1/+16
| | | | | | | | | | | | * agent/divert-scd.c (divert_pkdecrypt): Skip a flags parameter. -- The libgcrypt docs say that a "flags" parameter should always be used in the input of pkdecrypt. Thus we should allow that parameter also when parsing an s-expression to figure out the algorithm for use with scdaemon. Signed-off-by: Werner Koch <[email protected]>
* gpgscm: Build well even if NDEBUG defined.NIIBE Yutaka2019-02-251-1/+3
| | | | | | | | | | | | | | | | * gpgscm/scheme.c (gc_reservation_failure): Fix adding ";". [!NDEBUG] (scheme_init_custom_alloc): Don't init seserved_lineno. -- Picked from libgpg-error commit of: 8a9397896fd202dcfb3fb46259e43bc05a0ddd2e In some build environment, NDEBUG is defined (although it's bad practice). This change supports such a situation. GnuPG-bug-id: 3959 Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: internal driver: Submit SET_INTERFACE control transfer.NIIBE Yutaka2019-02-221-8/+6
| | | | | | | | | | | | | | | | | | * scd/ccid-driver.c (ccid_open_usb_reader): Alway submit SET_INTERFACE control transfer. -- This handling is not mondatory, but it's better to do so, because there are card reader with pinpad and token with ack button, which support user interaction. User interaction status should be reset at open time. The status should be reset when the session is closed/stopped. In practice, since cleanup routine in a driver may not be called properly, it's good to submit SET_INTERFACE at open time. Signed-off-by: NIIBE Yutaka <[email protected]>
* sm: Fix certificate creation with key on card.Werner Koch2019-02-211-1/+1
| | | | | | | | | | | | | | * sm/certreqgen.c (create_request): Fix for certmode. -- When using an existing key from a card for certificate signing (in contrast to the default of generating a CSR), the code tried to use the same key for signing instead of the Signing-Key parameter. It is perfectly okay to use the regular signing path via gpg-agent for certificate creation - only self-signed certificates with a key on the card require the direct use of the card key (via "SCD PKSIGN"). Signed-off-by: Werner Koch <[email protected]>
* card: Print usage info for each key.Werner Koch2019-02-213-11/+60
| | | | | | | | | * tools/card-call-scd.c (learn_status_cb): Handle extended KEYPARIRINFO. * tools/card-tool.h (struct key_info_s): Add field 'usage'. * tools/gpg-card-tool.c (list_one_kinfo): Show usage flags. Signed-off-by: Werner Koch <[email protected]>
* scd: Extend KEYPAIRINFO by key usage info.Werner Koch2019-02-213-46/+95
| | | | | | | | | | * scd/app-openpgp.c (send_keypair_info): Append usage string. * scd/app-piv.c (struct data_object_s): Remove column 'binary'. Add column 'usage'. (dump_all_do): Adjust for removed 'binary'. (send_keypair_and_cert_info): Append usage string. Signed-off-by: Werner Koch <[email protected]>
* card: Print the keyref in the listing.Werner Koch2019-02-212-1/+2
| | | | | | | | | | * tools/gpg-card-tool.c (list_one_kinfo): Print the keyref. -- The named keys are nice but knowing the actual keyref mapping to them is also useful. Signed-off-by: Werner Koch <[email protected]>
* scd: Don't let the "undefined" app cause a conflict error.Werner Koch2019-02-211-0/+3
| | | | | | * scd/app.c (check_conflict): Ignore "undefined". Signed-off-by: Werner Koch <[email protected]>
* sm: Prepare algo mapping to handle values > 255.Werner Koch2019-02-211-10/+13
| | | | | | | | | | | * sm/misc.c (transform_sigval): Allow for larger values of MDALGO and PKALGO. -- Libgcrypt already defines larger values for them, so we should be prepared in case we use them in the future. Signed-off-by: Werner Koch <[email protected]>
* scd: Clear CHV status on timeout error.NIIBE Yutaka2019-02-211-34/+45
| | | | | | | | | * scd/app-openpgp.c (clear_chv_status): New. (do_change_pin): Use clear_chv_status. (do_sign): Call clear_chv_status on GPG_ERR_TIMEOUT. (do_auth, do_decipher): Likewise. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Handle ack button timeout as GPG_ERR_TIMEOUT.NIIBE Yutaka2019-02-212-0/+2
| | | | | | | * scd/apdu.h (SW_ACK_TIMEOUT): New. * scd/iso7816.c (map_sw): Return GPG_ERR_TIMEOUT for SW_ACK_TIMEOUT. Signed-off-by: NIIBE Yutaka <[email protected]>
* tests: Add "disable-scdaemon" in gpg-agent.conf.NIIBE Yutaka2019-02-215-10/+5
| | | | | | | | | | | | | | | | | * tests/openpgp/defs.scm: Add "disable-scdaemon". Remove "scdaemon-program". * tests/gpgme/gpgme-defs.scm, tests/gpgsm/gpgsm-defs.scm: Likewise. * tests/inittests, tests/pkits/inittests: Add "disable-scdaemon" -- Before this change, running "make check" accesses USB device by scdaemon on host computer. If there is any smartcard/token available, it may affect test results. Because default key choice depends on smartcard/token availability now and existing tests have nothing about testing smartcard/token, disabling scdaemon is good. Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Terminate pinentry process gracefully, by watching socket.NIIBE Yutaka2019-02-191-4/+81
| | | | | | | | | | | | | | * agent/call-pinentry.c (watch_sock): New. (do_getpin): Spawn the watching thread. -- While we don't have npth_cancel (and it's difficult to implement it correctly), this is a kind of best compromise allowing a thread's polling when pinentry is active. GnuPG-bug-id: 2011 Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Minor change for pinentry status handling.NIIBE Yutaka2019-02-191-11/+7
| | | | | | | | * agent/call-pinentry.c (struct entry_parm_s): Add status. (do_getpin): Use param->status. (agent_askpin): Copy param->status. to pininfo. Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Factor out the getpin interaction.NIIBE Yutaka2019-02-191-42/+37
| | | | | | | * agent/call-pinentry.c (do_getpin): New. (agent_askpin, agent_get_passphrase): Use do_getpin. Signed-off-by: NIIBE Yutaka <[email protected]>
* sm: Support generation of card-based ed25519 CSR.Damien Goutte-Gattat via Gnupg-devel2019-02-183-4/+19
| | | | | | | | | | | | | * sm/call-agent.c (gpgsm_scd_pksign): Allow SHA512. Create proper S-expression for EdDSA signature. * sm/certreqgen.c (create_request): Force use of SHA512 when using a ed25519 key. * sm/misc.c (transform_sigval): Insert OID for ed25519. -- GnuPG-bug-id: 4013 Signed-off-by: Damien Goutte-Gattat <[email protected]>
* sm: Support generation of card-based ECDSA CSR.Damien Goutte-Gattat via Gnupg-devel2019-02-152-34/+98
| | | | | | | | | | | | | | | | * sm/call-agent.c (gpgsm_scd_pksign): Identify type of signing key and format resulting S-expression accordingly. * sm/misc.c (transform_sigval): Support ECDSA signatures. -- Current GpgSM implementation assumes card-based keys are RSA keys. This patch introduces support for ECDSA keys. By itself this patch is not sufficient, we also need support from libksba. GnuPG-bug-id: 4092 Signed-off-by: Damien Goutte-Gattat <[email protected]>
* po: Correct a simple typo in the Norwegian translationIngvar Hagelund2019-02-141-1/+1
| | | | Signed-off-by: Ingvar Hagelund <[email protected]>
* card: New command "yubikey".Werner Koch2019-02-136-50/+580
| | | | | | | | | | | | | | | | | | | | * tools/card-tool-yubikey.c: New. * tools/Makefile.am (gpg_card_tool_SOURCES): Add it. * tools/card-call-scd.c (scd_apdu): Allow returning data. * tools/card-tool-misc.c (send_apdu): New. Move from gpg-card-tool.c and let it return data. Change all callers. * tools/gpg-card-tool.c (cmd_writecert): Prepend the certref with the current application type. (cmd_yubikey): New. -- This command allows listing of active applications and to enable or disable selected applications. This is in particular useful to disable the OpenPGP application so that the PIV support can easily be tested. Signed-off-by: Werner Koch <[email protected]>
* scd: Implement decryption for PIV cards.Werner Koch2019-02-111-1/+146
| | | | | | | | | | * scd/app-piv.c (do_decipher): New. -- Note that ECDH decryption has not been tested due to the lack of ECC support in gpgsm. Signed-off-by: Werner Koch <[email protected]>
* scd: For PIV cards used NO_AUTH instead of BAD_PIN.Werner Koch2019-02-112-2/+18
| | | | | | | | | * common/util.h (GPG_ERR_NO_AUTH, GPG_ERR_BAD_AUTH): Add replacement codes for gpgrt < 1.36. * scd/app-piv.c (auth_adm_key): (do_genkey, do_writecert): Use better error codes. Signed-off-by: Werner Koch <[email protected]>
* scd: Implement RSA signing for PIV cards.Werner Koch2019-02-081-99/+299
| | | | | | | | | * scd/app-piv.c (concat_tlv_list): New. (get_key_algorithm_by_dobj): Rename args for clarity. (do_auth): factor all code out to ... (do_sign): new. Implement RSA signing. Signed-off-by: Werner Koch <[email protected]>
* sm: In --gen-key with "key from card" show also the algorithm.Werner Koch2019-02-081-1/+21
| | | | | | | | | | | | | | | | | | | | | * sm/certreqgen-ui.c (gpgsm_gencertreq_tty): Get and show algo. -- This extends the prompt to show something like Serial number of the card: FF020001008A77F6 Available keys: (1) 4130F84FA3704F4645924AEC3FFA48AD26D33656 PIV.9A nistp384 (2) AB2988FB8C227BCD5175BF92F66AA3A95AE83214 PIV.9E rsa2048 (3) DB7DDAEAA88534BA45CCD7A9B761425103EA2090 PIV.9C rsa2048 (4) BABB48C3D80ACCF9839F101DF2910966C8B988DF PIV.9D nistp256 Your selection? 1 Having the algorithm here is helpful in particular because right now we support only RSA with X.509. Take care: PIV card based certificate creation does not yet work. Signed-off-by: Werner Koch <[email protected]>
* common: Provide function to get public key algo names in our format.Werner Koch2019-02-084-60/+59
| | | | | | | | | | | | | * tools/card-tool-misc.c (pubkey_algo_string): Move to ... * common/sexputil.c (pubkey_algo_string): here. -- The new gpg format for public key algorithms is useful at other places as well. Thus we make this new function available. Note that the code we use in gpg is not based on s-expressions and thus a new function was required. Signed-off-by: Werner Koch <[email protected]>
* card: Make "generate" work for PIV cards.Werner Koch2019-02-083-25/+141
| | | | | | | | | | | | | | | | | * tools/card-call-scd.c (scd_genkey_cb): Make createtime optional. (scd_genkey_cb): Ditto. Add arg algo. * tools/gpg-card-tool.c (cmd_generate): Add options and factor card specific code out to ... (generate_openpgp, generate_generic): new functions. -- This patch keeps the interactive OpenPGP mode but adds a pure command line mode for other cards; in particular PIV cards. What we still need to do is: a) Add an interactive mode for PIV cards b) Add a command line mode for OpenPGP cards. Signed-off-by: Werner Koch <[email protected]>
* scd: Allow generating ECC curves on PIV cards.Werner Koch2019-02-082-16/+79
| | | | | | | | | * scd/app-piv.c (genkey_parse_ecc): New. (get_keygrip_by_tag): Call that one. (do_readkey): Call that one. * scd/command.c (cmd_genkey): Add option --algo. Signed-off-by: Werner Koch <[email protected]>
* common: New functions get_option_value and ascii_strupr.Werner Koch2019-02-084-1/+71
| | | | | | | * common/server-help.c (get_option_value): New. * common/stringhelp.c (ascii_strupr): New. Signed-off-by: Werner Koch <[email protected]>
* card: Print the used algorithm of all keys.Werner Koch2019-02-074-0/+108
| | | | | | | | | | | | * tools/card-call-scd.c (scd_readkey): New. * tools/card-tool-misc.c (pubkey_algo_string): New. * tools/gpg-card-tool.c (list_one_kinfo): Print the algo. -- It is convenient to see the actual algorithm of keys even if no certificate has yet been created. Signed-off-by: Werner Koch <[email protected]>
* card: Fix a NULL-ptr deref in key listings.Werner Koch2019-02-072-5/+8
| | | | | | | * tools/card-tool-keys.c (get_matching_keys): Fix segv. * tools/gpg-card-tool.c (main): Init info. Signed-off-by: Werner Koch <[email protected]>
* scd: Store a new PIV public key in the certificate DO.Werner Koch2019-02-072-107/+181
| | | | | | | | | | | | | | | | | | | | | * scd/app-piv.c (struct genkey_result_s): Remove type and all users. (send_keypair_and_cert_info): Print certinfo only if we got a cert.. (readcert_by_tag): Add arg r_mechanism and implement reading of public keys. (get_keygrip_by_tag): Use a public key to compute the keygrip. (do_readcert): Make sure to only return a certificate. (do_readkey): Read public key from the DO if a certificate is missing. (get_key_algorithm_by_dobj): Get the algorithm also from a public key. (does_key_exist): String changes. (do_genkey): Remove result caching and store public key in the DO. -- This removes the result cache and instead stores the public key in the certificate object. This allows to properly list public keys at any time after generating a key and before a new certificate is stored there. Signed-off-by: Werner Koch <[email protected]>
* card: Support reading and writing PIV certificatesWerner Koch2019-02-072-40/+235
| | | | | | | | | | | | * scd/app-piv.c (add_tlv): New. (put_data): New. (do_writecert): New. (do_setattr): Remove usused special mode 0. * tools/gpg-card-tool.c (cmd_writecert): Allow other cards than OPENPGP. (cmd_readcert): Ditto. Signed-off-by: Werner Koch <[email protected]>