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

Side by Side Diff: crypto/signature_creator_nss.cc

Issue 18332012: Reland r209278 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « crypto/nss_util.cc ('k') | net/cert/cert_verify_proc_nss.cc » ('j') | 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 26 matching lines...) Expand all
37 SECStatus rv = SGN_Begin(result->sign_context_); 37 SECStatus rv = SGN_Begin(result->sign_context_);
38 if (rv != SECSuccess) { 38 if (rv != SECSuccess) {
39 NOTREACHED(); 39 NOTREACHED();
40 return NULL; 40 return NULL;
41 } 41 }
42 42
43 return result.release(); 43 return result.release();
44 } 44 }
45 45
46 bool SignatureCreator::Update(const uint8* data_part, int data_part_len) { 46 bool SignatureCreator::Update(const uint8* data_part, int data_part_len) {
47 // TODO(wtc): Remove this const_cast when we require NSS 3.12.5. 47 SECStatus rv = SGN_Update(sign_context_, data_part, data_part_len);
48 // See NSS bug https://bugzilla.mozilla.org/show_bug.cgi?id=518255
49 SECStatus rv = SGN_Update(sign_context_,
50 const_cast<unsigned char*>(data_part),
51 data_part_len);
52 if (rv != SECSuccess) { 48 if (rv != SECSuccess) {
53 NOTREACHED(); 49 NOTREACHED();
54 return false; 50 return false;
55 } 51 }
56 52
57 return true; 53 return true;
58 } 54 }
59 55
60 bool SignatureCreator::Final(std::vector<uint8>* signature) { 56 bool SignatureCreator::Final(std::vector<uint8>* signature) {
61 SECItem signature_item; 57 SECItem signature_item;
62 SECStatus rv = SGN_End(sign_context_, &signature_item); 58 SECStatus rv = SGN_End(sign_context_, &signature_item);
63 if (rv != SECSuccess) { 59 if (rv != SECSuccess) {
64 NOTREACHED(); 60 NOTREACHED();
65 return false; 61 return false;
66 } 62 }
67 signature->assign(signature_item.data, 63 signature->assign(signature_item.data,
68 signature_item.data + signature_item.len); 64 signature_item.data + signature_item.len);
69 SECITEM_FreeItem(&signature_item, PR_FALSE); 65 SECITEM_FreeItem(&signature_item, PR_FALSE);
70 return true; 66 return true;
71 } 67 }
72 68
73 SignatureCreator::SignatureCreator() 69 SignatureCreator::SignatureCreator()
74 : key_(NULL), 70 : key_(NULL),
75 sign_context_(NULL) { 71 sign_context_(NULL) {
76 EnsureNSSInit(); 72 EnsureNSSInit();
77 } 73 }
78 74
79 } // namespace crypto 75 } // namespace crypto
OLDNEW
« no previous file with comments | « crypto/nss_util.cc ('k') | net/cert/cert_verify_proc_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698