From c075274aac0ffd388df638548b75a7d90e7e929d Mon Sep 17 00:00:00 2001
From: Werner Koch <wk@gnupg.org>
Date: Wed, 6 Feb 2019 12:24:30 +0100
Subject: [PATCH] scd: Fix parameter name of app_change_key.

* scd/app-common.h (APP_GENKEY_FLAG_FORCE): New.
* scd/app.c (app_change_pin): Rename arg reset_mode to flags and
change from int to unsigned int.
--

This is basically a documentation fix.

Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit c26af8ac263ea006ed32e110a09271e4bfbf1f37)
---
 scd/app-common.h | 11 +++++++----
 scd/app.c        |  6 +++---
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/scd/app-common.h b/scd/app-common.h
index 37e3c605d..4e3f43223 100644
--- a/scd/app-common.h
+++ b/scd/app-common.h
@@ -25,11 +25,14 @@
 #include <npth.h>
 #include <ksba.h>
 
-
+/* Flags used with app_change_pin.  */
 #define APP_CHANGE_FLAG_RESET    1  /* PIN Reset mode.  */
 #define APP_CHANGE_FLAG_NULLPIN  2  /* NULL PIN mode.  */
 #define APP_CHANGE_FLAG_CLEAR    4  /* Clear the given PIN.  */
 
+/* Flags used with app_genkey.  */
+#define APP_GENKEY_FLAG_FORCE    1  /* Force overwriting existing key.  */
+
 /* Bit flags set by the decipher function into R_INFO.  */
 #define APP_DECIPHER_INFO_NOPAD  1  /* Padding has been removed.  */
 
@@ -181,9 +184,9 @@ gpg_error_t app_genkey (app_t app, ctrl_t ctrl,
 gpg_error_t app_get_challenge (app_t app, ctrl_t ctrl, size_t nbytes,
                                unsigned char *buffer);
 gpg_error_t app_change_pin (app_t app, ctrl_t ctrl,
-                    const char *chvnostr, int reset_mode,
-                    gpg_error_t (*pincb)(void*, const char *, char **),
-                    void *pincb_arg);
+                            const char *chvnostr, unsigned int flags,
+                            gpg_error_t (*pincb)(void*, const char *, char **),
+                            void *pincb_arg);
 gpg_error_t app_check_pin (app_t app, ctrl_t ctrl, const char *keyidstr,
                    gpg_error_t (*pincb)(void*, const char *, char **),
                    void *pincb_arg);
diff --git a/scd/app.c b/scd/app.c
index c43057946..6391c3b78 100644
--- a/scd/app.c
+++ b/scd/app.c
@@ -914,7 +914,8 @@ app_get_challenge (app_t app, ctrl_t ctrl, size_t nbytes, unsigned char *buffer)
 
 /* Perform a CHANGE REFERENCE DATA or RESET RETRY COUNTER operation.  */
 gpg_error_t
-app_change_pin (app_t app, ctrl_t ctrl, const char *chvnostr, int reset_mode,
+app_change_pin (app_t app, ctrl_t ctrl, const char *chvnostr,
+                unsigned int flags,
                 gpg_error_t (*pincb)(void*, const char *, char **),
                 void *pincb_arg)
 {
@@ -929,8 +930,7 @@ app_change_pin (app_t app, ctrl_t ctrl, const char *chvnostr, int reset_mode,
   err = lock_app (app, ctrl);
   if (err)
     return err;
-  err = app->fnc.change_pin (app, ctrl, chvnostr, reset_mode,
-                             pincb, pincb_arg);
+  err = app->fnc.change_pin (app, ctrl, chvnostr, flags, pincb, pincb_arg);
   unlock_app (app);
   if (opt.verbose)
     log_info ("operation change_pin result: %s\n", gpg_strerror (err));