OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 crtn = CSSM_SignDataInit(result->sig_handle_); | 31 crtn = CSSM_SignDataInit(result->sig_handle_); |
32 if (crtn) { | 32 if (crtn) { |
33 NOTREACHED(); | 33 NOTREACHED(); |
34 return NULL; | 34 return NULL; |
35 } | 35 } |
36 | 36 |
37 return result.release(); | 37 return result.release(); |
38 } | 38 } |
39 | 39 |
40 SignatureCreator::SignatureCreator() : sig_handle_(0) { | 40 SignatureCreator::SignatureCreator() : key_(NULL), sig_handle_(0) { |
41 EnsureCSSMInit(); | 41 EnsureCSSMInit(); |
42 } | 42 } |
43 | 43 |
44 SignatureCreator::~SignatureCreator() { | 44 SignatureCreator::~SignatureCreator() { |
45 CSSM_RETURN crtn; | 45 CSSM_RETURN crtn; |
46 if (sig_handle_) { | 46 if (sig_handle_) { |
47 crtn = CSSM_DeleteContext(sig_handle_); | 47 crtn = CSSM_DeleteContext(sig_handle_); |
48 DCHECK_EQ(CSSM_OK, crtn); | 48 DCHECK_EQ(CSSM_OK, crtn); |
49 } | 49 } |
50 } | 50 } |
(...skipping 14 matching lines...) Expand all Loading... |
65 if (crtn) { | 65 if (crtn) { |
66 NOTREACHED(); | 66 NOTREACHED(); |
67 return false; | 67 return false; |
68 } | 68 } |
69 | 69 |
70 signature->assign(sig->Data, sig->Data + sig->Length); | 70 signature->assign(sig->Data, sig->Data + sig->Length); |
71 return true; | 71 return true; |
72 } | 72 } |
73 | 73 |
74 } // namespace crypto | 74 } // namespace crypto |
OLD | NEW |