| 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/signature_policy.h" | 5 #include "net/cert/internal/signature_policy.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 #if defined(USE_OPENSSL) | |
| 10 #include <openssl/obj.h> | 9 #include <openssl/obj.h> |
| 11 #endif | |
| 12 | 10 |
| 13 namespace net { | 11 namespace net { |
| 14 | 12 |
| 15 bool SignaturePolicy::IsAcceptableSignatureAlgorithm( | 13 bool SignaturePolicy::IsAcceptableSignatureAlgorithm( |
| 16 const SignatureAlgorithm& algorithm) const { | 14 const SignatureAlgorithm& algorithm) const { |
| 17 return true; | 15 return true; |
| 18 } | 16 } |
| 19 | 17 |
| 20 bool SignaturePolicy::IsAcceptableCurveForEcdsa(int curve_nid) const { | 18 bool SignaturePolicy::IsAcceptableCurveForEcdsa(int curve_nid) const { |
| 21 #if defined(USE_OPENSSL) | |
| 22 switch (curve_nid) { | 19 switch (curve_nid) { |
| 23 case NID_X9_62_prime256v1: | 20 case NID_X9_62_prime256v1: |
| 24 case NID_secp384r1: | 21 case NID_secp384r1: |
| 25 case NID_secp521r1: | 22 case NID_secp521r1: |
| 26 return true; | 23 return true; |
| 27 } | 24 } |
| 28 #endif | |
| 29 return false; | 25 return false; |
| 30 } | 26 } |
| 31 | 27 |
| 32 bool SignaturePolicy::IsAcceptableModulusLengthForRsa( | 28 bool SignaturePolicy::IsAcceptableModulusLengthForRsa( |
| 33 size_t modulus_length_bits) const { | 29 size_t modulus_length_bits) const { |
| 34 return modulus_length_bits >= 2048; | 30 return modulus_length_bits >= 2048; |
| 35 } | 31 } |
| 36 | 32 |
| 37 SimpleSignaturePolicy::SimpleSignaturePolicy(size_t min_rsa_modulus_length_bits) | 33 SimpleSignaturePolicy::SimpleSignaturePolicy(size_t min_rsa_modulus_length_bits) |
| 38 : min_rsa_modulus_length_bits_(min_rsa_modulus_length_bits) {} | 34 : min_rsa_modulus_length_bits_(min_rsa_modulus_length_bits) {} |
| 39 | 35 |
| 40 bool SimpleSignaturePolicy::IsAcceptableModulusLengthForRsa( | 36 bool SimpleSignaturePolicy::IsAcceptableModulusLengthForRsa( |
| 41 size_t modulus_length_bits) const { | 37 size_t modulus_length_bits) const { |
| 42 return modulus_length_bits >= min_rsa_modulus_length_bits_; | 38 return modulus_length_bits >= min_rsa_modulus_length_bits_; |
| 43 } | 39 } |
| 44 | 40 |
| 45 } // namespace net | 41 } // namespace net |
| OLD | NEW |