| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/cert/internal/verify_signed_data.h" | 5 #include "net/cert/internal/verify_signed_data.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | |
| 8 #include "net/der/parse_values.h" | |
| 9 | |
| 10 // TODO(eroman): There is no intention to implement this for non-OpenSSL. Remove | |
| 11 // this branch once the migration is complete. This could have been done as a | |
| 12 // conditional file (_openssl.cc) in the build file instead, but that is likely | |
| 13 // not worth the effort at this point. | |
| 14 | |
| 15 #if !defined(USE_OPENSSL) | |
| 16 | |
| 17 namespace net { | |
| 18 | |
| 19 bool VerifySignedData(const SignatureAlgorithm& signature_algorithm, | |
| 20 const der::Input& signed_data, | |
| 21 const der::BitString& signature_value, | |
| 22 const der::Input& public_key, | |
| 23 const SignaturePolicy* policy) { | |
| 24 NOTIMPLEMENTED(); | |
| 25 return false; | |
| 26 } | |
| 27 | |
| 28 } // namespace net | |
| 29 | |
| 30 #else | |
| 31 | |
| 32 #include <openssl/bytestring.h> | 7 #include <openssl/bytestring.h> |
| 33 #include <openssl/digest.h> | 8 #include <openssl/digest.h> |
| 34 #include <openssl/ec.h> | 9 #include <openssl/ec.h> |
| 35 #include <openssl/ec_key.h> | 10 #include <openssl/ec_key.h> |
| 36 #include <openssl/evp.h> | 11 #include <openssl/evp.h> |
| 37 #include <openssl/rsa.h> | 12 #include <openssl/rsa.h> |
| 38 | 13 |
| 39 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/logging.h" |
| 40 #include "crypto/openssl_util.h" | 16 #include "crypto/openssl_util.h" |
| 41 #include "crypto/scoped_openssl_types.h" | 17 #include "crypto/scoped_openssl_types.h" |
| 42 #include "net/cert/internal/signature_algorithm.h" | 18 #include "net/cert/internal/signature_algorithm.h" |
| 43 #include "net/cert/internal/signature_policy.h" | 19 #include "net/cert/internal/signature_policy.h" |
| 44 #include "net/der/input.h" | 20 #include "net/der/input.h" |
| 21 #include "net/der/parse_values.h" |
| 45 #include "net/der/parser.h" | 22 #include "net/der/parser.h" |
| 46 | 23 |
| 47 namespace net { | 24 namespace net { |
| 48 | 25 |
| 49 namespace { | 26 namespace { |
| 50 | 27 |
| 51 // Converts a DigestAlgorithm to an equivalent EVP_MD*. | 28 // Converts a DigestAlgorithm to an equivalent EVP_MD*. |
| 52 WARN_UNUSED_RESULT bool GetDigest(DigestAlgorithm digest, const EVP_MD** out) { | 29 WARN_UNUSED_RESULT bool GetDigest(DigestAlgorithm digest, const EVP_MD** out) { |
| 53 *out = nullptr; | 30 *out = nullptr; |
| 54 | 31 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 if (!ParseEcKeyFromSpki(public_key_spki, &public_key, policy)) | 282 if (!ParseEcKeyFromSpki(public_key_spki, &public_key, policy)) |
| 306 return false; | 283 return false; |
| 307 break; | 284 break; |
| 308 } | 285 } |
| 309 | 286 |
| 310 return DoVerify(signature_algorithm, signed_data, signature_value, | 287 return DoVerify(signature_algorithm, signed_data, signature_value, |
| 311 public_key.get()); | 288 public_key.get()); |
| 312 } | 289 } |
| 313 | 290 |
| 314 } // namespace net | 291 } // namespace net |
| 315 | |
| 316 #endif | |
| OLD | NEW |