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

Unified Diff: net/third_party/nss/ssl/ssl3ecc.c

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 | « net/third_party/nss/ssl/ssl3con.c ('k') | net/third_party/nss/ssl/ssl3ext.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/third_party/nss/ssl/ssl3ecc.c
diff --git a/net/third_party/nss/ssl/ssl3ecc.c b/net/third_party/nss/ssl/ssl3ecc.c
index 778c7ab3d83c0e769200e9b23c33d3156c34521d..b8990384c3357e204ba4225651573e411402e8b3 100644
--- a/net/third_party/nss/ssl/ssl3ecc.c
+++ b/net/third_party/nss/ssl/ssl3ecc.c
@@ -1191,3 +1191,60 @@ loser:
}
#endif /* NSS_ENABLE_ECC */
+
+/* send user mapping indication using info from ss->sec.userlogin
+ * called from ssl3_CallHelloExtensionSenders */
+PRInt32
+ssl3_SendSRPHelloExtension(sslSocket * ss, PRBool append,
+ PRUint32 maxBytes)
+{
+ SECItem * user = ss->sec.userName;
+
+ if (user == NULL)
+ return 0; /* no credentials, no extension */
+
+ if (append && maxBytes >= user->len + 5) {
+ SECStatus rv;
+ /* extension_type 6 */
+ rv = ssl3_AppendHandshakeNumber(ss, 12, 2);
+ if (rv != SECSuccess) return 0;
+ /* length of extension */
+ rv = ssl3_AppendHandshakeNumber(ss, user->len + 1, 2);
+ if (rv != SECSuccess) return 0;
+ /* length of data */
+ rv = ssl3_AppendHandshakeNumber(ss, user->len, 1);
+ if (rv != SECSuccess) return 0;
+ /* extension_data = srp user name */
+ rv = ssl3_AppendHandshake(ss, user->data, user->len);
+ if (rv != SECSuccess) return 0;
+ }
+ return user->len+5;
+}
+
+SECStatus
+ssl3_HandleSRPHelloExtension(sslSocket *ss, PRUint16 ext, SECItem *data)
+{
+ SECStatus rv;
+ SECItem username;
+
+ rv = ssl3_ConsumeHandshakeVariable(ss, &username, 1, &data->data, &data->len);
+ if (rv != SECSuccess)
+ return rv;
+
+ /* enforce SRP username length constrain */
+ if (data->len > MAX_SRP_USERNAME_LENGTH)
+ data->len = MAX_SRP_USERNAME_LENGTH;
+
+ ss->sec.userName = PORT_ZAlloc(sizeof(SECItem));
+ if (!ss->sec.userName)
+ goto no_memory;
+
+ rv = SECITEM_CopyItem(NULL, ss->sec.userName, &username);
+ if (rv != SECSuccess)
+ goto no_memory;
+
+ return rv;
+no_memory:
+ ssl_MapLowLevelError(SSL_ERROR_SERVER_KEY_EXCHANGE_FAILURE);
+ return SECFailure;
+}
« no previous file with comments | « net/third_party/nss/ssl/ssl3con.c ('k') | net/third_party/nss/ssl/ssl3ext.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698