From 88f3d19479470db5d8a7d83c2b5a84fd10a6ddaa Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Tue, 6 Oct 2020 15:28:01 +0200 Subject: [PATCH] opensc: Expose iso7816_build_pin_apdu function to support different pin APDUs --- src/libopensc/iso7816.c | 2 +- src/libopensc/opensc.h | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/libopensc/iso7816.c b/src/libopensc/iso7816.c index b1a0e88f..d41613b2 100644 --- a/src/libopensc/iso7816.c +++ b/src/libopensc/iso7816.c @@ -1017,7 +1017,7 @@ iso7816_decipher(struct sc_card *card, } -static int +int iso7816_build_pin_apdu(struct sc_card *card, struct sc_apdu *apdu, struct sc_pin_cmd_data *data, u8 *buf, size_t buf_len) { diff --git a/src/libopensc/opensc.h b/src/libopensc/opensc.h index b519c5d5..8ebf9fbd 100644 --- a/src/libopensc/opensc.h +++ b/src/libopensc/opensc.h @@ -1664,6 +1664,19 @@ int iso7816_update_binary_sfid(sc_card_t *card, unsigned char sfid, * */ int iso7816_logout(sc_card_t *card, unsigned char pin_reference); +/* + * @brief Format PIN APDU for modifiction by card driver + * + * @param[in] card card + * @param[in] apdu apdu structure to update with PIN APDU + * @param[in] data pin command data to set into the APDU + * @param[in] buf buffer for APDU data field + * @param[in] buf_len maximum buffer length + */ +int +iso7816_build_pin_apdu(struct sc_card *card, struct sc_apdu *apdu, + struct sc_pin_cmd_data *data, u8 *buf, size_t buf_len); + /** * Free a buffer returned by OpenSC. * Use this instead your C libraries free() to free memory allocated by OpenSC.