|
| 1 | +From 744f2647b999d0c96243acdffd95f1b7b6c6dfa0 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Sreenivasulu Malavathula <v-smalavathu@microsoft.com> |
| 3 | +Date: Sun, 23 Feb 2025 19:17:33 -0600 |
| 4 | +Subject: [PATCH] Address CVE-2023-40660 |
| 5 | + |
| 6 | +--- |
| 7 | + src/libopensc/card-authentic.c | 11 +++++++++++ |
| 8 | + src/libopensc/pkcs15-pin.c | 13 ------------- |
| 9 | + 2 files changed, 11 insertions(+), 13 deletions(-) |
| 10 | + |
| 11 | +diff --git a/src/libopensc/card-authentic.c b/src/libopensc/card-authentic.c |
| 12 | +index 563210d..344c09c 100644 |
| 13 | +--- a/src/libopensc/card-authentic.c |
| 14 | ++++ b/src/libopensc/card-authentic.c |
| 15 | +@@ -2311,6 +2311,17 @@ authentic_sm_get_wrapped_apdu(struct sc_card *card, struct sc_apdu *plain, struc |
| 16 | + } |
| 17 | + #endif |
| 18 | + |
| 19 | ++int authentic_logout(sc_card_t *card) |
| 20 | ++{ |
| 21 | ++ int r = SC_ERROR_NOT_SUPPORTED; |
| 22 | ++ |
| 23 | ++ if (card->type == SC_CARD_TYPE_OBERTHUR_AUTHENTIC_3_2) { |
| 24 | ++ r = authentic_select_aid(card, aid_AuthentIC_3_2, sizeof(aid_AuthentIC_3_2), NULL, NULL); |
| 25 | ++ } |
| 26 | ++ |
| 27 | ++ return r; |
| 28 | ++} |
| 29 | ++ |
| 30 | + static struct sc_card_driver * |
| 31 | + sc_get_driver(void) |
| 32 | + { |
| 33 | +diff --git a/src/libopensc/pkcs15-pin.c b/src/libopensc/pkcs15-pin.c |
| 34 | +index 48e16fd..2402675 100644 |
| 35 | +--- a/src/libopensc/pkcs15-pin.c |
| 36 | ++++ b/src/libopensc/pkcs15-pin.c |
| 37 | +@@ -307,19 +307,6 @@ sc_pkcs15_verify_pin(struct sc_pkcs15_card *p15card, struct sc_pkcs15_object *pi |
| 38 | + LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_PIN_REFERENCE); |
| 39 | + auth_info = (struct sc_pkcs15_auth_info *)pin_obj->data; |
| 40 | + |
| 41 | +- /* |
| 42 | +- * if pin cache is disabled, we can get here with no PIN data. |
| 43 | +- * in this case, to avoid error or unnecessary pin prompting on pinpad, |
| 44 | +- * check if the PIN has been already verified and the access condition |
| 45 | +- * is still open on card. |
| 46 | +- */ |
| 47 | +- if (pinlen == 0) { |
| 48 | +- r = sc_pkcs15_get_pin_info(p15card, pin_obj); |
| 49 | +- |
| 50 | +- if (r == SC_SUCCESS && auth_info->logged_in == SC_PIN_STATE_LOGGED_IN) |
| 51 | +- LOG_FUNC_RETURN(ctx, r); |
| 52 | +- } |
| 53 | +- |
| 54 | + r = _validate_pin(p15card, auth_info, pinlen); |
| 55 | + |
| 56 | + if (r) |
| 57 | +-- |
| 58 | +2.45.2 |
| 59 | + |
0 commit comments