Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fishsoupisgood/63657f99fb8a826861ec66ea7ceae97b to your computer and use it in GitHub Desktop.
Save fishsoupisgood/63657f99fb8a826861ec66ea7ceae97b to your computer and use it in GitHub Desktop.
--- libglobalplatform6-6.0.0.orig/src/globalplatform.c
+++ libglobalplatform6-6.0.0/src/globalplatform.c
@@ -1304,10 +1304,36 @@ OPGP_ERROR_STATUS GP211_get_secure_chann
TLV tlv1, tlv2, _73tlv;
OPGP_LOG_START(_T("GP211_get_secure_channel_protocol_details"));
+#if 0
status = GP211_get_data(cardContext, cardInfo, NULL, (PBYTE)GP211_GET_DATA_CARD_DATA, recvBuffer, &recvBufferLength);
if (OPGP_ERROR_CHECK(status)) {
goto end;
}
+#else
+ {
+ static unsigned char * protocol_details;
+ static size_t protocol_details_len;
+
+ if (protocol_details_len) {
+ recvBufferLength = protocol_details_len;
+ memcpy(recvBuffer, protocol_details, protocol_details_len);
+ } else {
+ status = GP211_get_data(cardContext, cardInfo, NULL, (PBYTE)GP211_GET_DATA_CARD_DATA, recvBuffer, &recvBufferLength);
+ if (OPGP_ERROR_CHECK(status)) {
+ goto end;
+ }
+
+ protocol_details = malloc(recvBufferLength);
+
+ if ( protocol_details) {
+ protocol_details_len = recvBufferLength;
+ memcpy(protocol_details, recvBuffer, protocol_details_len);
+ }
+ }
+
+ }
+#endif
+
// read outer tag, should be one 0x66
result = read_TLV(recvBuffer, recvBufferLength, &tlv1);
if (result == -1) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment