Check-in [a708a36250]
Overview
Comment:Updated to support building static archives and to check a cache variable regarding PC/SC working
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a708a3625001160f768984e6bac2eccc43a75dbd
User & Date: rkeene on 2016-02-03 18:57:58
Other Links: manifest | tags
Context
2016-02-04
17:36
Better work towards a Chrome plugin check-in: 7c7e9cf4fc user: rkeene tags: trunk
2016-02-03
18:57
Updated to support building static archives and to check a cache variable regarding PC/SC working check-in: a708a36250 user: rkeene tags: trunk
18:50
Updated to cast length variable to the correct type for formatting check-in: df8d7782c8 user: rkeene tags: trunk
Changes

Modified Makefile.in from [a9f033d493] to [9978cadd3e].

10
11
12
13
14
15
16
17



18
19
20




21
22
23
24
25
26
27
28
29
30
31
32
33
34
35










36
37
38
39
40
41
42
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58







-
+
+
+



+
+
+
+















+
+
+
+
+
+
+
+
+
+







AR = @AR@
RANLIB = @RANLIB@
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
@SET_MAKE@

all:
all: @DEFAULT_TARGET@

shared:
	$(MAKE) libcackey.@SHOBJEXT@
	-$(MAKE) libcackey_g.@SHOBJEXT@

static:
	$(MAKE) libcackey.a
	-$(MAKE) libcackey_g.a

cackey.o: cackey.c cackey_builtin_certs.h sha1.c sha1.h md5.c md5.h asn1-x509.c asn1-x509.h config.h
	$(CC) $(SHOBJFLAGS) $(CPPFLAGS) $(CFLAGS) -o cackey.o -c cackey.c

cackey_g.o: cackey.c cackey_builtin_certs.h sha1.c sha1.h md5.c md5.h asn1-x509.c asn1-x509.h config.h
	$(CC) $(SHOBJFLAGS) $(DEBUGCPPFLAGS) $(DEBUGCFLAGS) -o cackey_g.o -c cackey.c

libcackey.@SHOBJEXT@: cackey.o
	$(CC) $(SHOBJFLAGS) $(CPPFLAGS) $(CFLAGS) $(SHOBJLDFLAGS) $(LDFLAGS) -o libcackey.@SHOBJEXT@ cackey.o $(LIBS)
	-@WEAKENSYMS@ "libcackey.@SHOBJEXT@"
	-@REMOVESYMS@ "libcackey.@SHOBJEXT@"

libcackey_g.@SHOBJEXT@: cackey_g.o
	$(CC) $(SHOBJFLAGS) $(DEBUGCPPFLAGS) $(DEBUGCFLAGS) $(SHOBJLDFLAGS) $(LDFLAGS) -o libcackey_g.@SHOBJEXT@ cackey_g.o $(LIBS)
	-@WEAKENSYMS@ "libcackey_g.@SHOBJEXT@"

libcackey.a: cackey.o
	rm -f libcackey.a
	$(AR) rcu libcackey.a cackey.o
	-$(RANLIB) libcackey.a

libcackey_g.a: cackey_g.o
	rm -f libcackey_g.a
	$(AR) rcu libcackey_g.a cackey_g.o
	-$(RANLIB) libcackey_g.a

test: test.c libcackey_g.@SHOBJEXT@
	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o test test.c -Wl,-R,. libcackey_g.@SHOBJEXT@

test-afl.data: test
	tmpLogFile='log.$(shell openssl rand -hex 16)'; \
		./test 2> $${tmpLogFile}; \
		echo -ne "$$( \
68
69
70
71
72
73
74
75

84
85
86
87
88
89
90

91







-
+

distclean: clean
	rm -f config.log config.status config.h Makefile libcackey.syms

mrproper: distclean
	rm -f configure config.h.in aclocal.m4 *~

.PHONY: all clean distclean mrproper install
.PHONY: all shared static clean distclean mrproper install

Modified aclocal/dc_shobjs.m4 from [9ca31dd769] to [278f27f121].

18
19
20
21
22
23
24

25
26
27

28
29
30
31
32
33
34
35
36
37
38
39
40

