mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-21 22:03:19 -07:00
fix includes for OS X. Add missing framework for OS X.
This commit is contained in:
parent
ec87092aa4
commit
f6ce5ecb08
2 changed files with 21 additions and 101 deletions
|
@ -46,8 +46,13 @@ ifneq (,$(findstring MINGW,$(platform)))
|
|||
PCSC_INCLUDES :=
|
||||
PCSC_LIBS = -lwinscard
|
||||
else
|
||||
PCSC_INCLUDES := $(shell pkg-config --cflags libpcsclite)
|
||||
PCSC_LIBS := $(shell pkg-config --libs libpcsclite)
|
||||
ifeq ($(platform),Darwin)
|
||||
PCSC_INCLUDES =
|
||||
PCSC_LIBS = -framework PCSC
|
||||
else
|
||||
PCSC_INCLUDES := $(shell pkg-config --cflags libpcsclite)
|
||||
PCSC_LIBS := $(shell pkg-config --libs libpcsclite)
|
||||
endif
|
||||
endif
|
||||
|
||||
LUAPLATFORM = generic
|
||||
|
|
113
client/pcsc.c
113
client/pcsc.c
|
@ -14,21 +14,24 @@
|
|||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined (__APPLE__)
|
||||
#include <PCSC/winscard.h>
|
||||
#include <PCSC/wintypes.h>
|
||||
#define SCARD_ATTR_VALUE(Class, Tag) ((((ULONG)(Class)) << 16) | ((ULONG)(Tag)))
|
||||
#define SCARD_CLASS_ICC_STATE 9
|
||||
#define SCARD_ATTR_ATR_STRING SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE, 0x0303)
|
||||
#elif defined (_WIN32)
|
||||
#include <winscard.h>
|
||||
#else
|
||||
#include <winscard.h>
|
||||
#include <reader.h>
|
||||
#endif
|
||||
|
||||
#include "ui.h"
|
||||
#include "util.h"
|
||||
#include "cmdhw.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <PCSC/winscard.h>
|
||||
#include <PCSC/wintypes.h>
|
||||
#else
|
||||
#include <winscard.h>
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#include "reader.h"
|
||||
#endif
|
||||
|
||||
static SCARDCONTEXT SC_Context;
|
||||
static SCARDHANDLE SC_Card;
|
||||
static DWORD SC_Protocol;
|
||||
|
@ -172,91 +175,3 @@ bool pcscGetATR(smart_card_atr_t *card)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
int main(void)
|
||||
{
|
||||
LONG rv;
|
||||
|
||||
SCARDCONTEXT SC_Context;
|
||||
LPTSTR mszReaders;
|
||||
SCARDHANDLE SC_Card;
|
||||
DWORD dwReaders, dwActiveProtocol, dwRecvLength;
|
||||
|
||||
SCARD_IO_REQUEST pioSendPci;
|
||||
BYTE pbRecvBuffer[258];
|
||||
BYTE cmd1[] = { 0x00, 0xA4, 0x04, 0x00, 0x0A, 0xA0,
|
||||
0x00, 0x00, 0x00, 0x62, 0x03, 0x01, 0x0C, 0x06, 0x01 };
|
||||
BYTE cmd2[] = { 0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
unsigned int i;
|
||||
|
||||
rv = SCardEstablisSC_Context(SCARD_SCOPE_SYSTEM, NULL, NULL, &SC_Context);
|
||||
CHECK("SCardEstablisSC_Context", rv)
|
||||
|
||||
#ifdef SCARD_AUTOALLOCATE
|
||||
dwReaders = SCARD_AUTOALLOCATE;
|
||||
|
||||
rv = SCardListReaders(SC_Context, NULL, (LPTSTR)&mszReaders, &dwReaders);
|
||||
CHECK("SCardListReaders", rv)
|
||||
#else
|
||||
CHECK("SCardListReaders", rv)
|
||||
|
||||
mszReaders = calloc(dwReaders, sizeof(char));
|
||||
rv = SCardListReaders(SC_Context, NULL, mszReaders, &dwReaders);
|
||||
CHECK("SCardListReaders", rv)
|
||||
#endif
|
||||
printf("reader name: %s\n", mszReaders);
|
||||
|
||||
rv = SCardConnect(SC_Context, mszReaders, SCARD_SHARE_SHARED,
|
||||
SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1, &SC_Card, &dwActiveProtocol);
|
||||
CHECK("SCardConnect", rv)
|
||||
|
||||
switch(dwActiveProtocol)
|
||||
{
|
||||
case SCARD_PROTOCOL_T0:
|
||||
pioSendPci = *SCARD_PCI_T0;
|
||||
break;
|
||||
|
||||
case SCARD_PROTOCOL_T1:
|
||||
pioSendPci = *SCARD_PCI_T1;
|
||||
break;
|
||||
}
|
||||
dwRecvLength = sizeof(pbRecvBuffer);
|
||||
rv = SCardTransmit(SC_Card, &pioSendPci, cmd1, sizeof(cmd1),
|
||||
NULL, pbRecvBuffer, &dwRecvLength);
|
||||
CHECK("SCardTransmit", rv)
|
||||
|
||||
printf("response: ");
|
||||
for(i=0; i<dwRecvLength; i++)
|
||||
printf("%02X ", pbRecvBuffer[i]);
|
||||
printf("\n");
|
||||
|
||||
dwRecvLength = sizeof(pbRecvBuffer);
|
||||
rv = SCardTransmit(SC_Card, &pioSendPci, cmd2, sizeof(cmd2),
|
||||
NULL, pbRecvBuffer, &dwRecvLength);
|
||||
CHECK("SCardTransmit", rv)
|
||||
|
||||
printf("response: ");
|
||||
for(i=0; i<dwRecvLength; i++)
|
||||
printf("%02X ", pbRecvBuffer[i]);
|
||||
printf("\n");
|
||||
|
||||
rv = SCardDisconnect(SC_Card, SCARD_LEAVE_CARD);
|
||||
CHECK("SCardDisconnect", rv)
|
||||
|
||||
#ifdef SCARD_AUTOALLOCATE
|
||||
rv = SCardFreeMemory(SC_Context, mszReaders);
|
||||
CHECK("SCardFreeMemory", rv)
|
||||
|
||||
#else
|
||||
free(mszReaders);
|
||||
#endif
|
||||
|
||||
rv = SCardReleaseContext(SC_Context);
|
||||
|
||||
CHECK("SCardReleaseContext", rv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue