Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pcsc #71

Open
wants to merge 89 commits into
base: master
Choose a base branch
from
Open

Pcsc #71

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
14c605a
added necessary PCSC structures into the structure mifare_tag
simonibus Sep 10, 2013
70cecc1
pcsclite.h must be included to get it done
simonibus Sep 10, 2013
d7257c2
added freefare_get_tags_pcsc function and a freefare_tag_new_pcsc pro…
simonibus Sep 10, 2013
72f17d0
just some small indention
simonibus Sep 10, 2013
47728bf
saving the last pcsc error in the MifareTag Structure and extending t…
simonibus Sep 10, 2013
bdac6e1
freefare_tag_new wont work
Sep 10, 2013
d2ae6f6
pcscp init, exit , list_devices
aircrach Sep 10, 2013
5e0e2b5
fix init
aircrach Sep 10, 2013
7977657
deleted redundant includes
simonibus Sep 10, 2013
9a1940f
function mifare_desfire_disconnect ready for nfc & pcsc
simonibus Sep 10, 2013
ee82f3e
DESFIRE_TRANSCEIVE
aircrach Sep 10, 2013
d87038f
mifare_tag structure got the strReader attrib, to have all needed inf…
simonibus Sep 10, 2013
f4a3e5f
mifare_desfire_connect ready for nfc & pcsc
simonibus Sep 10, 2013
6e813f6
fix parameters get tags pcsc
aircrach Sep 10, 2013
26e33fe
just some spelling fix
simonibus Sep 10, 2013
c540595
hardcoded desfire...
Sep 10, 2013
621376c
some debugs
Sep 11, 2013
16a5f9c
added some debug output for freefare_tag_new_pcsc
simonibus Sep 11, 2013
5dddede
fixed it to compile again
Sep 11, 2013
75bc7a5
clearified some things ...
Sep 11, 2013
a9d4c7e
fixes list devices pcsc
aircrach Sep 11, 2013
ce557e1
added support for block orientented protocol T1
simonibus Sep 11, 2013
bfe39ba
some more adjustment in freefare.c
Sep 11, 2013
a18796d
SCardGetAttrib call has been fixed
simonibus Sep 11, 2013
3ebcc80
set the right parameter for SCardGetAttrib
simonibus Sep 11, 2013
0a5c5d1
test changes
aircrach Sep 11, 2013
623d596
test
aircrach Sep 11, 2013
13bc4e4
prototypes got changed in header
simonibus Sep 11, 2013
e43850d
get uid
aircrach Sep 11, 2013
b33e945
changed strncmp to memcmp so that null charakters are handlesd correct
Sep 11, 2013
ec85214
szReader in the MifareTag struct was not correctly filled with the st…
simonibus Sep 11, 2013
7b0c3b1
cleanup & style
Sep 11, 2013
1b51c02
changes protocol
aircrach Sep 11, 2013
0f288bc
changed handle pointer to simple handle ...
Sep 11, 2013
76c52f3
small fix
aircrach Sep 11, 2013
05a1b2c
working desfire pcsc
aircrach Sep 11, 2013
e95ba5c
ask about the return value of functions
simonibus Sep 11, 2013
af34ba8
better output on failure
simonibus Sep 11, 2013
dd2a332
getting more overview by modularisation: abstraced the filling- and f…
simonibus Sep 11, 2013
f96cd7b
better condition checking
simonibus Sep 11, 2013
7da6a27
added missing return NULL
simonibus Sep 11, 2013
16c2fc4
fixed macro FREE_SZREADER
simonibus Sep 11, 2013
217eacd
starting up with mifare_classic to be able to use pcsc protocoll
simonibus Sep 11, 2013
e786f02
no error output when no tag is found
Sep 12, 2013
4fbcaf5
small changes in FILL_SZREADER macro
Sep 12, 2013
4577786
mifare_ultralight support ... maybe
Sep 12, 2013
6e691de
now ultralight should work now ...
Sep 12, 2013
88cb465
changes to get_tag and tag_new, replaced pcsc parameters in user api
aircrach Sep 13, 2013
930cd60
indention
simonibus Sep 12, 2013
366926c
removed silly characters
simonibus Sep 12, 2013
c85a2a6
moved redundant code out of every if/else-branch
simonibus Sep 12, 2013
7a9dce8
the pcsc context wastn saved in our structure, so we couldnt reconnec…
simonibus Sep 12, 2013
3c8b81e
fixed mifare classic connect function
simonibus Sep 12, 2013
b05f913
some indention an stylish fixes
simonibus Sep 12, 2013
8c82503
sytle fixes & indention
simonibus Sep 12, 2013
901e1aa
Freeing the szReader was on the wrong place
simonibus Sep 12, 2013
ad9b239
cleaned up the macros ... one more time
Sep 12, 2013
4082122
reincluded atr-testing to see which cardtype we have ...
Sep 12, 2013
07251f9
added debug textes
Sep 12, 2013
b036dbc
added error handling
Sep 13, 2013
5678e76
fixed a pointer...
Sep 13, 2013
27bb393
adding crc-check
Sep 13, 2013
66d3109
added missing free
Sep 13, 2013
175a561
fixed crc-debug output
Sep 13, 2013
3fe9f34
mifare-ultralight-info-pcsc added
aircrach Sep 13, 2013
3563965
mifare-ultralight-info-pcsc added - now for real
aircrach Sep 13, 2013
aae64ca
fixed wrong file
aircrach Sep 13, 2013
2ebdfbd
fix tag_info
aircrach Sep 13, 2013
628929d
maybe fixed crc-fail with ultralight
Sep 13, 2013
a12246a
fix tag type
aircrach Sep 13, 2013
a3de884
fix ultralight info pcsc
aircrach Sep 13, 2013
d57b45a
ultralight info pcsc nodev fix
Sep 13, 2013
2c5f74d
fixed swapping of original and copyied data
Sep 13, 2013
982f0fe
now it should be really fixed
Sep 13, 2013
f58c74a
added correct handling of classic1k and classic4k
Sep 13, 2013
3d53b1f
added missing branch in tag-detection
Sep 13, 2013
47cc0ca
corrected wrong crc in classic 4k
Sep 13, 2013
bb6a7c1
beginning of a rework of the tags
Sep 13, 2013
e26b719
added the tags file
Sep 13, 2013
6cf674f
"beautified" the tag comparison
Sep 13, 2013
18c779b
fix no card found ultralight info pcsc
aircrach Sep 13, 2013
88e1f8c
added debug ..
Sep 13, 2013
0bf2ec2
bug fix ?
Sep 13, 2013
eeb2cdf
added wildcards for mifare-classic cards
Sep 13, 2013
1a5c202
added a mifare-desfire-info-pcsc program example
simonibus Sep 13, 2013
a1b87d5
adjusted Makefile for the examples folder
simonibus Sep 13, 2013
f4fd64f
wrote better loop condition
simonibus Sep 13, 2013
8e51b37
Check PCSC configuration using pkg-config
Sep 15, 2013
662b6e4
The PC/SC header file is winscard.h
Sep 15, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ if test x$ac_cv_with_cutter = xyes -a x$ac_cv_use_cutter = xno; then
fi
AM_CONDITIONAL([WITH_CUTTER], [test "$ac_cv_use_cutter" != "no"])

PKG_CHECK_MODULES(PCSC, libpcsclite)

m4_ifdef([AC_CHECK_COVERAGE], [AC_CHECK_COVERAGE])

if test x$cutter_enable_coverage = xyes; then
Expand Down
14 changes: 11 additions & 3 deletions examples/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# $Id$

AM_CFLAGS = -I. -I$(top_srcdir)/libfreefare @LIBNFC_CFLAGS@
AM_LDFLAGS = @LIBNFC_LIBS@
AM_CFLAGS = -I. -I$(top_srcdir)/libfreefare @LIBNFC_CFLAGS@ @PCSC_CFLAGS@
AM_LDFLAGS = @LIBNFC_LIBS@ @PCSC_LIBS@

bin_PROGRAMS = mifare-classic-format \
mifare-classic-write-ndef \
Expand All @@ -13,9 +13,11 @@ bin_PROGRAMS = mifare-classic-format \
mifare-desfire-ev1-configure-random-uid \
mifare-desfire-format \
mifare-desfire-info \
mifare-desfire-info-pcsc \
mifare-desfire-read-ndef \
mifare-desfire-write-ndef \
mifare-ultralight-info
mifare-ultralight-info \
mifare-ultralight-info-pcsc

mifare_classic_format_SOURCES = mifare-classic-format.c
mifare_classic_format_LDADD = $(top_builddir)/libfreefare/libfreefare.la
Expand Down Expand Up @@ -47,6 +49,9 @@ mifare_desfire_format_LDADD = $(top_builddir)/libfreefare/libfreefare.la
mifare_desfire_info_SOURCES = mifare-desfire-info.c
mifare_desfire_info_LDADD = $(top_builddir)/libfreefare/libfreefare.la -lm

mifare_desfire_info_pcsc_SOURCES = mifare-desfire-info-pcsc.c
mifare_desfire_info_pcsc_LDADD = $(top_builddir)/libfreefare/libfreefare.la -lm

