| 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 "net/base/dnssec_keyset.h" | 5 #include "net/base/dnssec_keyset.h" |
| 6 | 6 |
| 7 #include <cryptohi.h> | 7 #include <cryptohi.h> |
| 8 #include <cryptoht.h> | 8 #include <cryptoht.h> |
| 9 #include <keyhi.h> | 9 #include <keyhi.h> |
| 10 | 10 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 SECKEY_DestroyPublicKey(pub_key); | 219 SECKEY_DestroyPublicKey(pub_key); |
| 220 return false; | 220 return false; |
| 221 } | 221 } |
| 222 | 222 |
| 223 SECItem sig_alg_der; | 223 SECItem sig_alg_der; |
| 224 sig_alg_der.type = siBuffer; | 224 sig_alg_der.type = siBuffer; |
| 225 sig_alg_der.data = (uint8*) signature_algorithm.data(); | 225 sig_alg_der.data = (uint8*) signature_algorithm.data(); |
| 226 sig_alg_der.len = signature_algorithm.size(); | 226 sig_alg_der.len = signature_algorithm.size(); |
| 227 SECAlgorithmID sig_alg_id; | 227 SECAlgorithmID sig_alg_id; |
| 228 SECStatus rv; | 228 SECStatus rv; |
| 229 rv = SEC_QuickDERDecodeItem(arena, &sig_alg_id, SECOID_AlgorithmIDTemplate, | 229 rv = SEC_QuickDERDecodeItem(arena, &sig_alg_id, |
| 230 SEC_ASN1_GET(SECOID_AlgorithmIDTemplate), |
| 230 &sig_alg_der); | 231 &sig_alg_der); |
| 231 if (rv != SECSuccess) { | 232 if (rv != SECSuccess) { |
| 232 SECKEY_DestroyPublicKey(pub_key); | 233 SECKEY_DestroyPublicKey(pub_key); |
| 233 PORT_FreeArena(arena, PR_TRUE); | 234 PORT_FreeArena(arena, PR_TRUE); |
| 234 return false; | 235 return false; |
| 235 } | 236 } |
| 236 | 237 |
| 237 SECItem sig; | 238 SECItem sig; |
| 238 sig.type = siBuffer; | 239 sig.type = siBuffer; |
| 239 sig.data = (uint8*) signature.data(); | 240 sig.data = (uint8*) signature.data(); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 out[j++] = exp >> (8 * i); | 452 out[j++] = exp >> (8 * i); |
| 452 length--; | 453 length--; |
| 453 } | 454 } |
| 454 | 455 |
| 455 DCHECK_EQ(0u, length); | 456 DCHECK_EQ(0u, length); |
| 456 | 457 |
| 457 return std::string(reinterpret_cast<char*>(out.get()), j); | 458 return std::string(reinterpret_cast<char*>(out.get()), j); |
| 458 } | 459 } |
| 459 | 460 |
| 460 } // namespace net | 461 } // namespace net |
| OLD | NEW |