Check-in [9e8c8d0997]
Overview
Comment:More work towards getting ChromeOS extension going
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:9e8c8d099762f421649855186c7c8141941f5312
User & Date: rkeene on 2016-02-10 23:04:54
Other Links: manifest | tags
Context
2016-02-10
23:06
ChromeOS: better cleanup check-in: 82721ca5b6 user: rkeene tags: trunk
23:04
More work towards getting ChromeOS extension going check-in: 9e8c8d0997 user: rkeene tags: trunk
2016-02-04
22:52
Added more Chrome extension parts check-in: e9e86eb240 user: rkeene tags: trunk
Changes

Modified .fossil-settings/ignore-glob from [52dd43d58b] to [6153c84cb9].

    20     20   build/certs
    21     21   test
    22     22   test-afl
    23     23   test-afl.data
    24     24   build/chrome/archive
    25     25   build/chrome/workdir-*
    26     26   build/chrome/lib
           27  +build/chrome/include
    27     28   build/chrome/cackey-chrome.o
    28     29   build/chrome/cackey-chrome-init.o
    29     30   build/chrome/cackey.pexe
    30     31   build/chrome/cackey.nmf
    31     32   build/chrome/cackey.crx
           33  +build/chrome/test
           34  +build/chrome/google-pcsc.js

Modified build/chrome/Makefile from [c9ad2816e9] to [f428275431].

     3      3   AR       = pnacl-ar
     4      4   RANLIB   = pnacl-ranlib
     5      5   FINALIZE = pnacl-finalize
     6      6   
     7      7   CACKEY_LIBS = -Llib -lcackey -lz
     8      8   PCSC_LIBS   = -Llib -lpcsc -L${NACL_SDK_ROOT}/lib/pnacl/Release -lppapi -lppapi_cpp
     9      9   LIBS        = $(CACKEY_LIBS) $(PCSC_LIBS)
    10         -CFLAGS      = -Wall -I${NACL_SDK_ROOT}/include
    11         -CXXFLAGS    = $(CFLAGS)
           10  +CFLAGS      = -Wall -g3 -ggdb3 -I${NACL_SDK_ROOT}/include -I../../pkcs11 -Iinclude/PCSC
           11  +CXXFLAGS    = $(CFLAGS) -std=gnu++11
           12  +LDFLAGS     = -g3 -ggdb3
    12     13   
    13     14   PATH += :${NACL_SDK_ROOT}/toolchain/linux_pnacl/bin
    14     15   export PATH
    15     16   
           17  +ifeq (,${NACL_SDK_ROOT})
           18  +$(error "Please set NACL_SDK_ROOT")
           19  +endif
           20  +export NACL_SDK_ROOT
           21  +
    16     22   all: cackey.crx
    17     23   
    18         -cackey.crx: cackey.pexe cackey.nmf manifest.json cackey.js
           24  +cackey.crx: cackey.pexe cackey.nmf manifest.json cackey.js google-pcsc.js
    19     25   	rm -f cackey.crx
    20     26   	zip cackey.crx.new $^
    21     27   	mv cackey.crx.new cackey.crx
    22     28   
    23     29   cackey.pexe: cackey-chrome.o cackey-chrome-init.o lib/libcackey.a lib/libpcsc.a lib/libz.a
    24         -	$(CXX) -o cackey.pexe.new cackey-chrome.o cackey-chrome-init.o $(LIBS)
           30  +	$(CXX) $(CXXFLAGS) $(LDFLAGS) -o cackey.pexe.new cackey-chrome.o cackey-chrome-init.o $(LIBS)
    25     31   	$(FINALIZE) cackey.pexe.new
    26     32   	mv cackey.pexe.new cackey.pexe
    27     33   
    28     34   cackey.nmf: cackey.pexe
    29     35   	${NACL_SDK_ROOT}/tools/create_nmf.py cackey.pexe > cackey.nmf.new
    30     36   	mv cackey.nmf.new cackey.nmf
    31     37   
    32     38   lib/libcackey.a: build-deps
    33     39   	mkdir -p lib
    34     40   	rm -f lib/libcackey.a
    35     41   	rm -rf workdir-*
    36         -	./build-deps
    37         -	cd lib && ln -s ../workdir-*.inst/lib/libcackey.a .
           42  +	+./build-deps
           43  +	cd lib && ln -s ../workdir-*.inst/lib/libcackey_g.a libcackey.a
    38     44   	touch lib/libcackey.a
    39     45   
    40     46   lib/libpcsc.a: lib/libcackey.a
    41     47   	mkdir -p lib
    42     48   	rm -f lib/libpcsc.a
    43     49   	cd lib && ln -s ../workdir-*.inst/lib/libpcsc.a .
    44     50   	touch lib/libpcsc.a
