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

Unified Diff: third_party/tlslite/tlslite/TLSConnection.py

Issue 6804032: Add TLS-SRP (RFC 5054) support Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: remove "httpsv" scheme, minor NSS/OpenSSL changes Created 9 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/tlslite/scripts/tls.py ('k') | third_party/tlslite/tlslite/constants.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/tlslite/tlslite/TLSConnection.py
diff --git a/third_party/tlslite/tlslite/TLSConnection.py b/third_party/tlslite/tlslite/TLSConnection.py
index 7e38a2326877d69411eb449c87f7062fa751f958..4948683f7d8785609e4ed93cac0a65fb21c673ef 100644
--- a/third_party/tlslite/tlslite/TLSConnection.py
+++ b/third_party/tlslite/tlslite/TLSConnection.py
@@ -514,7 +514,7 @@ class TLSConnection(TLSRecordLayer):
for result in self._sendMsg(clientHello):
yield result
- #Get ServerHello (or missing_srp_username)
+ #Get ServerHello (or unknown_psk_identity)
for result in self._getMsg((ContentType.handshake,
ContentType.alert),
HandshakeType.server_hello):
@@ -529,20 +529,17 @@ class TLSConnection(TLSRecordLayer):
elif isinstance(msg, Alert):
alert = msg
- #If it's not a missing_srp_username, re-raise
- if alert.description != AlertDescription.missing_srp_username:
+ #If it's not a unknown_psk_identity, re-raise
+ if alert.description != AlertDescription.unknown_psk_identity:
self._shutdown(False)
raise TLSRemoteAlert(alert)
- #If we're not in SRP callback mode, we won't have offered SRP
- #without a username, so we shouldn't get this alert
- if not srpCallback:
- for result in self._sendError(\
- AlertDescription.unexpected_message):
- yield result
- srpParams = srpCallback()
- #If the callback returns None, cancel the handshake
- if srpParams == None:
+ #Our SRP credentials were wrong, so try getting new ones.
+ if srpCallback:
+ srpParams = srpCallback()
+
+ #If we can't get different credentials, cancel the handshake
+ if srpParams == None or not srpCallback:
for result in self._sendError(AlertDescription.user_canceled):
yield result
@@ -1259,8 +1256,8 @@ class TLSConnection(TLSRecordLayer):
#Ask the client to re-send ClientHello with one
for result in self._sendMsg(Alert().create(\
- AlertDescription.missing_srp_username,
- AlertLevel.warning)):
+ AlertDescription.unknown_psk_identity,
+ AlertLevel.fatal)):
yield result
#Get ClientHello
@@ -1323,7 +1320,7 @@ class TLSConnection(TLSRecordLayer):
entry = verifierDB[self.allegedSrpUsername]
except KeyError:
for result in self._sendError(\
- AlertDescription.unknown_srp_username):
+ AlertDescription.unknown_psk_identity):
yield result
(N, g, s, v) = entry
« no previous file with comments | « third_party/tlslite/scripts/tls.py ('k') | third_party/tlslite/tlslite/constants.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698