mifare_desfire_read_ndef_SOURCES = mifare-desfire-read-ndef.c
mifare_desfire_read_ndef_LDADD = $(top_builddir)/libfreefare/libfreefare.la

Expand All @@ -56,4 +61,7 @@ mifare_desfire_write_ndef_LDADD = $(top_builddir)/libfreefare/libfreefare.la
mifare_ultralight_info_SOURCES = mifare-ultralight-info.c
mifare_ultralight_info_LDADD = $(top_builddir)/libfreefare/libfreefare.la

mifare_ultralight_info_pcsc_SOURCES = mifare-ultralight-info-pcsc.c
mifare_ultralight_info_pcsc_LDADD = $(top_builddir)/libfreefare/libfreefare.la

CLEANFILES= *.gcno
228 changes: 228 additions & 0 deletions examples/mifare-desfire-info-pcsc
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
#! /bin/sh

# mifare-desfire-info-pcsc - temporary wrapper script for .libs/mifare-desfire-info-pcsc
# Generated by libtool (GNU libtool) 2.4.2
#
# The mifare-desfire-info-pcsc program cannot be directly executed until all the libtool
# libraries that it depends on are installed.
#
# This wrapper script should never be moved out of the build directory.
# If it is, it will not operate correctly.

# Sed substitution that helps us do robust quoting. It backslashifies
# metacharacters that are still active within double-quoted strings.
sed_quote_subst='s/\([`"$\\]\)/\\\1/g'

# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
fi
BIN_SH=xpg4; export BIN_SH # for Tru64
DUALCASE=1; export DUALCASE # for MKS sh

# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH

relink_command="(cd /home/simon/Dropbox/Uni/Semester_5/PASST/RainerSCT/libfreefare-pcsc/libfreefare/examples; { test -z \"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; { test -z \"\${LD_LIBRARY_PATH+set}\" || unset LD_LIBRARY_PATH || { LD_LIBRARY_PATH=; export LD_LIBRARY_PATH; }; }; PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/vendor_perl:/usr/bin/core_perl; export PATH; gcc -I. -I../libfreefare -pthread -I/home/simon/Dropbox/Uni/Semester_5/PASST/RainerSCT/build/include -I/usr/include/libusb-1.0 -I/usr/include/PCSC -g -O2 -std=c99 -o \$progdir/\$file mifare-desfire-info-pcsc.o -L/home/simon/Dropbox/Uni/Semester_5/PASST/RainerSCT/build/lib ../libfreefare/.libs/libfreefare.so /home/simon/Dropbox/Uni/Semester_5/PASST/RainerSCT/build/lib/libnfc.so -lusb -lpcsclite -lm -lcrypto -pthread -Wl,-rpath -Wl,/home/simon/Dropbox/Uni/Semester_5/PASST/RainerSCT/libfreefare-pcsc/libfreefare/libfreefare/.libs -Wl,-rpath -Wl,/home/simon/Dropbox/Uni/Semester_5/PASST/RainerSCT/build/lib -Wl,-rpath -Wl,/home/simon/Dropbox/Uni/Semester_5/PASST/RainerSCT/build/lib)"

# This environment variable determines our operation mode.
if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then
# install mode needs the following variables:
generated_by_libtool_version='2.4.2'
notinst_deplibs=' ../libfreefare/libfreefare.la'
else
# When we are sourced in execute mode, $file and $ECHO are already set.
if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
file="$0"

# A function that is used when there is no print builtin or printf.
func_fallback_echo ()
{
eval 'cat <<_LTECHO_EOF
$1
_LTECHO_EOF'
}
ECHO="printf %s\\n"
fi

# Very basic option parsing. These options are (a) specific to
# the libtool wrapper, (b) are identical between the wrapper
# /script/ and the wrapper /executable/ which is used only on
# windows platforms, and (c) all begin with the string --lt-
# (application programs are unlikely to have options which match
# this pattern).
#
# There are only two supported options: --lt-debug and
# --lt-dump-script. There is, deliberately, no --lt-help.
#
# The first argument to this parsing function should be the
# script's ../libtool value, followed by no.
lt_option_debug=
func_parse_lt_options ()
{
lt_script_arg0=$0
shift
for lt_opt
do
case "$lt_opt" in
--lt-debug) lt_option_debug=1 ;;
--lt-dump-script)
lt_dump_D=`$ECHO "X$lt_script_arg0" | /usr/bin/sed -e 's/^X//' -e 's%/[^/]*$%%'`
test "X$lt_dump_D" = "X$lt_script_arg0" && lt_dump_D=.
lt_dump_F=`$ECHO "X$lt_script_arg0" | /usr/bin/sed -e 's/^X//' -e 's%^.*/%%'`
cat "$lt_dump_D/$lt_dump_F"
exit 0
;;
--lt-*)
$ECHO "Unrecognized --lt- option: '$lt_opt'" 1>&2
exit 1
;;
esac
done

