File tree 3 files changed +52
-33
lines changed
3 files changed +52
-33
lines changed Original file line number Diff line number Diff line change 1
1
MAINTAINERCLEANFILES = $(srcdir ) /Makefile.in
2
2
3
3
dist_noinst_SCRIPTS = test-manpage.sh \
4
+ test-fuzzing.sh \
4
5
test-pkcs11-tool-sign-verify.sh
5
6
6
7
TESTS = test-manpage.sh \
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -ex
4
+
5
+ case " $1 " in
6
+ " pkcs11-tool" )
7
+ CMD=" src/tools/pkcs11-tool --test --login --pin 123456"
8
+ ;;
9
+ " pkcs15-tool" )
10
+ CMD=" src/tools/pkcs15-tool --dump"
11
+ ;;
12
+ " eidenv" )
13
+ CMD=" src/tools/eidenv"
14
+ ;;
15
+ * )
16
+ echo " Unknown fuzzing target"
17
+ exit 1
18
+ ;;
19
+ esac
20
+
21
+ IN=tests/fuzzing-testcases
22
+ if [ ! -d " $IN " ]
23
+ then
24
+ mkdir -p " $IN "
25
+ echo -ne " $( printf ' \\x90\\x00' ) " > " $IN " /9000
26
+ fi
27
+
28
+ # reuse output directory if possible
29
+ OUT=" out-$1 "
30
+ if [ -d " $OUT " ]
31
+ then
32
+ IN=-
33
+ fi
34
+
35
+ if [ ! -d x41-smartcard-fuzzing ];
36
+ then
37
+ git clone https://github.com/x41sec/x41-smartcard-fuzzing
38
+ fi
39
+
40
+ gcc -shared -fPIC -o x41-smartcard-fuzzing/scard_override/libsccard_override.so x41-smartcard-fuzzing/scard_override/scard_override.c -ldl -I/usr/include/PCSC/
41
+
42
+ if [ ! -f configure ];
43
+ then
44
+ autoreconf -vis
45
+ fi
46
+
47
+ # export AFL_USE_ASAN=1
48
+ ./configure CC=afl-gcc CFLAGS=" -O0" --disable-shared --disable-notify --with-pcsc-provider=$PWD /x41-smartcard-fuzzing/scard_override/libsccard_override.so
49
+ make
50
+
51
+ FUZZ_FILE=input.apdu afl-fuzz -i " $IN " -o " $OUT " -f input.apdu $CMD
You can’t perform that action at this time.
0 commit comments