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

Side by Side Diff: crypto/signature_creator_nss.cc

Issue 20794003: Fix a bug where packing an extension with bad private key causes crash. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Slight wording change to the pack_extension_unittest. Created 7 years, 4 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 unified diff | Download patch
« no previous file with comments | « chrome/test/data/extensions/bad_private_key/manifest.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "crypto/signature_creator.h" 5 #include "crypto/signature_creator.h"
6 6
7 #include <cryptohi.h> 7 #include <cryptohi.h>
8 #include <keyhi.h> 8 #include <keyhi.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 10
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 return false; 77 return false;
78 } 78 }
79 79
80 return true; 80 return true;
81 } 81 }
82 82
83 bool SignatureCreator::Final(std::vector<uint8>* signature) { 83 bool SignatureCreator::Final(std::vector<uint8>* signature) {
84 SECItem signature_item; 84 SECItem signature_item;
85 SECStatus rv = SGN_End(sign_context_, &signature_item); 85 SECStatus rv = SGN_End(sign_context_, &signature_item);
86 if (rv != SECSuccess) { 86 if (rv != SECSuccess) {
87 NOTREACHED();
88 return false; 87 return false;
89 } 88 }
90 signature->assign(signature_item.data, 89 signature->assign(signature_item.data,
91 signature_item.data + signature_item.len); 90 signature_item.data + signature_item.len);
92 SECITEM_FreeItem(&signature_item, PR_FALSE); 91 SECITEM_FreeItem(&signature_item, PR_FALSE);
93 return true; 92 return true;
94 } 93 }
95 94
96 SignatureCreator::SignatureCreator() 95 SignatureCreator::SignatureCreator()
97 : key_(NULL), 96 : key_(NULL),
98 sign_context_(NULL) { 97 sign_context_(NULL) {
99 EnsureNSSInit(); 98 EnsureNSSInit();
100 } 99 }
101 100
102 } // namespace crypto 101 } // namespace crypto
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/bad_private_key/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698