const char [OTP_MAX_CSD_LEN + 1], time_t,
char [OTP_MAX_CHALLENGE_LEN + 1],
unsigned, unsigned, const char *);
-static int cryptocard_response(otp_user_info_t *, char *, const char *,
+static int cryptocard_response(otp_user_info_t *,
+ const char [OTP_MAX_CSD_LEN + 1],
+ const char [OTP_MAX_CHALLENGE_LEN + 1],
char [OTP_MAX_RESPONSE_LEN + 1],
const char *);
static int cryptocard_updatecsd(const otp_user_info_t *, otp_user_state_t *,
int e = 0, t = 0; /* must initialize for async auth path */
int fc; /* failcondition */
- char csd[OTP_MAX_CSD_LEN + 1]; /* working copy of csd */
/* expected response */
char e_response[OTP_MAX_RESPONSE_LEN + OTP_MAX_PIN_LEN + 1];
int pin_offset = 0; /* pin offset in e_response */
fc = OTP_FC_FAIL_NONE;
}
- /* copy csd */
- (void) strcpy(csd, user_state.csd);
-
async_response:
/*
* Test async response.
}
/* Calculate the async response. */
- if (user_info.cardops->response(&user_info, csd, challenge,
+ if (user_info.cardops->response(&user_info, user_state.csd, challenge,
&e_response[pin_offset],
log_prefix) != 0) {
otp_log(OTP_LOG_ERR, "%s: unable to calculate async response for [%s], "
(void) strcpy(challenge, user_state.challenge);
/* Test each sync response in the window. */
- tend = user_info.cardops->maxtwin(&user_info, csd, now);
+ tend = user_info.cardops->maxtwin(&user_info, user_state.csd, now);
for (t = 0; t <= tend; ++t) {
/*
* Get the authtime, which is like the current time ('now') but moves
* is successful, thus allowing the isearly() test (just below) to
* work.
*/
- authtime = user_info.cardops->twin2authtime(csd, now, t, log_prefix);
+ authtime = user_info.cardops->twin2authtime(user_state.csd, now, t,
+ log_prefix);
for (e = 0; e <= end; ++e) {
/*
* For event synchronous modes, we can never go backwards (the
continue;
/* Get next challenge. */
- if (user_info.cardops->challenge(&user_info, csd, now, challenge,
- t, e, log_prefix) != 0) {
+ if (user_info.cardops->challenge(&user_info, user_state.csd, now,
+ challenge, t, e, log_prefix) != 0) {
otp_log(OTP_LOG_ERR,
"%s: unable to get sync challenge t:%d e:%d for [%s]",
log_prefix, t, e, username);
/* NB: state not updated. */
}
/* Calculate sync response. */
- if (user_info.cardops->response(&user_info, csd, challenge,
+ if (user_info.cardops->response(&user_info, user_state.csd, challenge,
&e_response[pin_offset],
log_prefix) != 0) {
otp_log(OTP_LOG_ERR,
/* force resync; this only has an effect if (rc == OTP_RC_OK) */
resync = 1;
/* update csd on successful auth or rwindow candidate */
- (void) strcpy(user_state.csd, csd);
if (user_info.cardops->updatecsd(&user_info, &user_state, challenge,
t, now, rc, log_prefix) != 0) {
otp_log(OTP_LOG_ERR, "%s: unable to update csd for [%s]",
int (*challenge)(const otp_user_info_t *, const char [OTP_MAX_CSD_LEN + 1],
time_t, char [OTP_MAX_CHALLENGE_LEN + 1], unsigned,
unsigned, const char *);
- int (*response)(otp_user_info_t *, char *, const char *,
+ int (*response)(otp_user_info_t *, const char [OTP_MAX_CSD_LEN + 1],
+ const char [OTP_MAX_CHALLENGE_LEN + 1],
char [OTP_MAX_RESPONSE_LEN + 1], const char *);
int (*updatecsd)(const otp_user_info_t *, otp_user_state_t *,
const char [OTP_MAX_CHALLENGE_LEN + 1],