Overview
Comment: | ChromeOS: Updated to pass original message back correctly |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: | 3783f79015b8cf7c93ed240588da0d1f07124dec |
User & Date: | rkeene on 2016-02-26 16:35:42 |
Original Comment: | Updated to pass original message back correctly |
Other Links: | manifest | tags |
Context
2016-02-26
| ||
18:20 | ChromeOS: Fixed issue with including signed data in the reply check-in: c27bb81788 user: rkeene tags: trunk | |
16:35 | ChromeOS: Updated to pass original message back correctly check-in: 3783f79015 user: rkeene tags: trunk | |
16:23 | ChromeOS: Updated to support raw PKCS#1 message signing using the interface Chrome provides it check-in: ea7a58ef60 user: rkeene tags: trunk | |
Changes
Modified build/chrome/cackey-chrome-init.cc from [84155dbf3d] to [cd9d30207a].
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 ... 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 ... 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 ... 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
public: explicit CACKeyInstance(PP_Instance instance, pp::Core *core) : pp::Instance(instance) { corePointer = core; } virtual ~CACKeyInstance() {} virtual void HandleMessageThread(pp::VarDictionary *message) { cackey_chrome_returnType signRet; char *pinPrompt = NULL; const char *pin; const char *smartcardManagerAppId = NULL; unsigned char buffer[8192]; struct cackey_certificate *certificates, incomingCertificateCACKey; pp::VarDictionary *reply; pp::VarArray certificatesPPArray; pp::VarArrayBuffer *certificateContents, *incomingCertificateContents, *incomingData, *outgoingData; pp::Var command; const pp::Var *messageAsVar = NULL, *outgoingDataAsVar = NULL; int numCertificates, i; unsigned long outgoingDataLength; /* * Extract the command */ command = message->Get("command"); ................................................................................ outgoingDataAsVar = new pp::Var(outgoingData->pp_var()); delete outgoingData; reply->Set("status", "success"); reply->Set("signedData", outgoingDataAsVar); delete outgoingDataAsVar; break; case CACKEY_CHROME_ERROR: reply->Set("status", "error"); reply->Set("error", "Unable to sign data"); break; case CACKEY_CHROME_NEEDLOGIN: case CACKEY_CHROME_NEEDPROTECTEDLOGIN: messageAsVar = new pp::Var(message->pp_var()); reply->Set("status", "retry"); reply->Set("originalrequest", messageAsVar); reply->Set("pinprompt", pinPrompt); delete messageAsVar; break; } if (pinPrompt != NULL) { free(pinPrompt); } } ................................................................................ * Send the reply back to the requestor, hopefully they are waiting for this message */ PostMessage(*reply); delete reply; delete message; return; } virtual void HandleMessage(const pp::Var& messagePlain) { pp::VarDictionary *message; pp::Var target; /* * The incoming message must be a dictionary */ if (!messagePlain.is_dictionary()) { pcscNaClHandleMessage(messagePlain); ................................................................................ return; } /* * Process the request in another thread */ std::thread(&CACKeyInstance::HandleMessageThread, this, message).detach(); return; } }; class CACKeyModule : public pp::Module { public: |
| | < < < < | < < > > > > > > > > | |
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 ... 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 ... 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 ... 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
public: explicit CACKeyInstance(PP_Instance instance, pp::Core *core) : pp::Instance(instance) { corePointer = core; } virtual ~CACKeyInstance() {} virtual void HandleMessageThread(pp::VarDictionary *message, pp::Var *messagePlain) { cackey_chrome_returnType signRet; char *pinPrompt = NULL; const char *pin; const char *smartcardManagerAppId = NULL; unsigned char buffer[8192]; struct cackey_certificate *certificates, incomingCertificateCACKey; pp::VarDictionary *reply; pp::VarArray certificatesPPArray; pp::VarArrayBuffer *certificateContents, *incomingCertificateContents, *incomingData, *outgoingData; pp::Var command; const pp::Var *outgoingDataAsVar = NULL; int numCertificates, i; unsigned long outgoingDataLength; /* * Extract the command */ command = message->Get("command"); ................................................................................ outgoingDataAsVar = new pp::Var(outgoingData->pp_var()); delete outgoingData; reply->Set("status", "success"); reply->Set("signedData", outgoingDataAsVar); break; case CACKEY_CHROME_ERROR: reply->Set("status", "error"); reply->Set("error", "Unable to sign data"); break; case CACKEY_CHROME_NEEDLOGIN: case CACKEY_CHROME_NEEDPROTECTEDLOGIN: reply->Set("status", "retry"); reply->Set("originalrequest", *messagePlain); reply->Set("pinprompt", pinPrompt); break; } if (pinPrompt != NULL) { free(pinPrompt); } } ................................................................................ * Send the reply back to the requestor, hopefully they are waiting for this message */ PostMessage(*reply); delete reply; delete message; delete messagePlain; if (outgoingDataAsVar) { delete outgoingDataAsVar; } return; } virtual void HandleMessage(const pp::Var& messagePlain) { pp::VarDictionary *message; pp::Var *messagePlainCopy; pp::Var target; /* * The incoming message must be a dictionary */ if (!messagePlain.is_dictionary()) { pcscNaClHandleMessage(messagePlain); ................................................................................ return; } /* * Process the request in another thread */ messagePlainCopy = new pp::Var(messagePlain); std::thread(&CACKeyInstance::HandleMessageThread, this, message, messagePlainCopy).detach(); return; } }; class CACKeyModule : public pp::Module { public: |