Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: net/cert/cert_verify_proc.cc

Issue 2610903003: [refactor] Extract the CertVerifyResult assignment of has_md2, has_md4, (Closed)
Patch Set: moar Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/cert_verify_proc.h" 5 #include "net/cert/cert_verify_proc.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 if (start >= time_2015_04_01 && month_diff > 39) 767 if (start >= time_2015_04_01 && month_diff > 39)
768 return true; 768 return true;
769 769
770 return false; 770 return false;
771 } 771 }
772 772
773 // static 773 // static
774 const base::Feature CertVerifyProc::kSHA1LegacyMode{ 774 const base::Feature CertVerifyProc::kSHA1LegacyMode{
775 "SHA1LegacyMode", base::FEATURE_DISABLED_BY_DEFAULT}; 775 "SHA1LegacyMode", base::FEATURE_DISABLED_BY_DEFAULT};
776 776
777 bool FillCertVerifyResultWeakSignature(X509Certificate::OSCertHandle cert,
778 bool is_leaf,
779 CertVerifyResult* verify_result) {
780 bool uses_weak_hash = true;
781
782 auto hash = X509Certificate::GetSignatureHashAlgorithm(cert);
Ryan Sleevi 2017/01/05 22:48:24 Seems like this is skirting very close to the "Con
eroman 2017/01/05 23:36:30 Done.
783 switch (hash) {
784 case X509Certificate::kSignatureHashAlgorithmMd2:
785 verify_result->has_md2 = true;
786 break;
787 case X509Certificate::kSignatureHashAlgorithmMd4:
788 verify_result->has_md4 = true;
789 break;
790 case X509Certificate::kSignatureHashAlgorithmMd5:
791 verify_result->has_md5 = true;
792 break;
793 case X509Certificate::kSignatureHashAlgorithmSha1:
794 verify_result->has_sha1 = true;
795 if (is_leaf)
796 verify_result->has_sha1_leaf = true;
797 break;
798 case X509Certificate::kSignatureHashAlgorithmOther:
799 uses_weak_hash = false;
800 break;
801 }
802
803 return uses_weak_hash;
804 }
805
777 } // namespace net 806 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698