................................................................................
    45     51   
    46     52   lib/libz.a: lib/libcackey.a
    47     53   	mkdir -p lib
    48     54   	rm -f lib/libz.a
    49     55   	cd lib && ln -s ../workdir-*.inst/lib/libz.a .
    50     56   	touch lib/libz.a
    51     57   
    52         -cackey-chrome.o: cackey-chrome.c
    53         -cackey-chrome-init.o: cackey-chrome-init.cc
           58  +google-pcsc.js: lib/libcackey.a
           59  +	rm -f google-pcsc.js google-pcsc.js.new
           60  +	cat workdir-*.inst/js/{scope,logging,pcsc,pcsc-nacl}.js > google-pcsc.js.new
           61  +	mv google-pcsc.js.new google-pcsc.js
           62  +
           63  +include/PCSC/pcsc-nacl.h: lib/libcackey.a
           64  +	mkdir -p include/PCSC
           65  +	rm -f include/PCSC/pcsc-nacl.h.new include/PCSC/pcsc-nacl.h
           66  +	cd include/PCSC && ln -s ../../workdir-*.inst/include/PCSC/pcsc-nacl.h pcsc-nacl.h.new
           67  +	touch include/PCSC/pcsc-nacl.h.new
           68  +	mv include/PCSC/pcsc-nacl.h.new include/PCSC/pcsc-nacl.h
           69  +
           70  +test: cackey-chrome.c cackey-chrome-test.c ../../cackey.c Makefile
           71  +	gcc -g3 -ggdb3 -Wall -I. -I../../pkcs11 -I/opt/appfs/core.appfs.rkeene.org/zlib/platform/latest/include -I/opt/appfs/rkeene.org/pcsc-lite/platform/latest/include/PCSC -DHAVE_WINTYPES_H=1 -DHAVE_PCSCLITE_H=1 -DHAVE_WINSCARD_H=1 -DHAVE_STDINT_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDLIB_H=1 -DHAVE_UNISTD_H=1 -DHAVE_STRING_H=1 -DHAVE_PTHREAD_H=1 -DHAVE_LIMITS_H=1 -DHAVE_STDIO_H=1 -DHAVE_ZLIB_H -DHAVE_LIBZ -DCACKEY_DEBUG=1 -o test cackey-chrome.c cackey-chrome-test.c ../../cackey.c -L/opt/appfs/core.appfs.rkeene.org/zlib/platform/latest/lib -lz -L/opt/appfs/rkeene.org/pcsc-lite/platform/latest/lib -lpcsclite -L/opt/appfs/core.appfs.rkeene.org/glibc/platform/latest/lib -lc -lpthread -Wl,-R,/opt/appfs/core.appfs.rkeene.org/zlib/platform/latest/lib -Wl,-R,/opt/appfs/rkeene.org/pcsc-lite/platform/latest/lib -Wl,-R,/opt/appfs/core.appfs.rkeene.org/glibc/platform/latest/lib -Wl,-dynamic-linker,/opt/appfs/core.appfs.rkeene.org/glibc/platform/latest/lib/ld-linux-x86-64.so.2
           72  +
           73  +cackey-chrome.o: cackey-chrome.c cackey-chrome.h
           74  +cackey-chrome-init.o: cackey-chrome-init.cc cackey-chrome.h include/PCSC/pcsc-nacl.h
    54     75   
    55     76   clean:
    56         -	rm -rf workdir-*
    57         -	rm -f lib/libcackey.a lib/libpcsc.a lib/libz.a
    58         -	-rmdir lib
    59     77   	rm -f cackey-chrome.o cackey-chrome-init.o
    60     78   	rm -f cackey.pexe
           79  +	rm -f cackey.crx cackey.nmf
    61     80   
    62     81   distclean: clean
           82  +	rm -f lib/libcackey.a lib/libpcsc.a lib/libz.a
           83  +	-rmdir lib
           84  +	rm -f include/PCSC/pcsc-nacl.h
           85  +	-rmdir include/PCSC
           86  +	-rmdir include
           87  +	rm -f google-pcsc.js
           88  +	rm -rf workdir-*
    63     89   
    64     90   .PHONY: all clean distclean

