6 int main(
int argc,
char *argv[])
8 printf(
"No SRP support\n");
18 static void showbn(
const char *name,
const BIGNUM *bn)
26 #define RANDOM_SIZE 32
28 static int run_srp(
const char *username,
const char *client_pass,
const char *server_pass)
47 fprintf(stderr,
"Failed to get SRP parameters\n");
53 fprintf(stderr,
"Failed to create SRP verifier\n");
60 showbn(
"Verifier", v);
64 b =
BN_bin2bn(rand_tmp,
sizeof(rand_tmp), NULL);
74 fprintf(stderr,
"Invalid B\n");
80 a =
BN_bin2bn(rand_tmp,
sizeof(rand_tmp), NULL);
90 fprintf(stderr,
"Invalid A\n");
100 showbn(
"Client's key", Kclient);
104 showbn(
"Server's key", Kserver);
106 if(
BN_cmp(Kclient, Kserver) == 0)
112 fprintf(stderr,
"Keys mismatch\n");
130 int main(
int argc,
char **argv)
142 if(run_srp(
"alice",
"password1",
"password2") == 0)
144 fprintf(stderr,
"Mismatched SRP run failed\n");
149 if(run_srp(
"alice",
"password",
"password") != 0)
151 fprintf(stderr,
"Plain SRP run failed\n");