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

Side by Side Diff: net/socket/ssl_client_socket_unittest.cc

Issue 9663043: Add a boolean |had_context| argument to the TLS ExportKeyingMaterial (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Make suggested changes, add patch file Created 8 years, 9 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 | Annotate | Revision Log
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/socket/ssl_client_socket.h" 5 #include "net/socket/ssl_client_socket.h"
6 6
7 #include "net/base/address_list.h" 7 #include "net/base/address_list.h"
8 #include "net/base/cert_test_util.h" 8 #include "net/base/cert_test_util.h"
9 #include "net/base/cert_verifier.h" 9 #include "net/base/cert_verifier.h"
10 #include "net/base/host_resolver.h" 10 #include "net/base/host_resolver.h"
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 if (rv == net::ERR_IO_PENDING) 804 if (rv == net::ERR_IO_PENDING)
805 rv = callback.WaitForResult(); 805 rv = callback.WaitForResult();
806 EXPECT_EQ(net::OK, rv); 806 EXPECT_EQ(net::OK, rv);
807 EXPECT_TRUE(sock->IsConnected()); 807 EXPECT_TRUE(sock->IsConnected());
808 808
809 const int kKeyingMaterialSize = 32; 809 const int kKeyingMaterialSize = 32;
810 const char* kKeyingLabel1 = "client-socket-test-1"; 810 const char* kKeyingLabel1 = "client-socket-test-1";
811 const char* kKeyingContext = ""; 811 const char* kKeyingContext = "";
812 unsigned char client_out1[kKeyingMaterialSize]; 812 unsigned char client_out1[kKeyingMaterialSize];
813 memset(client_out1, 0, sizeof(client_out1)); 813 memset(client_out1, 0, sizeof(client_out1));
814 rv = sock->ExportKeyingMaterial(kKeyingLabel1, kKeyingContext, 814 rv = sock->ExportKeyingMaterial(kKeyingLabel1, false, kKeyingContext,
815 client_out1, sizeof(client_out1)); 815 client_out1, sizeof(client_out1));
816 EXPECT_EQ(rv, net::OK); 816 EXPECT_EQ(rv, net::OK);
817 817
818 const char* kKeyingLabel2 = "client-socket-test-2"; 818 const char* kKeyingLabel2 = "client-socket-test-2";
819 unsigned char client_out2[kKeyingMaterialSize]; 819 unsigned char client_out2[kKeyingMaterialSize];
820 memset(client_out2, 0, sizeof(client_out2)); 820 memset(client_out2, 0, sizeof(client_out2));
821 rv = sock->ExportKeyingMaterial(kKeyingLabel2, kKeyingContext, 821 rv = sock->ExportKeyingMaterial(kKeyingLabel2, false, kKeyingContext,
822 client_out2, sizeof(client_out2)); 822 client_out2, sizeof(client_out2));
823 EXPECT_EQ(rv, net::OK); 823 EXPECT_EQ(rv, net::OK);
824 EXPECT_NE(memcmp(client_out1, client_out2, kKeyingMaterialSize), 0); 824 EXPECT_NE(memcmp(client_out1, client_out2, kKeyingMaterialSize), 0);
825 } 825 }
826 826
827 // Verifies that SSLClientSocket::ClearSessionCache can be called without 827 // Verifies that SSLClientSocket::ClearSessionCache can be called without
828 // explicit NSS initialization. 828 // explicit NSS initialization.
829 TEST(SSLClientSocket, ClearSessionCache) { 829 TEST(SSLClientSocket, ClearSessionCache) {
830 net::SSLClientSocket::ClearSessionCache(); 830 net::SSLClientSocket::ClearSessionCache();
831 } 831 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 ssl_info.cert->os_cert_handle(), certs[0]->os_cert_handle())); 925 ssl_info.cert->os_cert_handle(), certs[0]->os_cert_handle()));
926 EXPECT_TRUE(net::X509Certificate::IsSameOSCert( 926 EXPECT_TRUE(net::X509Certificate::IsSameOSCert(
927 intermediates[0], certs[1]->os_cert_handle())); 927 intermediates[0], certs[1]->os_cert_handle()));
928 EXPECT_TRUE(net::X509Certificate::IsSameOSCert( 928 EXPECT_TRUE(net::X509Certificate::IsSameOSCert(
929 intermediates[1], certs[2]->os_cert_handle())); 929 intermediates[1], certs[2]->os_cert_handle()));
930 930
931 sock->Disconnect(); 931 sock->Disconnect();
932 EXPECT_FALSE(sock->IsConnected()); 932 EXPECT_FALSE(sock->IsConnected());
933 } 933 }
934 934
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698