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

Unified Diff: net/third_party/nss/ssl/sslauth.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/ssl3prot.h ('k') | net/third_party/nss/ssl/sslenum.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/third_party/nss/ssl/sslauth.c
diff --git a/net/third_party/nss/ssl/sslauth.c b/net/third_party/nss/ssl/sslauth.c
index 3f4924dff29e60c8d76f50785cc0c1daa48e4c12..8282cf838397357fdd9b473c929542c24d861c38 100644
--- a/net/third_party/nss/ssl/sslauth.c
+++ b/net/third_party/nss/ssl/sslauth.c
@@ -291,6 +291,80 @@ SSL_SetPKCS11PinArg(PRFileDesc *s, void *arg)
return SECSuccess;
}
+/* register callback function to provide the user password */
+SECStatus
+SSL_UserPasswdHook(PRFileDesc *s, SSLUserPasswdCB func, void *arg)
+{
+ sslSocket *ss;
+
+ ss = ssl_FindSocket(s);
+ if (!ss) {
+ SSL_DBG(("%d: SSL[%d]: bad socket in UserPasswdHook",
+ SSL_GETPID(), s));
+ return SECFailure;
+ }
+
+ ss->getUserPasswd = func;
+ ss->getUserPasswdArg = arg;
+ return SECSuccess;
+}
+
+/* used by client to provide user credentials non-interactively */
+SECStatus
+SSL_SetUserLogin(PRFileDesc *s, const char *user, const char *passwd)
+{
+ sslSocket *ss = NULL;
+ int len;
+
+ ss = ssl_FindSocket(s);
+ if (!ss) {
+ SSL_DBG(("%d: SSL[%d]: bad socket in GetClientAuthDataHook",
+ SSL_GETPID(), s));
+ return SECFailure;
+ }
+
+ if (user) {
+ len = PORT_Strlen(user);
+ if (len > MAX_SRP_USERNAME_LENGTH)
+ len = MAX_SRP_USERNAME_LENGTH;
+ ss->sec.userName = SECITEM_AllocItem(NULL, NULL, len);
+ if (!ss->sec.userName) {
+ PORT_SetError(SEC_ERROR_NO_MEMORY);
+ return SECFailure;
+ }
+ PORT_Memcpy(ss->sec.userName->data, user, ss->sec.userName->len);
+ }
+
+ if (passwd) {
+ len = PORT_Strlen(passwd);
+ ss->sec.userPasswd = SECITEM_AllocItem(NULL, NULL, len);
+ if (!ss->sec.userPasswd) {
+ PORT_SetError(SEC_ERROR_NO_MEMORY);
+ return SECFailure;
+ }
+ PORT_Memcpy(ss->sec.userPasswd->data, passwd, ss->sec.userPasswd->len);
+ }
+
+ return SECSuccess;
+}
+
+/* register callback function to provide SRP user authentication params */
+SECStatus
+SSL_GetSRPParamsHook(PRFileDesc *s, SSLGetSRPParamsCB func, void *arg)
+{
+ sslSocket *ss;
+
+ ss = ssl_FindSocket(s);
+ if (!ss) {
+ SSL_DBG(("%d: SSL[%d]: bad socket in GetClientAuthDataHook",
+ SSL_GETPID(), s));
+ return SECFailure;
+ }
+
+ ss->getSRPParams = func;
+ ss->getSRPParamsArg = arg;
+ return SECSuccess;
+}
/* This is the "default" authCert callback function. It is called when a
* certificate message is received from the peer and the local application
« no previous file with comments | « net/third_party/nss/ssl/ssl3prot.h ('k') | net/third_party/nss/ssl/sslenum.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698