# Print the debug banner immediately:
if test -n "$lt_option_debug"; then
echo "mifare-desfire-info-pcsc:mifare-desfire-info-pcsc:${LINENO}: libtool wrapper (GNU libtool) 2.4.2" 1>&2
fi
}

# Used when --lt-debug. Prints its arguments to stdout
# (redirection is the responsibility of the caller)
func_lt_dump_args ()
{
lt_dump_args_N=1;
for lt_arg
do
$ECHO "mifare-desfire-info-pcsc:mifare-desfire-info-pcsc:${LINENO}: newargv[$lt_dump_args_N]: $lt_arg"
lt_dump_args_N=`expr $lt_dump_args_N + 1`
done
}

# Core function for launching the target application
func_exec_program_core ()
{

if test -n "$lt_option_debug"; then
$ECHO "mifare-desfire-info-pcsc:mifare-desfire-info-pcsc:${LINENO}: newargv[0]: $progdir/$program" 1>&2
func_lt_dump_args ${1+"$@"} 1>&2
fi
exec "$progdir/$program" ${1+"$@"}

$ECHO "$0: cannot exec $program $*" 1>&2
exit 1
}

# A function to encapsulate launching the target application
# Strips options in the --lt-* namespace from $@ and
# launches target application with the remaining arguments.
func_exec_program ()
{
case " $* " in
*\ --lt-*)
for lt_wr_arg
do
case $lt_wr_arg in
--lt-*) ;;
*) set x "$@" "$lt_wr_arg"; shift;;
esac
shift
done ;;
esac
func_exec_program_core ${1+"$@"}
}

# Parse options
func_parse_lt_options "$0" ${1+"$@"}

# Find the directory that this script lives in.
thisdir=`$ECHO "$file" | /usr/bin/sed 's%/[^/]*$%%'`
test "x$thisdir" = "x$file" && thisdir=.

# Follow symbolic links until we get to the real thisdir.
file=`ls -ld "$file" | /usr/bin/sed -n 's/.*-> //p'`
while test -n "$file"; do
destdir=`$ECHO "$file" | /usr/bin/sed 's%/[^/]*$%%'`

# If there was a directory component, then change thisdir.
if test "x$destdir" != "x$file"; then
case "$destdir" in
[\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;;
*) thisdir="$thisdir/$destdir" ;;
esac
fi

file=`$ECHO "$file" | /usr/bin/sed 's%^.*/%%'`
file=`ls -ld "$thisdir/$file" | /usr/bin/sed -n 's/.*-> //p'`
done

# Usually 'no', except on cygwin/mingw when embedded into
# the cwrapper.
WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no
if test "$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR" = "yes"; then
# special case for '.'
if test "$thisdir" = "."; then
thisdir=`pwd`
fi
# remove .libs from thisdir
case "$thisdir" in
*[\\/].libs ) thisdir=`$ECHO "$thisdir" | /usr/bin/sed 's%[\\/][^\\/]*$%%'` ;;
.libs ) thisdir=. ;;
esac
fi

# Try to get the absolute directory name.
absdir=`cd "$thisdir" && pwd`
test -n "$absdir" && thisdir="$absdir"

program=lt-'mifare-desfire-info-pcsc'
progdir="$thisdir/.libs"

if test ! -f "$progdir/$program" ||
{ file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | /usr/bin/sed 1q`; \
test "X$file" != "X$progdir/$program"; }; then

file="$$-$program"

if test ! -d "$progdir"; then
mkdir "$progdir"
else
rm -f "$progdir/$file"
fi

# relink executable if necessary
if test -n "$relink_command"; then
if relink_command_output=`eval $relink_command 2>&1`; then :
else
printf %s\n "$relink_command_output" >&2
rm -f "$progdir/$file"
exit 1
fi
fi

mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null ||
{ rm -f "$progdir/$program";
mv -f "$progdir/$file" "$progdir/$program"; }
rm -f "$progdir/$file"
fi

if test -f "$progdir/$program"; then
if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
# Run the actual program with our arguments.
func_exec_program ${1+"$@"}
fi
else
# The program doesn't exist.
$ECHO "$0: error: \`$progdir/$program' does not exist" 1>&2
$ECHO "This script is just a wrapper for $program." 1>&2
$ECHO "See the libtool documentation for more information." 1>&2
exit 1
fi
fi
Loading