+#ifndef OPENSSL_NO_SRP
+/* This is a context that we pass to callbacks */
+typedef struct srpsrvparm_st
+ {
+ int verbose;
+ char *login;
+ SRP_VBASE *vb;
+ } srpsrvparm;
+
+static int MS_CALLBACK ssl_srp_server_param_cb(SSL *s, int *ad, void *arg)
+ {
+ srpsrvparm *p = (srpsrvparm *) arg;
+ SRP_user_pwd *user;
+
+ p->login = BUF_strdup(SSL_get_srp_username(s));
+ BIO_printf(bio_err, "SRP username = \"%s\"\n", p->login);
+
+ user = SRP_VBASE_get_by_user(p->vb, p->login);
+ if (user == NULL)
+ {
+ BIO_printf(bio_err, "User %s doesn't exist\n", p->login);
+ return SSL3_AL_FATAL;
+ }
+ if (SSL_set_srp_server_param(s, user->N, user->g, user->s, user->v,
+ user->info) < 0)
+ {
+ *ad = SSL_AD_INTERNAL_ERROR;
+ return SSL3_AL_FATAL;
+ }
+ return SSL_ERROR_NONE;
+ }
+
+#endif
+