Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Unified Diff: net/third_party/mozilla_security_manager/nsKeygenHandler.cpp

Issue 2866011: Don't need to copy the challenge data before calling DER_Encode because... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Add a necessary typecast. Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/third_party/mozilla_security_manager/nsKeygenHandler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/third_party/mozilla_security_manager/nsKeygenHandler.cpp
===================================================================
--- net/third_party/mozilla_security_manager/nsKeygenHandler.cpp (revision 50259)
+++ net/third_party/mozilla_security_manager/nsKeygenHandler.cpp (working copy)
@@ -123,7 +123,6 @@
SECItem signedItem;
CERTPublicKeyAndChallenge pkac;
void *keyGenParams;
- pkac.challenge.data = NULL;
bool isSuccess = true; // Set to false as soon as a step fails.
std::string result_blob; // the result.
@@ -208,13 +207,9 @@
// Set up the PublicKeyAndChallenge data structure, then DER encode it.
pkac.spki = spkiItem;
+ pkac.challenge.type = siBuffer;
pkac.challenge.len = challenge.length();
- pkac.challenge.data = (unsigned char *)strdup(challenge.c_str());
- if (!pkac.challenge.data) {
- LOG(ERROR) << "Out of memory while making a copy of challenge data";
- isSuccess = false;
- goto failure;
- }
+ pkac.challenge.data = (unsigned char *)challenge.data();
wtc 2010/06/18 18:26:27 DER_Encode does not use the |type| field. I'm ini
sec_rv = DER_Encode(arena, &pkacItem, CERTPublicKeyAndChallengeTemplate,
&pkac);
if (SECSuccess != sec_rv) {
@@ -275,9 +270,6 @@
if (slot != NULL) {
PK11_FreeSlot(slot);
}
- if (pkac.challenge.data) {
- free(pkac.challenge.data);
- }
return (isSuccess ? result_blob : std::string());
}
« no previous file with comments | « net/third_party/mozilla_security_manager/nsKeygenHandler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698