aboutsummaryrefslogtreecommitdiffstats
path: root/g10/card-util.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2022-11-28gpg: Fix double-free in gpg --card-edit.NIIBE Yutaka1-1/+0
* g10/card-util.c (change_name): Don't free ISONAME here. -- Signed-off-by: NIIBE Yutaka <[email protected]>
2022-08-16gpg: Fix --card-status to handle lowercase APPTYPEsWerner Koch1-6/+6
* g10/card-util.c (current_card_status): Use ascii_strcasecmp.
2022-01-18gpg: Print Yubikey version correctly.Werner Koch1-2/+30
* g10/call-agent.c (learn_status_cb): Parse APPVERSION. * g10/call-agent.h (struct agent_card_info_s): Add field appversion. * g10/card-util.c (print_a_version): New. (current_card_status): Print version from appversion. -- This is a regression due to the PIV support. Note that the newer gpg-card worked correctly. GnuPG-bug-id: 5787
2021-08-19gpg: Return SUCCESS/FAILURE status also for --card-edit/name.Werner Koch1-3/+8
* g10/card-util.c (change_name): Call write_sc_op_status. -- Reported-by: Joey Berkovitz
2021-05-20g10: Fix memory leaksJakub Jelen1-2/+10
* g10/card-util.c (change_pin): free answer on errors (ask_card_keyattr): free answer on error * g10/cpr.c (do_get_from_fd): free string * g10/gpg.c (check_permissions): free dir on weird error * g10/import.c (append_new_uid): release knode * g10/keyedit.c (menu_set_keyserver_url): free answer (menu_set_keyserver_url): free user * g10/keygen.c (print_status_key_not_created): move allocation after sanity check (ask_expire_interval): free answer (card_store_key_with_backup): goto leave instaed of return * g10/keyserver.c (parse_keyserver_uri): goto fail instead of return * g10/revoke.c (gen_desig_revoke): release kdbhd (gen_desig_revoke): free answer * g10/tofu.c (ask_about_binding): free sqerr and response * g10/trustdb.c (ask_ownertrust): free pk -- Signed-off-by: Jakub Jelen <[email protected]> Further changes: * g10/card-util.c (change_pin): Do not set answer to NULL. * g10/keyedit.c(menu_set_keyserver_url): Use !func() pattern. Signed-off-by: Werner Koch <[email protected]> GnuPG-bug-id: 5393
2020-11-20gpg: Change API of agent_scd_serialno.NIIBE Yutaka1-12/+3
* g10/call-agent.c (agent_scd_serialno): Extend API to allow with R_SERIALNO == NULL. * g10/card-util.c (card_status): Use NULL for agent_scd_serialno. (factory_reset): Likewise. * g10/skclist.c (build_sk_list): Likewise. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-11-19gpg: Fix --card-edit command.NIIBE Yutaka1-1/+2
* g10/card-util.c (get_info_for_key_operation): Revert the change. -- Fixes-commit: 157f1de64e437cecd75335e9f4077ba9835e3da0 Signed-off-by: NIIBE Yutaka <[email protected]>
2020-11-09card: Run factory-reset in locked stated.Werner Koch1-5/+19
* scd/command.c (reset_notify): Add option --keep-lock. (do_reset): Add arg keep_lock. (cmd_lock): Send progress status. * g10/call-agent.c (agent_scd_apdu): Add more pseudo APDUs. * g10/card-util.c (send_apdu): Ditto. (factory_reset): Use lock commands. -- This is required so that for example Kleopatra does not detect the RESET and issues a SERIALNO of its own, thus conflicting with our SERIALNO undefined. Signed-off-by: Werner Koch <[email protected]>
2020-10-26g10: Make call to agent_scd_serialno more robust.Werner Koch1-5/+5
* g10/call-agent.c (agent_scd_serialno): Make sure that NULL is stored on error at r_serialno. * g10/card-util.c (card_status): Simplify freeing of seriaono. (factory_reset): Ditto. -- This pattern is what we use with other functions returning an allocated string and thus less surprising.
2020-10-26gpg: Fix double free on error.NIIBE Yutaka1-1/+2
* g10/card-util.c (card_status): Check an error return. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-10-26gpg,tools: Fix detecting OpenPGP card by serialno.NIIBE Yutaka1-4/+5
* tools/gpg-card.c (list_openpgp): Use ->apptype to determine card's APP. * g10/card-util.c (get_info_for_key_operation): Likewise. (current_card_status): Even if its SERIALNO is not like OpenPGP card, it's OpenPGP card when app says so. -- GnuPG-bug-id: 5100 Signed-off-by: NIIBE Yutaka <[email protected]>
2020-09-16gpg,scd: Fix handling of KDF feature.NIIBE Yutaka1-2/+2
* g10/card-util.c (kdf_setup): Fix the default value. * scd/app-openpgp.c (do_setattr): Support kdf-setup "off" by Zeitcontrol. Make sure Gnuk and Yubikey work well. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-04-03gpg,card: Use the new MANUFACTURER attribute.Werner Koch1-43/+6
* tools/gpg-card.h (struct card_info_s): Add manufacturer fields. * tools/card-call-scd.c (release_card_info): Release them. (learn_status_cb): Parse MANUFACTURER attribute. * tools/gpg-card.c (get_manufacturer): Remove. (list_card): Use the new attribute. * g10/call-agent.h (struct agent_card_info_s): Add manufacturer fields. * g10/call-agent.c (agent_release_card_info): Release them. (learn_status_cb): Parse MANUFACTURER attribute. * g10/card-util.c (get_manufacturer): Remove. (current_card_status): Use new attribute. -- This does away with the duplicated OpenPGP vendor tables; they are now at a better place (app-openpgp.c). Signed-off-by: Werner Koch <[email protected]>
2020-03-03card: Add yet another vendor.Werner Koch1-0/+1
--
2020-03-03card: Add new vendor.Werner Koch1-0/+1
--
2020-02-11common: Extend the openpgp_curve_to_oid function.Werner Koch1-2/+3
* common/openpgp-oid.c (openpgp_curve_to_oid): Add optional arg R_NBITS. Change all callers. -- In particular for ed25519 and cv25519 it is quite useful to have an ability to get the required algorithm.
2020-01-28card: Add new OpenPGP card vendor.Werner Koch1-0/+1
-- Signed-off-by: Werner Koch <[email protected]>
2020-01-21card: Add new OpenPGP card vendorWerner Koch1-0/+1
--
2019-08-22gpg: Use modern spelling for the female salutation.Werner Koch1-2/+2
-- GnuPG-bug-id: 4682 Signed-off-by: Werner Koch <[email protected]>
2019-07-19card: Fix showing KDF object attribute.NIIBE Yutaka1-3/+20
* g10/call-agent.c (learn_status_cb): Parse the KDF DO. * g10/card-util.c (current_card_status): Show it correctly. Signed-off-by: NIIBE Yutaka <[email protected]>
2019-07-19card: Support disabling KDF functionality.NIIBE Yutaka1-7/+21
* g10/card-util.c (kdf_setup): Can be "off". Signed-off-by: NIIBE Yutaka <[email protected]>
2019-05-21gpg: Unify the the use of the print_pubkey_info functions.Werner Koch1-3/+2
* g10/keylist.c (format_seckey_info): Remove. (print_pubkey_info, print_seckey_info): Remove. (format_key_info): New. (print_key_info): New. (print_key_info_log): New. * g10/card-util.c (current_card_status): Use print_key_info and remove the useless condition on KEYBLOCK. * g10/delkey.c (do_delete_key): Replace print_pubkey_info and print_seckey_info by print_key_info. * g10/keyedit.c (menu_addrevoker): Replace print_pubkey_info by print_key_info. * g10/pkclist.c (do_we_trust_pre): Ditto. * g10/revoke.c (gen_desig_revoke): Ditto. (gen_revoke): Ditto. Also use print_key_info_log instead of separate functions. Signed-off-by: Werner Koch <[email protected]>
2019-04-01gpg: Prepare card code to allow other than OpenPGP cards.Werner Koch1-15/+29
* g10/call-agent.c (start_agent): Use card app auto selection. * g10/card-util.c (current_card_status): Print the Application type. (card_status): Put empty line between card listings. Signed-off-by: Werner Koch <[email protected]>
2019-04-01gpg: Remove two unused card related functions.Werner Koch1-4/+0
* g10/call-agent.c (inq_writekey_parms): Remove. (agent_scd_writekey): Remove. (agent_clear_pin_cache): Remove this stub.
2019-04-01gpg: Remove unused arg in a card related function.Werner Koch1-14/+13
* g10/call-agent.c (agent_scd_setattr): Remove unused arg serialno. Signed-off-by: Werner Koch <[email protected]>
2019-01-26gpg: Move S2K encoding function to a shared file.Werner Koch1-1/+1
* g10/passphrase.c (encode_s2k_iterations): Move function to ... * common/openpgp-s2k.c: new file. Remove default intialization code. * common/openpgpdefs.h (S2K_DECODE_COUNT): New to keep only one copy. * g10/call-agent.c (agent_get_s2k_count): Change to return the count and print an error. * agent/protect.c: Include openpgpdefs.h * g10/card-util.c (gen_kdf_data): Adjust for changes * g10/gpgcompose.c: Include call-agent.h. (sk_esk): Adjust for changes. * g10/passphrase (passphrase_to_dek): Adjust for changes. * g10/main.h (S2K_DECODE_COUNT): Remove macro. Signed-off-by: Werner Koch <[email protected]>
2018-11-15card: Display UIF setting.NIIBE Yutaka1-0/+11
* g10/call-agent.h (agent_card_info_s): Add UIF fields. * g10/call-agent.c (learn_status_cb): Put UIF DOs info. * g10/card-util.c (current_card_status): Output for UIF. Signed-off-by: NIIBE Yutaka <[email protected]>
2018-11-15scd: Make "learn" report about KDF data object.NIIBE Yutaka1-0/+4
* scd/app-openpgp.c (do_learn_status): Report KDF attr. * g10/card-util.c (current_card_status): Output KDF for with_colons. Signed-off-by: NIIBE Yutaka <[email protected]>
2018-11-15card: Display if KDF is enabled or not.NIIBE Yutaka1-0/+5
* g10/call-agent.h (kdf_do_enabled): New field. * g10/call-agent.c (learn_status_cb): Set kdf_do_enabled if available. * g10/card-util.c (current_card_status): Inform the availability. Signed-off-by: NIIBE Yutaka <[email protected]>
2018-11-06g10: Fix print_keygrip for smartcard.NIIBE Yutaka1-1/+1
* g10/card-util.c (print_keygrip): Use tty_fprintf. -- Reported-by: Joey Pabalinas <[email protected]> Signed-off-by: NIIBE Yutaka <[email protected]>
2018-10-25g10,scd: Improve UIF support.NIIBE Yutaka1-0/+21
* g10/call-agent.c (learn_status_cb): Parse "bt" flag. * g10/call-agent.h: New member field "bt". * g10/card-util.c (uif): Limit its access only when it is supported. * scd/app-openpgp.c (do_setattr): Allow access to UIF objects only when there is a button. Signed-off-by: NIIBE Yutaka <[email protected]>
2018-10-24all: fix spelling and typosDaniel Kahn Gillmor1-1/+1
Signed-off-by: Daniel Kahn Gillmor <[email protected]>
2018-10-04gpg: Add new card vendorWerner Koch1-0/+1
--
2018-09-27g10,scd: Support UIF changing command.NIIBE Yutaka1-2/+33
* g10/card-util.c (uif, cmdUIF): New. (card_edit): Add call to uif by cmdUIF. * scd/app-openpgp.c (do_getattr): Support UIF-1, UIF-2, and UIF-3. (do_setattr): Likewise. (do_learn_status): Learn UIF-1, UIF-2, and UIF-3. -- GnuPG-bug-id: 4158 Signed-off-by: NIIBE Yutaka <[email protected]>
2018-09-18g10: Fix memory leak for --card-status.NIIBE Yutaka1-4/+3
* g10/card-util.c (card_status): Release memory of serial number. Signed-off-by: NIIBE Yutaka <[email protected]>
2018-08-27gpg: Prepare for longer card fingerprints.Werner Koch1-47/+56
* g10/call-agent.h (agent_card_info_s): Rename the "*valid" fields to "*len". * g10/call-agent.c (unhexify_fpr): Change to take a FPRLEN and to return the actual length. (agent_release_card_info): Adjust for these changes. * g10/card-util.c (print_sha1_fpr): Rename to print_shax_fpr and add arg FPRLEN. Change all callers to pass the length. (print_sha1_fpr_colon): Rename to print_shax_fpr_colon and add arg FPRLEN. Change all callers to pass the length. (fpr_is_zero): Add arg FPRLEN. (fpr_is_ff): Ditto. (show_card_key_info): Use the new functions. * g10/skclist.c (enum_secret_keys): Use MAX_FINGERPRINT_LEN. -- This is not needed right now but we should get rid of all hard coded fingerprint lengths. Thus this change. Signed-off-by: Werner Koch <[email protected]>
2018-06-12card: Fix memory leak for fetch-url sub command.NIIBE Yutaka1-0/+1
* g10/card-util.c (fetch_url): Release INFO. Signed-off-by: NIIBE Yutaka <[email protected]>
2018-04-25g10: Fix printing the keygrip with --card-status.NIIBE Yutaka1-1/+1
* g10/card-util.c (current_card_status): Keygrip for Auth is 3. -- Fixes-commit: fd595c9d3642dba437fbe0f6e25d7aaaae095f94 Signed-off-by: NIIBE Yutaka <[email protected]>
2018-04-05gpg: Add new OpenPGP card vendor.Werner Koch1-0/+1
-- Signed-off-by: Werner Koch <[email protected]>
2018-04-05g10: Let card-edit/key-attr show message when change.NIIBE Yutaka1-8/+14
* g10/card-util.c (ask_card_rsa_keysize): Don't show message here. (ask_card_keyattr): Show message when change, also for ECC. Signed-off-by: NIIBE Yutaka <[email protected]>
2018-03-30g10: Fix card-edit/kdf-setup for single salt.NIIBE Yutaka1-1/+3
* g10/card-util.c (gen_kdf_data): Use SALT_USER. Signed-off-by: NIIBE Yutaka <[email protected]>
2018-03-30g10,scd: Support single salt for KDF data object.NIIBE Yutaka1-16/+32
* g10/card-util.c (gen_kdf_data): Support single salt. (kdf_setup): Can have argument for single salt. * scd/app-openpgp.c (pin2hash_if_kdf): Support single salt. -- Gnuk has "admin-less" mode. To support "admin-less" mode with KDF feature, salt should be same for user and admin. Thus, I introduce a valid use of single salt. Signed-off-by: NIIBE Yutaka <[email protected]>
2018-03-30g10: Add "key-attr" command for --card-edit.NIIBE Yutaka1-53/+52
* g10/card-util.c (key_attr): New explicit command. (generate_card_keys, card_generate_subkey): Don't ask key attr change. (card_edit): Add for cmdKEYATTR. -- GnuPG-bug-id: 3781 Signed-off-by: NIIBE Yutaka <[email protected]>
2018-03-29g10: Support key attribute change at --card-edit/generate.NIIBE Yutaka1-71/+157
* g10/card-util.c (ask_card_rsa_keysize): Drop support for magic number 25519 for ed25519/cv25519. Rename from ask_card_keyattr. (ask_card_keyattr): Support ECC, as well as RSA. (do_change_keyattr): Support ECC dropping magical number 25519. * g10/keygen.c (ask_curve): Allow call from outside, adding last arg of CURRENT. (generate_keypair): Follow the change of ask_curve. (generate_subkeypair): Likewise. -- GnuPG-bug-id: 3781 Signed-off-by: NIIBE Yutaka <[email protected]>
2018-03-29g10: check_pin_for_key_operation should be just before genkey.NIIBE Yutaka1-7/+7
* g10/card-util.c (generate_card_keys): Check PIN later. (card_generate_subkey): Likewise. -- Changing key attribute resets PIN authentication status. So, CHECKPIN should be after that, before key generation. Note that CHECKPIN is done for binding signature. Signed-off-by: NIIBE Yutaka <[email protected]>
2018-03-22scd: Support KDF DO setup.NIIBE Yutaka1-1/+104
* g10/call-agent.c (learn_status_cb): Parse the capability for KDF. * g10/card-util.c (gen_kdf_data, kdf_setup): New. (card_edit): New admin command cmdKDFSETUP to call kdf_setup. * scd/app-openpgp.c (do_getattr): Emit KDF capability. -- GnuPG-bug-id: 3823 Signed-off-by: NIIBE Yutaka <[email protected]>
2018-03-16scd: Better user interaction for factory-reset.NIIBE Yutaka1-6/+21
* g10/card-util.c (factory_reset): Dummy PIN size is now 32-byte. Connect the card again at the last step. -- Before the change, a user has to quit the session to continue. Now, it is possible to type RET in the session and see if it's really done. Signed-off-by: NIIBE Yutaka <[email protected]>
2018-03-01gpg: Print the keygrip with --card-statusWerner Koch1-6/+35
* g10/call-agent.h (agent_card_info_s): Add fields grp1, grp2 and grp3. * g10/call-agent.c (unhexify_fpr): Allow for space as delimiter. (learn_status_cb): Parse KEYPARIINFO int the grpX fields. * g10/card-util.c (print_keygrip): New. (current_card_status): Print "grp:" records or with --with-keygrip a human readable keygrip. -- Suggested-by: Peter Lebbing <[email protected]> Signed-off-by: Werner Koch <[email protected]>
2018-02-01gpg: Update list of card vendors from masterWerner Koch1-0/+2
-- Signed-off-by: Werner Koch <[email protected]>
2018-02-01Add a new OpenPGP card vendor.Werner Koch1-0/+1
--