-From 3cf1b730eae6021c1eac535a1f38e71ceb9bf7d1 Mon Sep 17 00:00:00 2001
+From f8f73238eb1a45dcd5400f4f921ffa9f204ac1cf Mon Sep 17 00:00:00 2001
 From: Dmitrii Pichulin <deem@deem.ru>
 Date: Wed, 7 Oct 2020 18:35:41 +0300
 Subject: [PATCH] chromium GOSTSSL

 ClientCertIdentityList ClientCertStoreNSS::GetAndFilterCertsOnWorkerThread(
     scoped_refptr<crypto::CryptoModuleBlockingPasswordDelegate>
         password_delegate,
@@ -159,6 +165,36 @@ ClientCertIdentityList ClientCertStoreNSS::GetAndFilterCertsOnWorkerThread(
   GetPlatformCertsOnWorkerThread(std::move(password_delegate), CertFilter(),
                                  &selected_identities);
   FilterCertsOnWorkerThread(&selected_identities, *request);
+
+#ifndef NO_GOSTSSL
+    {
+        {
+            char ** certs;
+            int * lens;
+            int count;
+            int is_gost;
+
+            gostssl_clientcertshook( &certs, &lens, NULL, &count, &is_gost );
+
+            if( is_gost )
+            {
+                selected_identities.clear();
+                for( int i = 0; i < count; i++ )
+                {
+                    scoped_refptr<X509Certificate> cert = X509Certificate::CreateFromBytes( certs[i], lens[i] );
+                    if( !cert.get() )
+                        continue;
+                    ScopedCERTCertificate nss_cert = x509_util::CreateCERTCertificateFromBytes( (uint8_t *)certs[i], lens[i] );
+                    if( !nss_cert.get() )
+                        continue;
+                    selected_identities.push_back( std::make_unique<ClientCertIdentityNSS>( cert, x509_util::DupCERTCertificate( nss_cert.get() ), password_delegate ) );
+                }
+                std::sort( selected_identities.begin(), selected_identities.end(), ClientCertIdentitySorter() );
+            }
+        }
+    }
+#endif // GOSTSSL
+
   return selected_identities;

   CHECK(GetSSLInfo(&ssl_info));
 
diff --git a/net/ssl/client_cert_store_mac.cc b/net/ssl/client_cert_store_mac.cc
index fc448f463329..1b051006544b 100644
--- a/net/ssl/client_cert_store_mac.cc
+++ b/net/ssl/client_cert_store_mac.cc
@@ -295,6 +295,12 @@ void AddIdentity(ScopedCFTypeRef<SecIdentityRef> sec_identity,
