diff options
Diffstat (limited to 'scd/app-nks.c')
-rw-r--r-- | scd/app-nks.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/scd/app-nks.c b/scd/app-nks.c index 58a5349..1f59321 100644 --- a/scd/app-nks.c +++ b/scd/app-nks.c @@ -53,7 +53,6 @@ #include "scdaemon.h" #include "../common/i18n.h" #include "iso7816.h" -#include "app-common.h" #include "../common/tlv.h" #include "apdu.h" #include "../common/host2net.h" @@ -207,7 +206,7 @@ keygripstr_from_pk_file (app_t app, int fid, char *r_gripstr) newlen = 1 + buflen[i] - offset[i]; newbuf = xtrymalloc (newlen); - if (!newlen) + if (!newbuf) { xfree (buffer[0]); xfree (buffer[1]); @@ -609,7 +608,7 @@ do_readcert (app_t app, const char *certid, certificate parsing code in commands.c:cmd_readkey. For internal use PK and PKLEN may be NULL to just check for an existing key. */ static gpg_error_t -do_readkey (app_t app, int advanced, const char *keyid, +do_readkey (app_t app, ctrl_t ctrl, const char *keyid, unsigned int flags, unsigned char **pk, size_t *pklen) { gpg_error_t err; @@ -617,7 +616,9 @@ do_readkey (app_t app, int advanced, const char *keyid, size_t buflen[2]; unsigned short path[1] = { 0x4500 }; - if (advanced) + (void)ctrl; + + if ((flags & APP_READKEY_FLAG_ADVANCED)) return GPG_ERR_NOT_SUPPORTED; /* We use a generic name to retrieve PK.AUT.IFD-SPK. */ @@ -627,7 +628,7 @@ do_readkey (app_t app, int advanced, const char *keyid, return gpg_error (GPG_ERR_UNSUPPORTED_OPERATION); /* Access the KEYD file which is always in the master directory. */ - err = iso7816_select_path (app->slot, path, DIM (path)); + err = iso7816_select_path (app_get_slot (app), path, DIM (path), 0); if (err) return err; /* Due to the above select we need to re-select our application. */ @@ -684,7 +685,6 @@ do_writekey (app_t app, ctrl_t ctrl, size_t rsa_n_len, rsa_e_len; unsigned int nbits; - (void)ctrl; (void)pincb; (void)pincb_arg; @@ -693,7 +693,7 @@ do_writekey (app_t app, ctrl_t ctrl, else return gpg_error (GPG_ERR_INV_ID); - if (!force && !do_readkey (app, 0, keyid, NULL, NULL)) + if (!force && !do_readkey (app, ctrl, keyid, 0, NULL, NULL)) return gpg_error (GPG_ERR_EEXIST); /* Parse the S-expression. */ @@ -842,7 +842,7 @@ verify_pin (app_t app, int pwid, const char *desc, that callback should return the PIN in an allocated buffer and store that in the 3rd argument. */ static gpg_error_t -do_sign (app_t app, const char *keyidstr, int hashalgo, +do_sign (app_t app, ctrl_t ctrl, const char *keyidstr, int hashalgo, gpg_error_t (*pincb)(void*, const char *, char **), void *pincb_arg, const void *indata, size_t indatalen, @@ -862,6 +862,8 @@ do_sign (app_t app, const char *keyidstr, int hashalgo, + the largest OID prefix. */ size_t datalen; + (void)ctrl; + if (!keyidstr || !*keyidstr) return gpg_error (GPG_ERR_INV_VALUE); switch (indatalen) @@ -977,7 +979,7 @@ do_sign (app_t app, const char *keyidstr, int hashalgo, If a PIN is required the PINCB will be used to ask for the PIN; it should return the PIN in an allocated buffer and put it into PIN. */ static gpg_error_t -do_decipher (app_t app, const char *keyidstr, +do_decipher (app_t app, ctrl_t ctrl, const char *keyidstr, gpg_error_t (*pincb)(void*, const char *, char **), void *pincb_arg, const void *indata, size_t indatalen, @@ -989,6 +991,7 @@ do_decipher (app_t app, const char *keyidstr, int fid; int kid; + (void)ctrl; (void)r_info; if (!keyidstr || !*keyidstr || !indatalen) @@ -1264,7 +1267,7 @@ do_change_pin (app_t app, ctrl_t ctrl, const char *pwidstr, /* Perform a simple verify operation. KEYIDSTR should be NULL or empty. */ static gpg_error_t -do_check_pin (app_t app, const char *pwidstr, +do_check_pin (app_t app, ctrl_t ctrl, const char *pwidstr, gpg_error_t (*pincb)(void*, const char *, char **), void *pincb_arg) { @@ -1273,6 +1276,8 @@ do_check_pin (app_t app, const char *pwidstr, int is_sigg; const char *desc; + (void)ctrl; + desc = parse_pwidstr (pwidstr, 0, &is_sigg, &pwid); if (!desc) return gpg_error (GPG_ERR_INV_ID); @@ -1388,7 +1393,7 @@ app_select_nks (app_t app) rc = iso7816_select_application (slot, aid_nks, sizeof aid_nks, 0); if (!rc) { - app->apptype = "NKS"; + app->apptype = APPTYPE_NKS; app->app_local = xtrycalloc (1, sizeof *app->app_local); if (!app->app_local) |