Check-in [b7dc336d0f]
Overview
Comment:ChromeOS: Updated to pass messages to the PCSC-NACL plugin if they do not belong to us
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:b7dc336d0f39e698bd922208afba857a8e5383c2
User & Date: rkeene on 2016-02-11 18:33:00
Original Comment: Updated to pass messages to the PCSC-NACL plugin if they do not belong to us
Other Links: manifest | tags
Context
2016-02-12
03:47
Renamed our C_Login() function with a mutex arg to be a less annoying name check-in: bd977f41d5 user: rkeene tags: trunk
2016-02-11
18:33
ChromeOS: Updated to pass messages to the PCSC-NACL plugin if they do not belong to us check-in: b7dc336d0f user: rkeene tags: trunk
18:32
ChromeOS: Remove USB requirement -- we talk to the Smartcard Manager App for this check-in: 35a258e3b8 user: rkeene tags: trunk
Changes

Modified build/chrome/build-deps from [8ff9a8d29a] to [417516a8f7].

   235    235   #ifndef PCSC_NACL_H
   236    236   #define PCSC_NACL_H 1
   237    237   #ifdef __cplusplus
   238    238   #include <ppapi/cpp/core.h>
   239    239   #include <ppapi/cpp/instance.h>
   240    240   
   241    241   void pcscNaClInit(pp::Instance *instance, pp::Core *core);
          242  +bool pcscNaClHandleMessage(const pp::Var &message);
          243  +
   242    244   #endif
   243    245   #endif
   244    246   _EOF_
   245    247   
   246    248   		# Copy out JavaScript files for later use
   247    249   		mkdir "${instdir}/js" || exit 1
   248    250   		cp common-utils/*.js "${instdir}/js" || exit 1
................................................................................
   298    300   _EOF_
   299    301   
   300    302   		## Create initialization procedure, since it lacks one
   301    303   		cat << \_EOF_ > third_party/pcsc-lite/client-side/pcsc_nacl_init.cc
   302    304   #include <ppapi/cpp/core.h>
   303    305   #include <ppapi/cpp/instance.h>
   304    306   
          307  +#include <unistd.h>
   305    308   #include <stdio.h>
   306    309   
   307    310   #include "pcsc_nacl_global.h"
   308    311   #include "dom_requests_manager.h"
   309    312   #include "pcsc_nacl.h"
          313  +
          314  +static DomRequestsManager *pcscNaClDRM = NULL;
   310    315   
   311    316   void pcscNaClInit(pp::Instance *instance, pp::Core *core) {
   312    317   	DomRequestsManager::PpDelegateImpl *drmDelegateImpl;
   313    318   	PcscNacl *pcsc_nacl;
   314    319   
   315    320   	fprintf(stderr, "Called pcscNaClInit()\n");
   316    321   
   317    322   	drmDelegateImpl = new DomRequestsManager::PpDelegateImpl(instance, core);
   318    323   
   319         -	pcsc_nacl = new PcscNacl(new DomRequestsManager("pcsc-nacl", drmDelegateImpl), "khpfeaanjngmcnplbdlpegiifgpfgdco", "CACKey");
          324  +	pcscNaClDRM = new DomRequestsManager("pcsc-nacl", drmDelegateImpl);
          325  +
          326  +	pcsc_nacl = new PcscNacl(pcscNaClDRM, "khpfeaanjngmcnplbdlpegiifgpfgdco", "CACKey");
   320    327   
   321    328   	fprintf(stderr, "New PcscNacl object = %p\n", pcsc_nacl);
   322    329   
   323    330   	if (!pcsc_nacl->Initialize()) {
   324    331   		fprintf(stderr, "PcscNacl->Initialize() failed !");
   325    332   
   326    333   		return;
................................................................................
   330    337   
   331    338   	fprintf(stderr, "Global instance set to %p\n", pcsc_nacl);
   332    339   
   333    340   	fprintf(stderr, "Returning.\n");
   334    341   
   335    342   	return;
   336    343   }
          344  +
          345  +bool pcscNaClHandleMessage(const pp::Var &message) {
          346  +	return(pcscNaClDRM->HandleMessage(message));
          347  +}
   337    348   _EOF_
   338    349   
   339    350   		## Make it
   340    351   		make -C third_party/pcsc-lite/client-side || exit 1
   341    352   
   342    353   		# Install the built libpcsc
   343    354   		mkdir -p "${instdir}/lib" || exit 1

Modified build/chrome/cackey-chrome-init.cc from [ce1d3f96e0] to [9641a2fef0].

    87     87   			}
    88     88   
    89     89   			/*
    90     90   			 * Send the reply back to the requestor, hopefully they are waiting for this message
    91     91   			 */
    92     92   			PostMessage(*reply);
    93     93   
           94  +			delete message;
           95  +
    94     96   			return;
    95     97   		}
    96     98   
    97     99   		virtual void HandleMessage(const pp::Var& messagePlain) {
    98    100   			pp::VarDictionary *message;
    99    101   			pp::Var target;
   100    102   
   101    103   			/*
   102    104   			 * The incoming message must be a dictionary
   103    105   			 */
   104    106   			if (!messagePlain.is_dictionary()) {
          107  +				pcscNaClHandleMessage(messagePlain);
          108  +
   105    109   				return;
   106    110   			}
   107    111   
   108    112   			/*
   109    113   			 * Process the appropriate command from the incoming message
   110    114   			 */
   111    115   			message = new pp::VarDictionary(messagePlain);
   112    116   
   113    117   			/*
   114    118   			 * Verify that this message is destined for us
   115    119   			 */
   116    120   			if (!message->HasKey("target")) {
          121  +				delete message;
          122  +
          123  +				pcscNaClHandleMessage(messagePlain);
          124  +
   117    125   				return;
   118    126   			}
   119    127   
   120    128   			target = message->Get("target");
   121    129   			if (target.AsString() != "cackey") {
          130  +				delete message;
          131  +
          132  +				pcscNaClHandleMessage(messagePlain);
          133  +
   122    134   				return;
   123    135   			}
   124    136   
   125    137   			/*
   126    138   			 * Determine what we are being asked to do
   127    139   			 */
   128    140   			if (!message->HasKey("command")) {
          141  +				delete message;
          142  +
          143  +				pcscNaClHandleMessage(messagePlain);
          144  +
   129    145   				return;
   130    146   			}
   131    147   
   132    148   			/*
   133    149   			 * Process the request in another thread
   134    150   			 */
   135    151   			std::thread(&CACKeyInstance::HandleMessageThread, this, message).detach();

Modified build/chrome/cackey.js from [94b1497683] to [3365edf925].

cannot compute difference between binary files