| 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 #include "net/cert/internal/cert_error_params.h" | 8 #include "net/cert/internal/cert_error_params.h" |
| 9 #include "net/cert/internal/cert_errors.h" | 9 #include "net/cert/internal/cert_errors.h" |
| 10 #include "third_party/boringssl/src/include/openssl/obj.h" | 10 #include "third_party/boringssl/src/include/openssl/obj.h" |
| 11 | 11 |
| 12 namespace net { | 12 namespace net { |
| 13 | 13 |
| 14 DEFINE_CERT_ERROR_ID(kRsaModulusTooSmall, "RSA modulus too small"); |
| 15 |
| 14 namespace { | 16 namespace { |
| 15 | 17 |
| 16 DEFINE_CERT_ERROR_ID(kUnacceptableCurveForEcdsa, | 18 DEFINE_CERT_ERROR_ID(kUnacceptableCurveForEcdsa, |
| 17 "Only P-256, P-384, P-521 are supported for ECDSA"); | 19 "Only P-256, P-384, P-521 are supported for ECDSA"); |
| 18 DEFINE_CERT_ERROR_ID(kRsaModulusTooSmall, "RSA modulus too small"); | |
| 19 | 20 |
| 20 bool IsModulusSizeGreaterOrEqual(size_t modulus_length_bits, | 21 bool IsModulusSizeGreaterOrEqual(size_t modulus_length_bits, |
| 21 size_t min_length_bits, | 22 size_t min_length_bits, |
| 22 CertErrors* errors) { | 23 CertErrors* errors) { |
| 23 if (modulus_length_bits < min_length_bits) { | 24 if (modulus_length_bits < min_length_bits) { |
| 24 errors->AddError(kRsaModulusTooSmall, | 25 errors->AddError(kRsaModulusTooSmall, |
| 25 CreateCertErrorParams2SizeT("actual", modulus_length_bits, | 26 CreateCertErrorParams2SizeT("actual", modulus_length_bits, |
| 26 "minimum", min_length_bits)); | 27 "minimum", min_length_bits)); |
| 27 return false; | 28 return false; |
| 28 } | 29 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 : min_rsa_modulus_length_bits_(min_rsa_modulus_length_bits) {} | 101 : min_rsa_modulus_length_bits_(min_rsa_modulus_length_bits) {} |
| 101 | 102 |
| 102 bool SimpleSignaturePolicy::IsAcceptableModulusLengthForRsa( | 103 bool SimpleSignaturePolicy::IsAcceptableModulusLengthForRsa( |
| 103 size_t modulus_length_bits, | 104 size_t modulus_length_bits, |
| 104 CertErrors* errors) const { | 105 CertErrors* errors) const { |
| 105 return IsModulusSizeGreaterOrEqual(modulus_length_bits, | 106 return IsModulusSizeGreaterOrEqual(modulus_length_bits, |
| 106 min_rsa_modulus_length_bits_, errors); | 107 min_rsa_modulus_length_bits_, errors); |
| 107 } | 108 } |
| 108 | 109 |
| 109 } // namespace net | 110 } // namespace net |
| OLD | NEW |