41
42
43
44
45
46
47
48
49
50
51
52
53
54

55




56
57
58
59
60
61
62
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

42

43
44
45
46
47
48
49
50
51
52
53
54
55
56

57
58
59
60
61
62
63
64
65
66
67







+



+












-
+
-













+
-
+
+
+
+








  LDFLAGS="$OLD_LDFLAGS"
])

AC_DEFUN(DC_GET_SHOBJFLAGS, [
  AC_SUBST(SHOBJFLAGS)
  AC_SUBST(SHOBJLDFLAGS)
  AC_SUBST(DEFAULT_TARGET)

  AC_MSG_CHECKING(how to create shared objects)

  DEFAULT_TARGET=shared
  if test -z "$SHOBJFLAGS" -a -z "$SHOBJLDFLAGS"; then
    DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -rdynamic], [
      DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared], [
	DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -rdynamic -mimpure-text], [
	  DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -mimpure-text], [
	    DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -rdynamic -Wl,-G,-z,textoff], [
	      DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -Wl,-G,-z,textoff], [
		DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -dynamiclib -flat_namespace -undefined suppress -bind_at_load], [
		  DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib -flat_namespace -undefined suppress -bind_at_load], [
		    DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-Wl,-dynamiclib -Wl,-flat_namespace -Wl,-undefined,suppress -Wl,-bind_at_load], [
		      DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib -flat_namespace -undefined suppress], [
		        DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib], [
		          AC_MSG_RESULT(cant)
                          DEFAULT_TARGET=static
		          AC_MSG_ERROR([We are unable to make shared objects.])
                        ])
		      ])
		    ])
		  ])
		])
	      ])
	    ])
	  ])
	])
      ])
    ])
  fi

  if test "$DEFAULT_TARGET" = 'shared' ; then
  AC_MSG_RESULT($SHOBJLDFLAGS $SHOBJFLAGS)
    AC_MSG_RESULT($SHOBJLDFLAGS $SHOBJFLAGS)
  else
    AC_MSG_RESULT(cant -- result will be a static archive)
  fi

  DC_SYNC_SHLIBOBJS
])

AC_DEFUN(DC_SYNC_SHLIBOBJS, [
  AC_SUBST(SHLIBOBJS)
  SHLIBOBJS=""

Modified build/chrome/build-deps from [bf636f72b1] to [f83599ae85].

285
286
287
288
289
290
291

292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312

313
314
315
316
317
318
319
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312

313
314
315
316
317
318
319
320







+




















-
+








	return 0
}

function buildCACKey() {
	local platform
	local file copied
	local targets

	platform="$1"
	shift

	if [ -z "${platform}" ]; then
		echo 'error: Platform not specified' >&2

		return 1
	fi

	(
		cd ../.. || exit 1

		make distclean

		./configure --with-pcsc-headers="${cackeyChromeExtPCSCLiteDir}/include/PCSC" --with-pcsc-libs="${PCSC_LIBS}" "$@" || exit 1
		make || exit 1
	) || return 1

	copied='0'
	for file in ../../libcackey{,_g}.{so,dll,dylib}; do
	for file in ../../libcackey{,_g}.{so,dll,dylib,a}; do
		if [ -f "${file}" ]; then
			mkdir -p "${outdir}/${platform}"

			cp "${file}" "${outdir}/${platform}"
			copied='1'
		fi
	done
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358

359
360
361
362
363
364
365
366
344
345
346
347
348
349
350









351




352
353
354
355







-
-
-
-
-
-
-
-
-
+
-
-
-
-




rm -rf "${outdir}"
mkdir "${outdir}" || exit 1

buildPCSCLite || exit 1

buildCACKey build || exit 1

buildOutputType="$(echo 'int main(int argc, char **argv) { return(0); }' | "${CC:-cc}" -x c - -o /dev/stdout | file -)" || exit 1
case "${buildOutputType}" in
	*x86-64*)
		naclTopDir='linux_x86_glibc'
		naclPlatform='x86_64-nacl'
		;;
	*)
		echo "error: Unrecognized platform output: \"${buildOutputType}\"" >&2

