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

Issue 173853014: Make OpenSSL UpdateServerCert() OS independent. (Closed)

Created:
6 years, 10 months ago by haavardm
Modified:
6 years, 9 months ago
Reviewers:
wtc, Ryan Sleevi
CC:
chromium-reviews, cbentzel+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

Make OpenSSL UpdateServerCert() OS independent. UpdateServerCert currently creates the server cert chain directly from the openssl struct X509. This works since OSCertHandle currently is an OpenSSL X509 struct when OpenSSL is used on Android and Linux. This patch makes the UpdateServerCert() OS independent by creating the X509Certificate from DER data instead of OSCertHandle to make it compile on the other platforms when USE_OPENSSL is off. Keep the USE_OPENSSL code to avoid converting back and forth between X509 and DER twice and OsCertHandle is X509. I see that there is a DER cache in x509_certificate_openssl.cc which could have simplified the patch a bit. However, if I understand a comment correctly, it shouldn't be mixed with certificates that comes from network, which is the case here. Also, that API is not exposed. Also remove some unused NSS code from x509_certificate_mac.cc. Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=257449

Patch Set 1 #

Total comments: 23

Patch Set 2 : Fixes after review comments #

Total comments: 6

Patch Set 3 : New PeerCertificateChain based on Ryan's design #

Patch Set 4 : Free Openssl strings #

Total comments: 7

Patch Set 5 : Cleanp and fix id2_x509 conversion test #

Patch Set 6 : Added test case for retrieving unverified server cert chain. #

Total comments: 50

Patch Set 7 : More cleanup and fixes #

Total comments: 6

Patch Set 8 : Changed from pointer to scoped_refptr and moved code out of class. #

Total comments: 6

Patch Set 9 : Fixed nits and added comment #

Patch Set 10 : Fixed android compile error #

Total comments: 1

Patch Set 11 : Moved FreeX509Stack back inside class using friend to please gcc-4.6 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+292 lines, -65 lines) Patch
M net/socket/socket_test_util.h View 1 2 3 4 5 6 7 1 chunk +4 lines, -0 lines 0 comments Download
M net/socket/socket_test_util.cc View 1 2 3 4 5 6 7 1 chunk +6 lines, -0 lines 0 comments Download
M net/socket/ssl_client_socket.h View 1 2 3 4 5 6 7 3 chunks +10 lines, -0 lines 0 comments Download
M net/socket/ssl_client_socket_nss.h View 1 2 3 4 5 6 7 1 chunk +5 lines, -0 lines 0 comments Download
M net/socket/ssl_client_socket_nss.cc View 1 2 3 4 5 6 7 1 chunk +5 lines, -0 lines 0 comments Download
M net/socket/ssl_client_socket_openssl.h View 1 2 3 4 5 6 7 2 chunks +7 lines, -0 lines 0 comments Download
M net/socket/ssl_client_socket_openssl.cc View 1 2 3 4 5 6 7 8 9 10 5 chunks +143 lines, -22 lines 0 comments Download
M net/socket/ssl_client_socket_unittest.cc View 1 2 3 4 5 6 7 5 chunks +112 lines, -43 lines 0 comments Download

Messages

