| 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/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 Loading... |
| 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 |
| OLD | NEW |