PATH="${PATH}:${NACL_SDK_ROOT}/toolchain/linux_pnacl/bin" buildCACKey pnacl --host="nacl" CC=pnacl-clang LD=pnacl-ld OBJCOPY=pnacl-objcopy STRIP=pnacl-strip AR=pnacl-ar RANLIB=pnacl-ranlib cackey_cv_pcsc_works=okay || exit 1
		exit 1
		;;
esac
PATH="${PATH}:${NACL_SDK_ROOT}/toolchain/${naclTopDir}/bin" buildCACKey "${naclPlatform}" --host="${naclPlatform}" CC=${naclPlatform}-gcc LD=${naclPlatform}-ld OBJCOPY=${naclPlatform}-objcopy STRIP=${naclPlatform}-strip || exit 1

cleanup

exit 0

Modified configure.ac from [e7d2982c77] to [5e1ee40fe1].

79
80
81
82
83
84
85
86
87
88



89
90
91
92
93
94
95
79
80
81
82
83
84
85



86
87
88
89
90
91
92
93
94
95







-
-
-
+
+
+







dnl Check for PC/SC headers and libraries
DC_PCSC

dnl Check for ZLIB libraries
AC_CHECK_LIB(z, uncompress)

dnl Verify that a basic program will compile
AC_MSG_CHECKING([if basic PC/SC program works])
AC_LINK_IFELSE(
	AC_LANG_PROGRAM([[
AC_CACHE_CHECK([if basic PC/SC program works], cackey_cv_pcsc_works, [
	AC_LINK_IFELSE(
		AC_LANG_PROGRAM([[
#ifdef HAVE_WINTYPES_H
#  include <wintypes.h>
#endif
#ifdef HAVE_PCSCLITE_H
#  include <pcsclite.h>
#endif
#ifdef HAVE_WINSCARD_H
120
121
122
123
124
125
126
127
128
129
130
131





132
133

134
135
136
137
138
139
140
141







142
143
144




145
146
147
148
149
150
151
120
121
122
123
124
125
126





127
128
129
130
131
132

133
134







135
136
137
138
139
140
141

142
143
144
145
146
147
148
149
150
151
152
153
154







-
-
-
-
-
+
+
+
+
+

-
+

-
-
-
-
-
-
-
+
+
+
+
+
+
+
-


+
+
+
+







#  include <stdio.h>
#endif
#ifdef HAVE_ZLIB_H
#  ifdef HAVE_LIBZ
#    include <zlib.h>
#  endif
#endif
	]], [[
		LPSCARDHANDLE hCard;
		SCARDCONTEXT hContext;
		DWORD dwActiveProtocol;
		LONG scard_conn_ret, scard_est_context_ret;
		]], [[
			LPSCARDHANDLE hCard;
			SCARDCONTEXT hContext;
			DWORD dwActiveProtocol;
			LONG scard_conn_ret, scard_est_context_ret;

		scard_est_context_ret = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hContext);
			scard_est_context_ret = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hContext);

		hCard = NULL;
		scard_conn_ret = SCardConnect(hContext, "Reader X", SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0, hCard, &dwActiveProtocol);
	]]), [
		AC_MSG_RESULT(okay)
	], [
		AC_MSG_RESULT(failed)

			hCard = NULL;
			scard_conn_ret = SCardConnect(hContext, "Reader X", SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0, hCard, &dwActiveProtocol);
		]]), [
			cackey_cv_pcsc_works=okay
		], [
			cackey_cv_pcsc_works=failed
		])
		AC_MSG_FAILURE([simple PC/SC program failed])
	]
)

if test "$cackey_cv_pcsc_works" = 'failed'; then
	AC_MSG_FAILURE([simple PC/SC program failed])
fi

dnl Option to enable DoD certs on hardware slot
AC_ARG_ENABLE(dod-certs-on-hw-slots, AC_HELP_STRING([--enable-dod-certs-on-hw-slots], [Specify that DoD certificates should be made available on hardware token slots]), [
	dodcertsonhwslots=$enableval
], [
	dodcertsonhwslots=no
])