Total messages: 36 (0 generated)
haavardm
This patch is for the OpenSSL transition. Please review. I didn't reference any bug number ...
6 years, 10 months ago (2014-02-21 15:21:03 UTC) #1
Ryan Sleevi
Thanks for taking a stab at this Havard! I think we'll want to continue to ...
6 years, 10 months ago (2014-02-21 22:34:38 UTC) #2
haavardm
Thanks for the quick review, a couple of questions below. https://codereview.chromium.org/173853014/diff/1/net/socket/ssl_client_socket_openssl.cc File net/socket/ssl_client_socket_openssl.cc (right): https://codereview.chromium.org/173853014/diff/1/net/socket/ssl_client_socket_openssl.cc#newcode921 ...
6 years, 10 months ago (2014-02-24 18:54:30 UTC) #3
Ryan Sleevi
https://codereview.chromium.org/173853014/diff/1/net/socket/ssl_client_socket_openssl.cc File net/socket/ssl_client_socket_openssl.cc (right): https://codereview.chromium.org/173853014/diff/1/net/socket/ssl_client_socket_openssl.cc#newcode921 net/socket/ssl_client_socket_openssl.cc:921: return server_cert_.get(); On 2014/02/24 18:54:31, Håvard Molland wrote: > ...
6 years, 10 months ago (2014-02-24 19:02:46 UTC) #4
haavardm
https://codereview.chromium.org/173853014/diff/1/net/socket/ssl_client_socket_openssl.cc File net/socket/ssl_client_socket_openssl.cc (right): https://codereview.chromium.org/173853014/diff/1/net/socket/ssl_client_socket_openssl.cc#newcode948 net/socket/ssl_client_socket_openssl.cc:948: OPENSSL_free(cert_data); On 2014/02/24 19:02:47, Ryan Sleevi wrote: > On ...
6 years, 10 months ago (2014-02-24 20:47:00 UTC) #5
wtc
Review comments on patch set 1: https://codereview.chromium.org/173853014/diff/1/net/cert/x509_certificate_mac.cc File net/cert/x509_certificate_mac.cc (right): https://codereview.chromium.org/173853014/diff/1/net/cert/x509_certificate_mac.cc#newcode25 net/cert/x509_certificate_mac.cc:25: #include "crypto/nss_util.h" This ...
6 years, 10 months ago (2014-02-25 01:13:08 UTC) #6
haavardm
https://codereview.chromium.org/173853014/diff/1/net/socket/ssl_client_socket_openssl.cc File net/socket/ssl_client_socket_openssl.cc (right): https://codereview.chromium.org/173853014/diff/1/net/socket/ssl_client_socket_openssl.cc#newcode923 net/socket/ssl_client_socket_openssl.cc:923: crypto::ScopedOpenSSL<X509, X509_free> cert(SSL_get_peer_certificate(ssl_)); Is this needed? I suddenly realized ...
6 years, 10 months ago (2014-02-25 16:13:01 UTC) #7
haavardm
https://codereview.chromium.org/173853014/diff/80001/net/socket/ssl_client_socket_openssl.cc File net/socket/ssl_client_socket_openssl.cc (left): https://codereview.chromium.org/173853014/diff/80001/net/socket/ssl_client_socket_openssl.cc#oldcode923 net/socket/ssl_client_socket_openssl.cc:923: crypto::ScopedOpenSSL<X509, X509_free> cert(SSL_get_peer_certificate(ssl_)); I removed this, as it seems ...
6 years, 10 months ago (2014-02-25 19:37:37 UTC) #8
Ryan Sleevi
On 2014/02/25 19:37:37, Håvard Molland wrote: > https://codereview.chromium.org/173853014/diff/80001/net/socket/ssl_client_socket_openssl.cc > File net/socket/ssl_client_socket_openssl.cc (left): > > https://codereview.chromium.org/173853014/diff/80001/net/socket/ssl_client_socket_openssl.cc#oldcode923 ...
6 years, 10 months ago (2014-02-25 19:55:35 UTC) #9
Ryan Sleevi
https://codereview.chromium.org/173853014/diff/80001/net/socket/ssl_client_socket_openssl.cc File net/socket/ssl_client_socket_openssl.cc (right): https://codereview.chromium.org/173853014/diff/80001/net/socket/ssl_client_socket_openssl.cc#newcode401 net/socket/ssl_client_socket_openssl.cc:401: std::vector<ScopedX509> x509_certs_; Storing a vector of ScopedX509 doesn't work ...
6 years, 10 months ago (2014-02-25 20:27:09 UTC) #10
haavardm
https://codereview.chromium.org/173853014/diff/80001/net/socket/ssl_client_socket_openssl.cc File net/socket/ssl_client_socket_openssl.cc (right): https://codereview.chromium.org/173853014/diff/80001/net/socket/ssl_client_socket_openssl.cc#newcode401 net/socket/ssl_client_socket_openssl.cc:401: std::vector<ScopedX509> x509_certs_; Seems good. I guess I got a ...
6 years, 10 months ago (2014-02-25 20:53:52 UTC) #11
Ryan Sleevi
Did you want to add a test to cover the bug(s) you found? https://codereview.chromium.org/173853014/diff/120001/net/socket/ssl_client_socket_openssl.cc File ...
6 years, 10 months ago (2014-02-27 03:07:29 UTC) #12
haavardm
https://codereview.chromium.org/173853014/diff/120001/net/socket/ssl_client_socket_openssl.cc File net/socket/ssl_client_socket_openssl.cc (right): https://codereview.chromium.org/173853014/diff/120001/net/socket/ssl_client_socket_openssl.cc#newcode414 net/socket/ssl_client_socket_openssl.cc:414: OPENSSL_free((void*)der_chain[i].data()); On 2014/02/27 03:07:29, Ryan Sleevi wrote: > You ...
6 years, 9 months ago (2014-02-27 10:46:28 UTC) #13
haavardm
On 2014/02/27 03:07:29, Ryan Sleevi wrote: > Did you want to add a test to ...
6 years, 9 months ago (2014-02-27 10:54:59 UTC) #14
wtc
https://codereview.chromium.org/173853014/diff/120001/net/socket/ssl_client_socket_openssl.cc File net/socket/ssl_client_socket_openssl.cc (right): https://codereview.chromium.org/173853014/diff/120001/net/socket/ssl_client_socket_openssl.cc#newcode414 net/socket/ssl_client_socket_openssl.cc:414: OPENSSL_free((void*)der_chain[i].data()); On 2014/02/27 10:46:28, Håvard Molland wrote: > > ...
6 years, 9 months ago (2014-02-27 17:54:55 UTC) #15
haavardm
Test case for retrieving server chain from SSL stack added. https://codereview.chromium.org/173853014/diff/180001/net/socket/ssl_client_socket_unittest.cc File net/socket/ssl_client_socket_unittest.cc (right): https://codereview.chromium.org/173853014/diff/180001/net/socket/ssl_client_socket_unittest.cc#newcode527 ...
6 years, 9 months ago (2014-03-03 19:11:26 UTC) #16
haavardm
Ping
6 years, 9 months ago (2014-03-10 16:41:54 UTC) #17
wtc
Patch set 6 LGTM. Please wait for Ryan's approval. https://codereview.chromium.org/173853014/diff/180001/net/socket/socket_test_util.cc File net/socket/socket_test_util.cc (right): https://codereview.chromium.org/173853014/diff/180001/net/socket/socket_test_util.cc#newcode780 net/socket/socket_test_util.cc:780: ...
6 years, 9 months ago (2014-03-10 21:45:33 UTC) #18
Ryan Sleevi
https://codereview.chromium.org/173853014/diff/180001/net/socket/ssl_client_socket.h File net/socket/ssl_client_socket.h (right): https://codereview.chromium.org/173853014/diff/180001/net/socket/ssl_client_socket.h#newcode171 net/socket/ssl_client_socket.h:171: virtual const scoped_refptr<X509Certificate> GetUnverifiedServerCertificate() On 2014/03/10 21:45:34, wtc wrote: ...
6 years, 9 months ago (2014-03-11 00:15:14 UTC) #19
haavardm
Thanks for reviewing. Here's my changes (and I suddenly realized there was a 'done' button). ...
6 years, 9 months ago (2014-03-11 18:43:20 UTC) #20
Ryan Sleevi
https://codereview.chromium.org/173853014/diff/200001/net/socket/ssl_client_socket.h File net/socket/ssl_client_socket.h (right): https://codereview.chromium.org/173853014/diff/200001/net/socket/ssl_client_socket.h#newcode158 net/socket/ssl_client_socket.h:158: protected: Do not repeat 'protected' here (it's already set ...
6 years, 9 months ago (2014-03-12 23:12:03 UTC) #21
haavardm
Thanks for quick review. Here's the fixes. https://codereview.chromium.org/173853014/diff/200001/net/socket/ssl_client_socket.h File net/socket/ssl_client_socket.h (right): https://codereview.chromium.org/173853014/diff/200001/net/socket/ssl_client_socket.h#newcode158 net/socket/ssl_client_socket.h:158: protected: On ...
6 years, 9 months ago (2014-03-13 10:32:01 UTC) #22
Ryan Sleevi
LGTM! Sorry for the delays in reviewing. If you ever have a lag of more ...
6 years, 9 months ago (2014-03-14 21:06:14 UTC) #23
haavardm
On 2014/03/14 21:06:14, Ryan Sleevi wrote: > LGTM! > > Sorry for the delays in ...
6 years, 9 months ago (2014-03-17 09:19:32 UTC) #24
haavardm
https://codereview.chromium.org/173853014/diff/220001/net/socket/ssl_client_socket_openssl.cc File net/socket/ssl_client_socket_openssl.cc (right): https://codereview.chromium.org/173853014/diff/220001/net/socket/ssl_client_socket_openssl.cc#newcode332 net/socket/ssl_client_socket_openssl.cc:332: void Reset(SSL* ssl); On 2014/03/14 21:06:15, Ryan Sleevi wrote: ...
6 years, 9 months ago (2014-03-17 09:21:54 UTC) #25
haavardm
The CQ bit was checked by haavardm@opera.com
6 years, 9 months ago (2014-03-17 09:22:08 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/haavardm@opera.com/173853014/240001
6 years, 9 months ago (2014-03-17 09:22:16 UTC) #27
haavardm
The CQ bit was unchecked by haavardm@opera.com
6 years, 9 months ago (2014-03-17 10:02:26 UTC) #28
haavardm
https://codereview.chromium.org/173853014/diff/260001/net/socket/ssl_client_socket_openssl.cc File net/socket/ssl_client_socket_openssl.cc (right): https://codereview.chromium.org/173853014/diff/260001/net/socket/ssl_client_socket_openssl.cc#newcode245 net/socket/ssl_client_socket_openssl.cc:245: static void FreeX509Stack(STACK_OF(X509)* cert_chain) { Moved this out of ...
6 years, 9 months ago (2014-03-17 11:20:32 UTC) #29
haavardm
The CQ bit was checked by haavardm@opera.com
6 years, 9 months ago (2014-03-17 11:21:03 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/haavardm@opera.com/173853014/260001
6 years, 9 months ago (2014-03-17 11:21:11 UTC) #31
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 9 months ago (2014-03-17 12:14:18 UTC) #32
commit-bot: I haz the power
Retried try job too often on android_dbg for step(s) slave_steps http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=android_dbg&number=161393
6 years, 9 months ago (2014-03-17 12:14:19 UTC) #33
haavardm
The CQ bit was checked by haavardm@opera.com
6 years, 9 months ago (2014-03-17 13:07:01 UTC) #34
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/haavardm@opera.com/173853014/280001
6 years, 9 months ago (2014-03-17 13:07:10 UTC) #35
commit-bot: I haz the power
6 years, 9 months ago (2014-03-17 16:44:27 UTC) #36
Message was sent while issue was closed.
Change committed as 257449

Powered by Google App Engine
This is Rietveld 408576698