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_verifier.h" | 5 #include "crypto/signature_verifier.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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 SECKEY_DestroyPublicKey(public_key); | 47 SECKEY_DestroyPublicKey(public_key); |
48 return false; | 48 return false; |
49 } | 49 } |
50 | 50 |
51 SECItem sig_alg_der; | 51 SECItem sig_alg_der; |
52 sig_alg_der.type = siBuffer; | 52 sig_alg_der.type = siBuffer; |
53 sig_alg_der.data = const_cast<uint8*>(signature_algorithm); | 53 sig_alg_der.data = const_cast<uint8*>(signature_algorithm); |
54 sig_alg_der.len = signature_algorithm_len; | 54 sig_alg_der.len = signature_algorithm_len; |
55 SECAlgorithmID sig_alg_id; | 55 SECAlgorithmID sig_alg_id; |
56 SECStatus rv; | 56 SECStatus rv; |
57 rv = SEC_QuickDERDecodeItem(arena, &sig_alg_id, SECOID_AlgorithmIDTemplate, | 57 rv = SEC_QuickDERDecodeItem(arena, &sig_alg_id, |
| 58 SEC_ASN1_GET(SECOID_AlgorithmIDTemplate), |
58 &sig_alg_der); | 59 &sig_alg_der); |
59 if (rv != SECSuccess) { | 60 if (rv != SECSuccess) { |
60 SECKEY_DestroyPublicKey(public_key); | 61 SECKEY_DestroyPublicKey(public_key); |
61 PORT_FreeArena(arena, PR_TRUE); | 62 PORT_FreeArena(arena, PR_TRUE); |
62 return false; | 63 return false; |
63 } | 64 } |
64 | 65 |
65 SECItem sig; | 66 SECItem sig; |
66 sig.type = siBuffer; | 67 sig.type = siBuffer; |
67 sig.data = const_cast<uint8*>(signature); | 68 sig.data = const_cast<uint8*>(signature); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 105 |
105 void SignatureVerifier::Reset() { | 106 void SignatureVerifier::Reset() { |
106 if (vfy_context_) { | 107 if (vfy_context_) { |
107 VFY_DestroyContext(vfy_context_, PR_TRUE); | 108 VFY_DestroyContext(vfy_context_, PR_TRUE); |
108 vfy_context_ = NULL; | 109 vfy_context_ = NULL; |
109 } | 110 } |
110 signature_.clear(); | 111 signature_.clear(); |
111 } | 112 } |
112 | 113 |
113 } // namespace crypto | 114 } // namespace crypto |
OLD | NEW |