add ykpiv_disconnect()
This commit is contained in:
+15
@@ -57,10 +57,25 @@ ykpiv_rc ykpiv_init(ykpiv_state **state, int verbose) {
|
||||
}
|
||||
|
||||
ykpiv_rc ykpiv_done(ykpiv_state *state) {
|
||||
ykpiv_disconnect(state);
|
||||
free(state);
|
||||
return YKPIV_OK;
|
||||
}
|
||||
|
||||
ykpiv_rc ykpiv_disconnect(ykpiv_state *state) {
|
||||
if(state->card) {
|
||||
SCardDisconnect(state->card, SCARD_RESET_CARD);
|
||||
state->card = 0;
|
||||
}
|
||||
|
||||
if(state->context) {
|
||||
SCardReleaseContext(state->context);
|
||||
state->context = 0;
|
||||
}
|
||||
|
||||
return YKPIV_OK;
|
||||
}
|
||||
|
||||
ykpiv_rc ykpiv_connect(ykpiv_state *state, const char *wanted) {
|
||||
unsigned long num_readers = 0;
|
||||
unsigned long active_protocol;
|
||||
|
||||
@@ -58,6 +58,7 @@ extern "C"
|
||||
ykpiv_rc ykpiv_init(ykpiv_state **state, int verbose);
|
||||
ykpiv_rc ykpiv_done(ykpiv_state *state);
|
||||
ykpiv_rc ykpiv_connect(ykpiv_state *state, const char *wanted);
|
||||
ykpiv_rc ykpiv_disconnect(ykpiv_state *state);
|
||||
ykpiv_rc ykpiv_transfer_data(ykpiv_state *state, const unsigned char *templ,
|
||||
const unsigned char *in_data, long in_len,
|
||||
unsigned char *out_data, unsigned long *out_len, int *sw);
|
||||
|
||||
@@ -33,6 +33,7 @@ global:
|
||||
ykpiv_init;
|
||||
ykpiv_done;
|
||||
ykpiv_connect;
|
||||
ykpiv_disconnect;
|
||||
ykpiv_send_data;
|
||||
ykpiv_transfer_data;
|
||||
ykpiv_authenticate;
|
||||
|
||||
Reference in New Issue
Block a user