OLD | NEW |
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/ec_signature_creator_impl.h" | 5 #include "crypto/ec_signature_creator_impl.h" |
6 | 6 |
7 #include <cryptohi.h> | 7 #include <cryptohi.h> |
8 #include <pk11pub.h> | 8 #include <pk11pub.h> |
9 #include <secerr.h> | 9 #include <secerr.h> |
10 #include <sechash.h> | 10 #include <sechash.h> |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 // DER encode the signature. | 55 // DER encode the signature. |
56 return DSAU_EncodeDerSigWithLen(result, &sig, sig.len); | 56 return DSAU_EncodeDerSigWithLen(result, &sig, sig.len); |
57 } | 57 } |
58 | 58 |
59 } // namespace | 59 } // namespace |
60 | 60 |
61 ECSignatureCreatorImpl::ECSignatureCreatorImpl(ECPrivateKey* key) | 61 ECSignatureCreatorImpl::ECSignatureCreatorImpl(ECPrivateKey* key) |
62 : key_(key), | 62 : key_(key), |
63 signature_len_(0) { | 63 signature_len_(0) { |
| 64 LOG(ERROR) << "HIIIIIIIIIIIIIIIIIIIIIIIIIII"; |
64 EnsureNSSInit(); | 65 EnsureNSSInit(); |
65 } | 66 } |
66 | 67 |
67 ECSignatureCreatorImpl::~ECSignatureCreatorImpl() {} | 68 ECSignatureCreatorImpl::~ECSignatureCreatorImpl() {} |
68 | 69 |
69 bool ECSignatureCreatorImpl::Sign(const uint8* data, | 70 bool ECSignatureCreatorImpl::Sign(const uint8* data, |
70 int data_len, | 71 int data_len, |
71 std::vector<uint8>* signature) { | 72 std::vector<uint8>* signature) { |
72 // Data to be signed | 73 // Data to be signed |
73 SECItem secret; | 74 SECItem secret; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 106 |
106 SECItem* raw_sig = DSAU_DecodeDerSigToLen(&der_sig_item, signature_len_); | 107 SECItem* raw_sig = DSAU_DecodeDerSigToLen(&der_sig_item, signature_len_); |
107 if (!raw_sig) | 108 if (!raw_sig) |
108 return false; | 109 return false; |
109 out_raw_sig->assign(raw_sig->data, raw_sig->data + raw_sig->len); | 110 out_raw_sig->assign(raw_sig->data, raw_sig->data + raw_sig->len); |
110 SECITEM_FreeItem(raw_sig, PR_TRUE /* free SECItem structure itself. */); | 111 SECITEM_FreeItem(raw_sig, PR_TRUE /* free SECItem structure itself. */); |
111 return true; | 112 return true; |
112 } | 113 } |
113 | 114 |
114 } // namespace crypto | 115 } // namespace crypto |
OLD | NEW |