summaryrefslogtreecommitdiff
path: root/set5/task38.c
blob: 889fe113c86b11971a4fb1dcc9d750f39a3fe6c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "../lib/lib.h"
#include "../lib/lib2.h"
#include "../lib/lib3.h"
#include "../lib/lib4.h"
#include "../lib/lib5.h"
#include <time.h>

int main()
{
	struct srp_context srpc;	
	char *email = "test@example.com";
	char *password = "12345";
	//char *password = passwords[index];
	char sK[41];
	char cK[41];
	out = BIO_new(BIO_s_file());
	BIO_set_fp(out, stdout, BIO_NOCLOSE);

	ctx = BN_CTX_new();
	printf("using password: %s\n", password);	
	srp_context_init(&srpc);
	srp_server_init(email, password, &srpc);
	srp_client_send1(email, &srpc);
	ssrp_server_send1(&srpc);
	// inject some new MITM params here
	BN_pseudo_rand(srpc.b, 1024, -1, -1);
	BN_mod_exp(srpc.B, srpc.g, srpc.b, srpc.N, ctx);
	BN_pseudo_rand(srpc.u, 1024, -1, -1);
	ssrp_compute_uH(&srpc);
	ssrp_client_prepare_k(&srpc, password);
	hex_binary_to_string(srpc.client_K, cK, 20);
	printf("hash sended from client: %s\n", cK);
	ssrp_dictionary_attack(&srpc);
	// set client session key also to 0
}