Modified build/chrome/build-deps from [93232701c1] to [c94a1830f2].

   225    225   
   226    226   	(
   227    227   		cd "${workdir}" || exit 1
   228    228   
   229    229   		# Copy out PC/SC headers for later use
   230    230   		mkdir -p "${instdir}/include/PCSC" || exit 1
   231    231   		cp third_party/pcsc-lite/src/src/PCSC/*.h "${instdir}/include/PCSC" || exit 1
          232  +
          233  +		# Copy out extra headers
          234  +		cat << \_EOF_ > "${instdir}/include/PCSC/pcsc-nacl.h"
          235  +#ifndef PCSC_NACL_H
          236  +#define PCSC_NACL_H 1
          237  +#ifdef __cplusplus
          238  +#include <ppapi/cpp/core.h>
          239  +#include <ppapi/cpp/instance.h>
          240  +
          241  +void pcscNaClInit(pp::Instance *instance, pp::Core *core);
          242  +#endif
          243  +#endif
          244  +_EOF_
   232    245   
   233    246   		# Copy out JavaScript files for later use
   234    247   		mkdir "${instdir}/js" || exit 1
          248  +		cp common-utils/*.js "${instdir}/js" || exit 1
   235    249   		cp third_party/pcsc-lite/client-side/*.js "${instdir}/js" || exit 1
   236    250   
   237    251   		# Build libpcsc
   238    252   		## Assemble all the files into a single tree
   239    253   		for file in logging.h scard_structs_serialization.h dom_requests_manager.h thread_safe_string_pool.h \
   240    254   		    pp_var_utils.cc pp_var_utils.h scard_structs_serialization.cc dom_requests_manager.cc logging.cc; do
   241    255   			find . -type f -name "${file}" -exec cp '{}' third_party/pcsc-lite/client-side/ ';'
................................................................................
   243    257   
   244    258   		## Create Makefile
   245    259   		cat << \_EOF_ > third_party/pcsc-lite/client-side/Makefile || exit 1
   246    260   CFLAGS   += -Wall -std=gnu++11
   247    261   CXXFLAGS += -Wall -std=gnu++11
   248    262   CPPFLAGS += -I../src/src/PCSC
   249    263   
   250         -OBJS = pcsc_nacl.o pcsc_nacl_global.o scard_structs_serialization.o pp_var_utils.o logging.o dom_requests_manager.o
          264  +OBJS = pcsc_nacl.o pcsc_nacl_global.o scard_structs_serialization.o pp_var_utils.o logging.o dom_requests_manager.o pcsc_nacl_init.o
   251    265   
   252    266   all: libpcsc.a
   253    267   
   254    268   libpcsc.a: $(OBJS)
   255    269   	rm -f libpcsc.a
   256    270   	$(AR) rc libpcsc.a $(OBJS)
   257    271   	-$(RANLIB) libpcsc.a
          272  +
          273  +pcsc_nacl_init.o: pcsc_nacl_init.cc pcsc_nacl_global.h dom_requests_manager.h pcsc_nacl.h
   258    274   
   259    275   pcsc_nacl.o: pcsc_nacl.cc pcsc_nacl.h logging.h pp_var_utils.h scard_structs_serialization.h
   260    276   pcsc_nacl.h: dom_requests_manager.h thread_safe_string_pool.h
   261    277   
   262    278   pcsc_nacl_global.o: pcsc_nacl_global.cc pcsc_nacl_global.h logging.h
   263    279   pcsc_nacl_global.h: pcsc_nacl.h
   264    280   
................................................................................
   276    292   	rm -f $(OBJS)
   277    293   	rm -f libpcsc.a
   278    294   
   279    295   distclean: clean
   280    296   
   281    297   .PHONY: all clean distclean
   282    298   _EOF_
          299  +
          300  +		## Create initialization procedure, since it lacks one
          301  +		cat << \_EOF_ > third_party/pcsc-lite/client-side/pcsc_nacl_init.cc
          302  +#include <ppapi/cpp/core.h>
          303  +#include <ppapi/cpp/instance.h>
          304  +
          305  +#include <stdio.h>
          306  +
          307  +#include "pcsc_nacl_global.h"
          308  +#include "dom_requests_manager.h"
          309  +#include "pcsc_nacl.h"
          310  +
          311  +void pcscNaClInit(pp::Instance *instance, pp::Core *core) {
          312  +	DomRequestsManager::PpDelegateImpl *drmDelegateImpl;
          313  +	PcscNacl *pcsc_nacl;
          314  +
          315  +	fprintf(stderr, "Called pcscNaClInit()\n");
          316  +
          317  +	drmDelegateImpl = new DomRequestsManager::PpDelegateImpl(instance, core);
          318  +
          319  +	pcsc_nacl = new PcscNacl(new DomRequestsManager("pcsc-nacl", drmDelegateImpl), "nahamlodapjneockbbogcleglpoillcn", "client");
          320  +
          321  +	fprintf(stderr, "New PcscNacl object = %p\n", pcsc_nacl);
          322  +
          323  +	if (!pcsc_nacl->Initialize()) {
          324  +		fprintf(stderr, "PcscNacl->Initialize() failed !");
          325  +
          326  +		return;
          327  +	}
          328  +
          329  +	fprintf(stderr, "Global instance set to %p\n", pcsc_nacl);
          330  +
          331  +	SetPcscNaclGlobalInstance(pcsc_nacl);
          332  +
          333  +	fprintf(stderr, "Returning.\n");
          334  +
          335  +	return;
          336  +}
          337  +_EOF_
   283    338   
   284    339   		## Make it
   285    340   		make -C third_party/pcsc-lite/client-side || exit 1
   286    341   
   287    342   		# Install the built libpcsc
   288    343   		mkdir -p "${instdir}/lib" || exit 1
   289    344   		cp third_party/pcsc-lite/client-side/libpcsc.a "${instdir}/lib" || exit 1

Modified build/chrome/cackey-chrome-init.cc from [5c1f40635b] to [f6b7a728d2].

     1         -#include "ppapi/cpp/module.h"
            1  +/*
            2  + * Google's PCSC library requires us to write our module in C++ (thanks, Google)
            3  + * This library wraps the actual library, written in C.
            4  + */
            5  +
            6  +#include <thread>
            7  +#include <ppapi/cpp/instance.h>
            8  +#include <ppapi/cpp/module.h>
            9  +#include <ppapi/cpp/core.h>
           10  +#include <ppapi/cpp/var.h>
           11  +#include <ppapi/cpp/var_dictionary.h>
           12  +#include <ppapi/cpp/var_array.h>
           13  +#include <ppapi/cpp/var_array_buffer.h>
           14  +
           15  +#include <stdio.h>
           16  +
           17  +#include "pcsc-nacl.h"
           18  +#include "cackey-chrome.h"
           19  +
           20  +class CACKeyInstance : public pp::Instance {
           21  +	private:
           22  +		void pcscNaClInitWrapper(pp::Core *core) {
           23  +			fprintf(stderr, "Calling pcscNaClInit(%p, %p)\n", this, core);
           24  +
           25  +			pcscNaClInit(this, core);
           26  +
           27  +			fprintf(stderr, "pcscNaClInit terminated\n");
           28  +		}
           29  +	public:
           30  +		explicit CACKeyInstance(PP_Instance instance, pp::Core *core) : pp::Instance(instance) {
           31  +			std::thread(&CACKeyInstance::pcscNaClInitWrapper, this, core).detach();
           32  +		}
           33  +
           34  +		virtual ~CACKeyInstance() {}
           35  +
           36  +		virtual void HandleMessage(const pp::Var& messagePlain) {
           37  +			int numCertificates, i;
           38  +			struct cackey_certificate *certificates;
           39  +			pp::VarDictionary *message;
           40  +			pp::VarDictionary *reply;
           41  +			pp::VarArray certificatesPPArray;
           42  +			pp::VarArrayBuffer *certificateContents;
           43  +			pp::Var command, target;
           44  +
           45  +			/*
           46  +			 * The incoming message must be a dictionary
           47  +			 */
           48  +			if (!messagePlain.is_dictionary()) {
           49  +				return;
           50  +			}
           51  +
           52  +			/*
           53  +			 * Process the appropriate command from the incoming message
           54  +			 */
           55  +			message = new pp::VarDictionary(messagePlain);
           56  +
           57  +			/*
           58  +			 * Verify that this message is destined for us
           59  +			 */
           60  +			if (!message->HasKey("target")) {
           61  +				return;
           62  +			}
           63  +
           64  +			target = message->Get("target");
           65  +			if (target.AsString() != "cackey") {
           66  +				return;
           67  +			}
           68  +
           69  +			/*
           70  +			 * Determine what we are being asked to do
           71  +			 */
           72  +			if (!message->HasKey("command")) {
           73  +				return;
           74  +			}
           75  +			command = message->Get("command");
           76  +
           77  +			/*
           78  +			 * Do the thing we are being asked to do
           79  +			 */
           80  +			if (command.AsString() == "listcertificates") {
           81  +				numCertificates = cackey_chrome_listCertificates(&certificates);
           82  +
           83  +				reply = new pp::VarDictionary();
           84  +
           85  +				certificatesPPArray.SetLength(numCertificates);
           86  +
           87  +				for (i = 0; i < numCertificates; i++) {
           88  +					certificateContents = new pp::VarArrayBuffer(certificates[i].certificate_len);
           89  +
           90  +					memcpy(certificateContents->Map(), certificates[i].certificate, certificates[i].certificate_len);
           91  +
           92  +					certificateContents->Unmap();
           93  +
           94  +					certificatesPPArray.Set(i, *certificateContents);
           95  +				}
           96  +
           97  +				reply->Set("status", "success");
           98  +				reply->Set("certificates", certificatesPPArray);
           99  +			} else if (command.AsString() == "sign") {
          100  +				reply = new pp::VarDictionary();
          101  +
          102  +				reply->Set("status", "success");
          103  +			} else {
          104  +				reply = new pp::VarDictionary();
          105  +
          106  +				reply->Set("status", "error");
          107  +				reply->Set("error", "Invalid command");
          108  +			}
          109  +
          110  +			/*
          111  +			 * If a message ID was sent in the request, include it in the reply
          112  +			 */
          113  +			if (message->HasKey("id")) {
          114  +				reply->Set("id", message->Get("id"));
          115  +			}
          116  +
          117  +			/*
          118  +			 * Send the reply back to the requestor, hopefully they are waiting for this message
          119  +			 */
          120  +			PostMessage(*reply);
          121  +
          122  +			return;
          123  +		}
          124  +};
     2    125   
     3    126   class CACKeyModule : public pp::Module {
     4    127   	public:
     5         -		CACKeyModule(): pp::Module() {}
          128  +		CACKeyModule() : pp::Module() {}
     6    129   		virtual ~CACKeyModule() {}
     7    130   
     8    131   		virtual pp::Instance *CreateInstance(PP_Instance instance) {
     9         -			return(NULL);
          132  +			return(new CACKeyInstance(instance, core()));
    10    133   		}
    11    134   };
    12    135   
    13    136   namespace pp {
    14    137   	Module *CreateModule() {
    15         -		return(NULL);
          138  +		return(new CACKeyModule());
    16    139   	}
    17    140   }

Added build/chrome/cackey-chrome-test.c version [5b31fe8fb3].

            1  +#include <stdio.h>
            2  +
            3  +#include "cackey-chrome.h"
            4  +
            5  +int main(int argc, char **argv) {
            6  +	struct cackey_certificate *certificates;
            7  +	int numCertificates;
            8  +
            9  +	numCertificates = cackey_chrome_listCertificates(&certificates);
           10  +
           11  +	printf("numCertificates = %i\n", numCertificates);
           12  +
           13  +	return(0);
           14  +}

Modified build/chrome/cackey-chrome.c from [5afb8e1152] to [b0e4dd691b].

     1         -void C_GetFunctionList(void);
     2         -int main(int argc, char **argv) {
     3         -	C_GetFunctionList();
            1  +#ifdef __cplusplus
            2  +extern "C" {
            3  +#endif
            4  +
            5  +#include <unistd.h>
            6  +#include <stdlib.h>
            7  +
            8  +#include "mypkcs11.h"
            9  +#include "cackey-chrome.h"
           10  +
           11  +struct cackey_chrome_id {
           12  +	unsigned char *id;
           13  +	size_t idLen;
           14  +};
           15  +
           16  +static CK_FUNCTION_LIST_PTR moduleFunctionList = NULL;
           17  +
           18  +static CK_RV cackey_chrome_init(void) {
           19  +	CK_C_INITIALIZE_ARGS initargs;
           20  +	CK_RV chk_rv;
           21  +
           22  +	if (moduleFunctionList != NULL) {
           23  +		return(CKR_OK);
           24  +	}
           25  +
           26  +	chk_rv = C_GetFunctionList(&moduleFunctionList);
           27  +	if (chk_rv != CKR_OK) {
           28  +		return(chk_rv);
           29  +	}
           30  +
           31  +	initargs.CreateMutex = NULL;
           32  +	initargs.DestroyMutex = NULL;
           33  +	initargs.LockMutex = NULL;
           34  +	initargs.UnlockMutex = NULL;
           35  +	initargs.flags = CKF_OS_LOCKING_OK;
           36  +	initargs.pReserved = NULL;
           37  +
           38  +	chk_rv = moduleFunctionList->C_Initialize(&initargs);
           39  +	if (chk_rv != CKR_OK) {
           40  +		return(chk_rv);
           41  +	}
           42  +
           43  +	return(CKR_OK);
           44  +}
           45  +
           46  +int cackey_chrome_listCertificates(struct cackey_certificate **certificates) {
           47  +	CK_RV chk_rv;
           48  +	CK_ULONG numSlots, currSlot;
           49  +	CK_SLOT_ID_PTR slots;
           50  +	CK_SLOT_INFO slotInfo;
           51  +	CK_SESSION_HANDLE hSession;
           52  +	CK_OBJECT_HANDLE hObject;
           53  +	CK_ULONG ulObjectCount;
           54  +	CK_ATTRIBUTE searchTemplatePrivateKeys[] = {
           55  +		{CKA_CLASS, NULL, sizeof(CK_OBJECT_CLASS)}
           56  +	};
           57  +	CK_ATTRIBUTE searchTemplateCertificates[] = {
           58  +		{CKA_CLASS, NULL, sizeof(CK_OBJECT_CLASS)},
           59  +		{CKA_ID, NULL, 0}
           60  +	};
           61  +	CK_ATTRIBUTE attrTemplate[] = {
           62  +		{CKA_ID, NULL, 0}
           63  +	}, *currAttr;
           64  +	CK_ULONG currAttrIndex;
           65  +	CK_OBJECT_CLASS objectClassPrivateKey = CKO_PRIVATE_KEY;
           66  +
           67  +	chk_rv = cackey_chrome_init();
           68  +	if (chk_rv != CKR_OK) {
           69  +		return(0);
           70  +	}
           71  +
           72  +	chk_rv = moduleFunctionList->C_GetSlotList(FALSE, NULL, &numSlots);
           73  +	if (chk_rv != CKR_OK) {
           74  +		return(0);
           75  +	}
           76  +
           77  +	slots = malloc(sizeof(*slots) * numSlots);
           78  +
           79  +	chk_rv = moduleFunctionList->C_GetSlotList(FALSE, slots, &numSlots);
           80  +	if (chk_rv != CKR_OK) {
           81  +		return(0);
           82  +	}
           83  +
           84  +	searchTemplatePrivateKeys[0].pValue = &objectClassPrivateKey;
           85  +
           86  +	for (currSlot = 0; currSlot < numSlots; currSlot++) {
           87  +		chk_rv = moduleFunctionList->C_GetSlotInfo(slots[currSlot], &slotInfo);
           88  +		if (chk_rv != CKR_OK) {
           89  +			continue;
           90  +		}
           91  +
           92  +		if ((slotInfo.flags & CKF_TOKEN_PRESENT) != CKF_TOKEN_PRESENT) {
           93  +			continue;
           94  +		}
           95  +
           96  +		chk_rv = moduleFunctionList->C_OpenSession(slots[currSlot], CKF_SERIAL_SESSION, NULL, NULL, &hSession);
           97  +		if (chk_rv != CKR_OK) {
           98  +			continue;
           99  +		}
          100  +
          101  +		chk_rv = moduleFunctionList->C_FindObjectsInit(hSession, searchTemplatePrivateKeys, sizeof(searchTemplatePrivateKeys) / sizeof(searchTemplatePrivateKeys[0])); 
          102  +		if (chk_rv != CKR_OK) {
          103  +			moduleFunctionList->C_CloseSession(hSession);
          104  +
          105  +			continue;
          106  +		}
          107  +
          108  +		while (1) {
          109  +			chk_rv = moduleFunctionList->C_FindObjects(hSession, &hObject, 1, &ulObjectCount);
          110  +			if (chk_rv != CKR_OK) {
          111  +				break;
          112  +			}
          113  +
          114  +			if (ulObjectCount == 0) {
          115  +				break;
          116  +			}
          117  +
          118  +			if (ulObjectCount != 1) {
          119  +				break;
          120  +			}
          121  +
          122  +			for (currAttrIndex = 0; currAttrIndex < (sizeof(attrTemplate) / sizeof(attrTemplate[0])); currAttrIndex++) {
          123  +				currAttr = &attrTemplate[currAttrIndex];
          124  +
          125  +				currAttr->pValue = NULL;
          126  +				currAttr->ulValueLen = 0;
          127  +			}
          128  +
          129  +			chk_rv = C_GetAttributeValue(hSession, hObject, attrTemplate, sizeof(attrTemplate) / sizeof(attrTemplate[0]));
          130  +			if (chk_rv == CKR_ATTRIBUTE_TYPE_INVALID || chk_rv == CKR_ATTRIBUTE_SENSITIVE || chk_rv == CKR_BUFFER_TOO_SMALL) {
          131  +				chk_rv = CKR_OK;
          132  +			}
          133  +
          134  +			if (chk_rv != CKR_OK) {
          135  +				continue;
          136  +			}
          137  +
          138  +			for (currAttrIndex = 0; currAttrIndex < (sizeof(attrTemplate) / sizeof(attrTemplate[0])); currAttrIndex++) {
          139  +				currAttr = &attrTemplate[currAttrIndex];
          140  +
          141  +				if (currAttr->ulValueLen == 0) {
          142  +					continue;
          143  +				}
          144  +
          145  +				if (((CK_LONG) currAttr->ulValueLen) == ((CK_LONG) -1)) {
          146  +					continue;
          147  +				}
          148  +
          149  +				currAttr->pValue = malloc(currAttr->ulValueLen);
          150  +			}
          151  +
          152  +			chk_rv = C_GetAttributeValue(hSession, hObject, attrTemplate, sizeof(attrTemplate) / sizeof(attrTemplate[0]));
          153  +			if (chk_rv != CKR_OK) {
          154  +				continue;
          155  +			}
          156  +
          157  +		}
          158  +
          159  +		moduleFunctionList->C_FindObjectsFinal(hSession);
          160  +
          161  +		moduleFunctionList->C_CloseSession(hSession);
          162  +	}
          163  +
          164  +	return(0);
          165  +}
          166  +
          167  +#ifdef __cplusplus
     4    168   }
          169  +#endif

Added build/chrome/cackey-chrome.h version [3dcc1f6bc2].

            1  +#ifndef CACKEY_CHROME_CACKEY_H
            2  +#define CACKEY_CHROME_CACKEY_H 1
            3  +
            4  +#  ifdef __cplusplus
            5  +extern "C" {
            6  +#  endif
            7  +
            8  +#include <stddef.h>
            9  +
           10  +struct cackey_certificate {
           11  +	size_t certificate_len;
           12  +	unsigned char *certificate;
           13  +};
           14  +
           15  +int cackey_chrome_listCertificates(struct cackey_certificate **certificates);
           16  +
           17  +#  ifdef __cplusplus
           18  +}
           19  +#  endif
           20  +
           21  +#endif

Modified build/chrome/cackey.js from [5ad72ed1f7] to [1a209c8c6b].

cannot compute difference between binary files

Modified build/chrome/manifest.json from [11edb13438] to [ac9702d30b].

     1      1   {
     2      2   	"manifest_version": 2,
     3      3   	"name": "CACKey",
     4      4   	"version": "0.7.5.1",
     5      5   
     6         -	"background": {
     7         -		"scripts": ["cackey.js"],
     8         -		"persistent": false
            6  +	"app": {
            7  +		"background": {
            8  +			"scripts": [
            9  +				"google-pcsc.js",
           10  +				"cackey.js"
           11  +			],
           12  +			"persistent": false
           13  +		}
     9     14   	},
    10     15   
    11     16   	"permissions": [
    12     17   		"certificateProvider",
    13     18   		"usb"
    14     19   	]
    15     20   }