Ejemplo n.º 1
0
static char *srp_verify_user(const char *user, const char *srp_verifier,
			     char *srp_usersalt, const char *g, const char *N,
			     const char *passin, BIO *bio, int verbose)
	{
	char password[1024];
	PW_CB_DATA cb_tmp;
	char *verifier = NULL;
	char *gNid = NULL;

	cb_tmp.prompt_info = user;
	cb_tmp.password = passin;

 	if (password_callback(password, 1024, 0, &cb_tmp) >0)
		{
		VERBOSE BIO_printf(bio,"Validating\n   user=\"%s\"\n srp_verifier=\"%s\"\n srp_usersalt=\"%s\"\n g=\"%s\"\n N=\"%s\"\n",user,srp_verifier,srp_usersalt, g, N);
		BIO_printf(bio, "Pass %s\n", password);

		if (!(gNid=SRP_create_verifier(user, password, &srp_usersalt, &verifier, N, g)))
			{
			BIO_printf(bio, "Internal error validating SRP verifier\n");
			}
		else
			{
			if (strcmp(verifier, srp_verifier))
				gNid = NULL;
			OPENSSL_free(verifier);
			}
		}
	return gNid;
	}
Ejemplo n.º 2
0
static char *srp_create_user(char *user, char **srp_verifier,
			     char **srp_usersalt, char *g, char *N,
			     char *passout, BIO *bio, int verbose)
	{
 	char password[1024];
        PW_CB_DATA cb_tmp;
	char *gNid = NULL;
	char *salt = NULL;
        cb_tmp.prompt_info = user;
        cb_tmp.password = passout;

	if (password_callback(password,1024,1,&cb_tmp) >0)
		{
		VERBOSE BIO_printf(bio,"Creating\n user=\"%s\"\n g=\"%s\"\n N=\"%s\"\n",user,g,N);
		if (!(gNid =SRP_create_verifier(user, password, &salt, srp_verifier, N, g)))
			{
			BIO_printf(bio,"Internal error creating SRP verifier\n");
			}
		else 
			*srp_usersalt = salt;
		VVERBOSE BIO_printf(bio,"gNid=%s salt =\"%s\"\n verifier =\"%s\"\n", gNid,salt, *srp_verifier);

		}
	return gNid;
	}
Ejemplo n.º 3
0
/* Test of UI.  This uses the UI method defined in apps/apps.c */
static int test_new_ui(void)
{
    PW_CB_DATA cb_data = {
        "password",
        "prompt"
    };
    char pass[16];
    int ok = 0;

    setup_ui_method();
    if (TEST_int_gt(password_callback(pass, sizeof(pass), 0, &cb_data), 0)
            && TEST_str_eq(pass, cb_data.password))
        ok = 1;
    destroy_ui_method();
    return ok;
}
Ejemplo n.º 4
0
/* Test of UI.  This uses the UI method defined in apps/apps.c */
static int test_new_ui()
{
    PW_CB_DATA cb_data = {
        "password",
        "prompt"
    };
    char pass[16];
    int ok = 0;

    setup_ui_method();
    if (password_callback(pass, sizeof(pass), 0, &cb_data) > 0
        && strcmp(pass, cb_data.password) == 0)
        ok = 1;
    else
        BIO_printf(bio_err, "test_new: password failure\n");

    if (!ok)
        ERR_print_errors_fp(stderr);

    destroy_ui_method();
    return ok;
}